:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): rework the scanner setup flow (#83095)
Tue Haulundd5c5eb13ec82
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex f361f1ddf3be..e4ced00be398 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -7348,22 +7348,30 @@ snapshots:hash: v1.k794b7964.cfb6e46fefd93430d17c650dfceeb62bc813855dd034c2a815db8559686dbeab.4iB6ZrgxCuEO7AoLgZCuqcAMX6eqMa42Fn3j6N6n5Xgscenes-app-replay-vision--scanner-digests--light:hash: v1.k794b7964.7160d1eb03abff790b4ed77db80e5913c3359d80bca9d7f6863321575816e639.Qq99zfKOxqgP8Eu0DmH_s3K_ekEAOzo8VZe7TZVn67I+ scenes-app-replay-vision--scanner-editor-budget--dark:+ hash: v1.k794b7964.42e4b220cdb14cc2459af06a332f598b81d0623af61d5b348b106353258d55b2.jCp1puvu6N0QmJmwh-EUu3TtKweZSCub1tKNSsDI4Yw+ scenes-app-replay-vision--scanner-editor-budget--light:+ hash: v1.k794b7964.f9c6c86d7d00060e501ebeb09ab6855d07c9f127e1931170252fd0ffd44fc693.3ey1j5pyzpuYLnVcWk0QPVODM0uPFGlqYp7-llGtmhsscenes-app-replay-vision--scanner-editor-configure--dark:- hash: v1.k794b7964.82acbdad74ebc38bd01523c958247e0e3eda9b6ab5d70766873a5bffa626c169.DCSu44RG8oNpq-MefGRQ5e1Gc-clGoUxTF8e3r-quS4+ hash: v1.k794b7964.61f87066671bf857e14979e95550a61dc07ed7c2bfab99cb4d7360afade82066.mkuP-3M9s_-cH0lTCGcZLkQlBC7MZg5qULwH_jH8_Pkscenes-app-replay-vision--scanner-editor-configure--light:- hash: v1.k794b7964.8d077b118f6788a905fb6a92f0185d8889eb98eac1ab4d71d185769e3dd7d03a.kqOEYzsN9t5kGh4fQOA36Ocxt0OgE8U1el95xrr8ePc+ hash: v1.k794b7964.9f19bcd55e23972399e5f4672499136ba3f5571d3be973b3355cf510c2b12918.Sog9MwuK85rJCkMV2CpOPVAq2KjLs6KH0jhxHPfzxsoscenes-app-replay-vision--scanner-editor-configure-lite-standard-pro--dark:- hash: v1.k794b7964.62b1c8ac23221b2c30d3fd5f43a6ba1ccd509b5fc70d40463bb11650ddf0b882.cS46A0AKKt1DeP8CTY0tgDk04NeIpDMlT3VuCoOhoJM+ hash: v1.k794b7964.d378b2d30654fe95450e4f558b9bb19fda722eebf061159aeb419054df4a15ec.qb-Bi7YuNIHsfR_dHteJuGc6gf0CizNlZ_EjFGIF9kQscenes-app-replay-vision--scanner-editor-configure-lite-standard-pro--light:- hash: v1.k794b7964.cbaa88ace169a9ebc3628911dee65ca3297fb7908e38e64221578ef2a48e30ff.ROrwmm9I1PYSwHLuhRLxW2hWQ48cSKD_3-7rzwxEcfo+ hash: v1.k794b7964.141d73c4927e43f3c7f3502c7722796662ce6cab841d9c904bbc78f79e253eba.iEdln95gNVUlXb7-uPtXI8wLEXS13whoHP6uC9c8h_Qscenes-app-replay-vision--scanner-editor-configure-tier-names--dark:- hash: v1.k794b7964.af8333fe74eeb0f3ab6454cf1b82d25e86de444e4f658cf914c2d249bf071bab.1qYw2Fyhc9oDujICwYYv4IOaH51UnlkWi9jf0bI5I-c+ hash: v1.k794b7964.86e8f160d6edd356555648b4acc08b7a481cfd7a3d209f6abcf620f7a4806409.1Ppl0UBwAOWpQdWLLHTBwfN5TffYt6xsV-Pa1Ub3dmIscenes-app-replay-vision--scanner-editor-configure-tier-names--light:- hash: v1.k794b7964.63e5a9fe3f72cebbc39c59bbe446569499cf2f4840ccb31899a4106e758358fb.bWZYX9B3FxvTrCXnwjzc56jV9PUBsp-CQnMcQWCqHEI+ hash: v1.k794b7964.db415f99f09b6e6b27142f829dcd8b409dd2c8d4bc77521b05488522d0c031df.R1f8mNKYwbkisQJ1-tc5p-W0pyNlyPnJXIWdOetWEdc+ scenes-app-replay-vision--scanner-editor-details--dark:+ hash: v1.k794b7964.b432270f77e7780bf7c0d1a0cbabfe3a6dcc4fcebbf2311f64a92f113f5ec8c2.N1ufgn3U8jNJTWVtd9YsSvOK6qxo8Kb-7Jkux2YeVdk+ scenes-app-replay-vision--scanner-editor-details--light:+ hash: v1.k794b7964.fc73906f3b66cea6854d196cbe65bf5e8a3586447dc9f56ba14490e9de8a3c1c.P1hBJpz_cfTllUtTdJSrgFOPNdIC106H6eAl0hswbCQscenes-app-replay-vision--scanner-editor-triggers--dark:- hash: v1.k794b7964.166ce138029235c749dec3b1bbf09b8af7d666dbb92375a7a2d8ed66fdfa7202.E5gIuCZqduv6Qz3_AuMRkF-HknnZvESW26W30tPAQuc+ hash: v1.k794b7964.5bc5dc77d7346163d92585657a949d38938bdbabf11a2a0341bc3a6b9c980c80.AL7y75QUTSwtUvG6XKJvD4CPhbEXC4TmNPkxG_57CQ4scenes-app-replay-vision--scanner-editor-triggers--light:- hash: v1.k794b7964.63b3d2d922a2dd471ee37bc48cbb18ec68cd9385d460de48d0e265d3017578ab.LZVA-vMEtsHiEFWOc5CgkwG7ZLl9BCj_JD9g36f8nwQ+ hash: v1.k794b7964.1325a276c040c4fdec27fd9d75ecde45e08d343f4e76806a03819747f4c52973.6k8EbsIyUMKtWUuUvV-ElrJCGK5_-iSXLT4bi_fp3Ggscenes-app-replay-vision--scanner-observations--dark:hash: v1.k794b7964.836bbeb03dc8a6a02c7489875920b0e0098cc696580490eb7163b36eb8e835f3.r_NXe4vOXdXkB7NxFQuoq9N4a3BlD6DMwP5HHCX4c70scenes-app-replay-vision--scanner-observations--light:@@ -7377,9 +7385,9 @@ snapshots:scenes-app-replay-vision--scanner-scan-drought--light:hash: v1.k794b7964.04cee1856f76c7975432a18c1e3e8e3d9ebd7b03cfeb80c47b246e8262ff1428.RfhQ3_f5sR1MSglvHlFb513u4b0ISfmaNTNFlRdvoogscenes-app-replay-vision--scanner-templates--dark:- hash: v1.k794b7964.9cac03fc02e7232ff1e7c332839eea0d2c5c51a79eecec58db797a06c8309516.IciAPSnOS_10OjdqcVp_uSlL7UoaqM5cYZLLyFdbzlE+ hash: v1.k794b7964.5730130a0ab80bc33dc701a8cc69c354f8ac4f50df6c4a25f6b0627a4e90ceeb.0zwSfaSwHJZ0F2c__vQj7Bj3VUvQZD3nu5zcrxJym9oscenes-app-replay-vision--scanner-templates--light:- hash: v1.k794b7964.f06941a37e15f6bb198044515a6c8e3768d3ffd78f7976f27a01cec1b8007551.7fPVsUy-0Y874d_CvqvhnZ3HRrBMn0yzXn3mUsfQ_hQ+ hash: v1.k794b7964.1f88a5eb5ce04ca6bea3009c62f23eb09af6e2540f21ef1e1e20fb53c3b38777.XnkQTLfdifTRzsriW4EbOkCXkWBJ1WLlBhE8dPsjcEcscenes-app-replay-vision--scanners-list--dark:hash: v1.k794b7964.f26ddd49023d8bd519d1b7519683f9584214fad7c572a028ccbcc94350daf5e5.AFY_giJl1OgV7nY3jGw5xsTmZT-35VA66AKv6chsNZIscenes-app-replay-vision--scanners-list--light:diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 3ff16a2e6804..3d04ba138eaa 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -208,8 +208,10 @@ export const productRoutes: Record<string, [string, string]> = {'/replay-vision/actions/:actionId': ['ReplayVisionAction', 'replayVisionAction'],'/replay-vision/:scannerId/actions/new': ['ReplayVisionActionEditor', 'replayVisionActionNew'],'/replay-vision/:id/template': ['ReplayVisionScannerEditor', 'replayVisionScannerTemplate'],+ '/replay-vision/:id/details': ['ReplayVisionScannerEditor', 'replayVisionScannerDetails'],'/replay-vision/:id/configure': ['ReplayVisionScannerEditor', 'replayVisionScannerConfigure'],'/replay-vision/:id/triggers': ['ReplayVisionScannerEditor', 'replayVisionScannerTriggers'],+ '/replay-vision/:id/budget': ['ReplayVisionScannerEditor', 'replayVisionScannerBudget'],'/replay-vision/:id/self-driving': ['ReplayVisionScannerEditor', 'replayVisionScannerSelfDriving'],'/replay-vision/:id': ['ReplayVisionScanner', 'replayVision'],'/code-review': ['CodeReview', 'codeReview'],@@ -1395,8 +1397,10 @@ export const productUrls = {replayVision: (id?: string): string => (id ? `/replay-vision/${id}` : '/replay-vision'),replayVisionTemplates: (): string => '/replay-vision/new/template',replayVisionScannerTemplate: (id: string): string => `/replay-vision/${id}/template`,+ replayVisionScannerDetails: (id: string): string => `/replay-vision/${id}/details`,replayVisionScannerConfigure: (id: string): string => `/replay-vision/${id}/configure`,replayVisionScannerTriggers: (id: string): string => `/replay-vision/${id}/triggers`,+ replayVisionScannerBudget: (id: string): string => `/replay-vision/${id}/budget`,replayVisionScannerSelfDriving: (id: string): string => `/replay-vision/${id}/self-driving`,replayVisionObservation: (observationId: string): string => `/replay-vision/observations/${observationId}`,replayVisionAction: (actionId: string): string => `/replay-vision/actions/${actionId}`,diff --git a/frontend/src/scenes/max/max-constants.tsx b/frontend/src/scenes/max/max-constants.tsxindex f4faeffbb430..abff4dab2540 100644--- a/frontend/src/scenes/max/max-constants.tsx+++ b/frontend/src/scenes/max/max-constants.tsx@@ -954,15 +954,15 @@ export const TOOL_DEFINITIONS: Record<AssistantTool, ToolDefinition> = {},},suggest_replay_vision_tags: {- name: 'Suggest tags',- description: 'Suggest tags for a classifier, grounded in what it has seen',+ name: 'Suggest categories',+ description: 'Suggest categories for a classifier, grounded in what it has seen',icon: iconForType('session_replay'),modes: [AgentMode.SessionReplay],displayFormatter: (toolCall) => {if (toolCall.status === 'completed') {- return 'Suggest tags'+ return 'Suggest categories'}- return 'Suggest tags...'+ return 'Suggest categories...'},},read_replay_vision_actions: {diff --git a/products/replay_vision/backend/api/scanners.py b/products/replay_vision/backend/api/scanners.pyindex e8120a1ee2d2..a1a56b37a39a 100644--- a/products/replay_vision/backend/api/scanners.py+++ b/products/replay_vision/backend/api/scanners.py@@ -263,7 +263,7 @@ class ReplayScannerSerializer(TaggedItemSerializerMixin, UserAccessControlSerialrequired=False,max_length=_MAX_TAGS,help_text=(- "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. "+ "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. ""Tags cannot contain commas."),)@@ -1184,7 +1184,7 @@ class SuggestTagsRequestSerializer(serializers.Serializer):required=False,default=list,max_length=200,- help_text="The current tag vocabulary, so suggestions never duplicate a tag the user already has.",+ help_text="The categories already configured, so suggestions never duplicate one the user has.",)multi_label = serializers.BooleanField(required=False,@@ -1895,7 +1895,7 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, vi"""Suggest classifier tags grounded in the scanner's own observations and the org's product data."""# Suggestions read recording-derived observation reasoning, so gate on session_recording read.if not self.user_access_control.check_access_level_for_resource("session_recording", required_level="viewer"):- raise PermissionDenied("Suggesting classifier tags requires session_recording read access.")+ raise PermissionDenied("Suggesting categories requires session_recording read access.")body = SuggestTagsRequestSerializer(data=request.data)body.is_valid(raise_exception=True)diff --git a/products/replay_vision/backend/max_tools.py b/products/replay_vision/backend/max_tools.pyindex 640d2716204d..cacbe05f2949 100644--- a/products/replay_vision/backend/max_tools.py+++ b/products/replay_vision/backend/max_tools.py@@ -2238,7 +2238,7 @@ class SuggestReplayVisionTagsTool(ReplayVisionGatesMixin, MaxTool):if scanner is None:return f"Scanner {scanner_id} not found.", {"error": "not_found"}if scanner.scanner_type != ScannerType.CLASSIFIER:- return "Only classifier scanners have a tag vocabulary.", {"error": "not_a_classifier"}+ return "Only classifier scanners have categories.", {"error": "not_a_classifier"}# Pooled rather than thread-sensitive: the model call carries a 90s timeout, and the shared# executor would queue every other database operation behind it. Still connection-managed,# because the suggestion path reads observations and event definitions.diff --git a/products/replay_vision/backend/scanner_config.py b/products/replay_vision/backend/scanner_config.pyindex 905d10c75cd2..a8742f467cfc 100644--- a/products/replay_vision/backend/scanner_config.py+++ b/products/replay_vision/backend/scanner_config.py@@ -29,21 +29,21 @@ def scanner_config_error(scanner_type: ScannerType, scanner_config: Any) -> strif scanner_type == ScannerType.CLASSIFIER:tags = scanner_config.get("tags") or []if len(tags) == 0:- return "Tag vocabulary must have at least one tag."+ return "Add at least one category."if len(tags) > MAX_TAGS:- return f"Tag vocabulary can have at most {MAX_TAGS} tags."+ return f"You can have at most {MAX_TAGS} categories."if any(not isinstance(t, str) or not t.strip() for t in tags):- return "Tags can't be blank."+ return "Categories can't be blank."if any(len(t) > MAX_TAG_LENGTH for t in tags):- return f"Tags can be at most {MAX_TAG_LENGTH} characters."+ return f"Categories can be at most {MAX_TAG_LENGTH} characters."# Uniqueness on the slug, since filtering/stripping/search all compare slugified tags downstream.slugged: dict[str, str] = {}for t in tags:slug = slugify_tag(t)if not slug:- return "Tags must contain letters or numbers."+ return "Categories must contain letters or numbers."if slug in slugged:- return f"Tags must be unique: '{slugged[slug]}' and '{t}' are the same tag."+ return f"Categories must be unique: '{slugged[slug]}' and '{t}' are the same category."slugged[slug] = tif scanner_type == ScannerType.SCORER:scale = scanner_config.get("scale")diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.pyindex d4af3c474648..2e2a7801405f 100644--- a/products/replay_vision/backend/tests/test_api.py+++ b/products/replay_vision/backend/tests/test_api.py@@ -294,37 +294,37 @@ class TestReplayScannerViewSet(_VisionAPITestCase):"classifier_empty_tags",ScannerType.CLASSIFIER,{"prompt": "p", "tags": []},- "Tag vocabulary must have at least one tag.",+ "Add at least one category.",),("classifier_missing_tags",ScannerType.CLASSIFIER,{"prompt": "p"},- "Tag vocabulary must have at least one tag.",+ "Add at least one category.",),("classifier_blank_tag",ScannerType.CLASSIFIER,{"prompt": "p", "tags": ["bug", " "]},- "Tags can't be blank.",+ "Categories can't be blank.",),("classifier_duplicate_tags",ScannerType.CLASSIFIER,{"prompt": "p", "tags": ["Bug", "bug"]},- "Tags must be unique: 'Bug' and 'bug' are the same tag.",+ "Categories must be unique: 'Bug' and 'bug' are the same category.",),("classifier_slug_colliding_tags",ScannerType.CLASSIFIER,{"prompt": "p", "tags": ["login issue", "login_issue"]},- "Tags must be unique: 'login issue' and 'login_issue' are the same tag.",+ "Categories must be unique: 'login issue' and 'login_issue' are the same category.",),("classifier_tag_without_alphanumerics",ScannerType.CLASSIFIER,{"prompt": "p", "tags": ["!!!"]},- "Tags must contain letters or numbers.",+ "Categories must contain letters or numbers.",),("monitor_missing_prompt",@@ -366,13 +366,13 @@ class TestReplayScannerViewSet(_VisionAPITestCase):"too_many_tags",ScannerType.CLASSIFIER,{"prompt": "p", "tags": [f"tag-{i}" for i in range(101)]},- "Tag vocabulary can have at most 100 tags.",+ "You can have at most 100 categories.",),("overlong_tag",ScannerType.CLASSIFIER,{"prompt": "p", "tags": ["ok", "x" * 101]},- "Tags can be at most 100 characters.",+ "Categories can be at most 100 characters.",),("unknown_config_key",diff --git a/products/replay_vision/frontend/components/FilterPill.tsx b/products/replay_vision/frontend/components/FilterPill.tsxindex 90dc3d8dd299..3e6f585caee4 100644--- a/products/replay_vision/frontend/components/FilterPill.tsx+++ b/products/replay_vision/frontend/components/FilterPill.tsx@@ -8,12 +8,14 @@ export function FilterPill<T extends string>({value,onChange,searchable = false,+ searchPlaceholder,}: {label: stringoptions: { value: T; label: string }[]value: T[]onChange: (next: T[]) => voidsearchable?: boolean+ searchPlaceholder?: string}): JSX.Element {const [searchTerm, setSearchTerm] = useState('')const filteredOptions = searchTerm@@ -39,7 +41,7 @@ export function FilterPill<T extends string>({<LemonInputtype="search"size="small"- placeholder="Search tags"+ placeholder={searchPlaceholder ?? `Search ${label.toLowerCase()}`}autoFocusfullWidthvalue={searchTerm}diff --git a/products/replay_vision/frontend/components/ObservationCard.tsx b/products/replay_vision/frontend/components/ObservationCard.tsxindex 5b5c4a690d50..990afff58d18 100644--- a/products/replay_vision/frontend/components/ObservationCard.tsx+++ b/products/replay_vision/frontend/components/ObservationCard.tsx@@ -250,7 +250,7 @@ export function ObservationPrimaryOutput({<div className="flex flex-col gap-1"><div className="flex flex-wrap gap-1">{empty ? (- <span className="text-muted text-sm">No tags</span>+ <span className="text-muted text-sm">No categories</span>) : (<>{fixedTags.map((tag, index) => (@@ -269,7 +269,7 @@ export function ObservationPrimaryOutput({if (configuredTags.length === 0 && empty) {return (<div className="flex flex-col gap-1">- <span className="text-muted text-sm">No tags</span>+ <span className="text-muted text-sm">No categories</span>{prompt && <span className={promptClass}>{prompt}</span>}</div>)diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.tsindex d08b554b5153..8a683d777ae4 100644--- a/products/replay_vision/frontend/generated/api.schemas.ts+++ b/products/replay_vision/frontend/generated/api.schemas.ts@@ -823,7 +823,7 @@ export interface ReplayScannerApi {*/description?: string/**- * Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas.+ * Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas.* @maxItems 32* @items.maxLength 255*/@@ -936,7 +936,7 @@ export interface PatchedReplayScannerApi {*/description?: string/**- * Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas.+ * Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas.* @maxItems 32* @items.maxLength 255*/@@ -1775,7 +1775,7 @@ export interface SuggestTagsRequestApi {*/prompt: string/**- * The current tag vocabulary, so suggestions never duplicate a tag the user already has.+ * The categories already configured, so suggestions never duplicate one the user has.* @maxItems 200* @items.maxLength 200*/diff --git a/products/replay_vision/frontend/generated/api.zod.ts b/products/replay_vision/frontend/generated/api.zod.tsindex 2ee82a6cfa3a..e7690b5c1e38 100644--- a/products/replay_vision/frontend/generated/api.zod.ts+++ b/products/replay_vision/frontend/generated/api.zod.ts@@ -438,7 +438,7 @@ export const VisionScannersCreateBody = /* @__PURE__ */ zod.max(visionScannersCreateBodyTagsMax).optional().describe(- "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas."+ "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas."),scanner_type: zod.enum(['monitor', 'classifier', 'scorer', 'summarizer'])@@ -570,7 +570,7 @@ export const VisionScannersPartialUpdateBody = /* @__PURE__ */ zod.max(visionScannersPartialUpdateBodyTagsMax).optional().describe(- "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas."+ "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas."),scanner_type: zod.enum(['monitor', 'classifier', 'scorer', 'summarizer'])@@ -974,7 +974,7 @@ export const VisionScannersSuggestTagsCreateBody = /* @__PURE__ */ zod.array(zod.string().max(visionScannersSuggestTagsCreateBodyTagsItemMax)).max(visionScannersSuggestTagsCreateBodyTagsMax).optional()- .describe('The current tag vocabulary, so suggestions never duplicate a tag the user already has.'),+ .describe('The categories already configured, so suggestions never duplicate one the user has.'),multi_label: zod.boolean().default(visionScannersSuggestTagsCreateBodyMultiLabelDefault)diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsxindex bc527394e3db..360d9421f763 100644--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx@@ -75,7 +75,7 @@ export const scene: SceneExport = {}const SUCCEEDED_OUTPUT_LABEL: Record<ScannerType, string> = {- classifier: 'Tags',+ classifier: 'Categories',summarizer: 'Summary',monitor: 'Verdict',scorer: 'Score',@@ -536,7 +536,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {</LabeledRow>)}{classifierVocab && classifierVocab.length > 0 && (- <LabeledRow label="Vocabulary">+ <LabeledRow label="Categories"><div className="flex flex-wrap gap-1">{classifierVocab.map((tag) => (<LemonTag key={tag} type="default" size="small">@@ -552,12 +552,12 @@ export function ReplayObservationSceneComponent(): JSX.Element {</LabeledRow>)}{classifierMultiLabel !== null && (- <LabeledRow label="Multi-label">+ <LabeledRow label="Multiple categories per session"><BooleanTag value={classifierMultiLabel} /></LabeledRow>)}{classifierAllowFreeform !== null && (- <LabeledRow label="Freeform tags">+ <LabeledRow label="Freeform categories"><BooleanTag value={classifierAllowFreeform} /></LabeledRow>)}diff --git a/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx b/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsxindex dc8aaf7d2a0e..b0219b533f1e 100644--- a/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx+++ b/products/replay_vision/frontend/replay_scanners/ActionEditorScene.tsx@@ -218,13 +218,13 @@ function TargetingSection({ scannerId }: { scannerId: string }): JSX.Element | ncase 'classifier': {const configuredTags: string[] = scanner.scanner_config?.tags ?? []const allowFreeform = !!scanner.scanner_config?.allow_freeform_tags- filteredLabel = 'Only certain tags'+ filteredLabel = 'Only certain categories'controls = (<div className="flex flex-col gap-1"><LemonInputSelectmode="multiple"allowCustomValues={allowFreeform}- placeholder="Pick tags…"+ placeholder="Pick categories…"value={actionForm.tags}onChange={(tags) => setActionFormValue('tags', tags)}options={[...new Set([...configuredTags, ...actionForm.tags])].map((t) => ({@@ -233,7 +233,7 @@ function TargetingSection({ scannerId }: { scannerId: string }): JSX.Element | n}))}data-attr="vision-action-targeting-tags"/>- <span className="text-xs text-muted">Only summarize observations tagged with any of these.</span>+ <span className="text-xs text-muted">Only summarize observations in any of these categories.</span></div>)break@@ -346,14 +346,14 @@ function AlertMatchLine({ scannerId }: { scannerId: string }): JSX.Element | nulcase 'classifier': {const configuredTags: string[] = scanner.scanner_config?.tags ?? []const allowFreeform = !!scanner.scanner_config?.allow_freeform_tags- lead = 'tagged'+ lead = 'in category'control = (<div className="min-w-48"><LemonInputSelectmode="multiple"size="small"allowCustomValues={allowFreeform}- placeholder="any tag"+ placeholder="any category"value={actionForm.tags}onChange={(tags) => setActionFormValue('tags', tags)}options={[...new Set([...configuredTags, ...actionForm.tags])].map((tag) => ({diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsxindex 5d56660a7d16..7f61294ca9dd 100644--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx@@ -638,6 +638,10 @@ export const ScannerTemplates: StoryObj = {parameters: { pageUrl: urls.replayVisionTemplates() },}+export const ScannerEditorDetails: StoryObj = {+ parameters: { pageUrl: urls.replayVisionScannerDetails(summarizerScanner.id) },+}+export const ScannerEditorConfigure: StoryObj = {parameters: { pageUrl: urls.replayVisionScannerConfigure(summarizerScanner.id) },}@@ -662,6 +666,10 @@ export const ScannerEditorTriggers: StoryObj = {parameters: { pageUrl: urls.replayVisionScannerTriggers(summarizerScanner.id) },}+export const ScannerEditorBudget: StoryObj = {+ parameters: { pageUrl: urls.replayVisionScannerBudget(summarizerScanner.id) },+}+export const ActionEditorAlert: StoryObj = {parameters: {pageUrl: urls.replayVisionActionNew(summarizerScanner.id, 'alert'),diff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsxindex fc83d6c84a2d..987b3ee154ad 100644--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx@@ -5,9 +5,20 @@ import { router } from 'kea-router'import * as construction2Png from '@posthog/brand/hoggies/png/construction-2'import * as imTheDriverPng from '@posthog/brand/hoggies/png/im-the-driver'import * as magnifyingGlassPng from '@posthog/brand/hoggies/png/magnifying-glass-1'+import * as moneyPng from '@posthog/brand/hoggies/png/money'+import * as reporterPng from '@posthog/brand/hoggies/png/reporter'import * as xRayPng from '@posthog/brand/hoggies/png/x-ray'import { IconSparkles } from '@posthog/icons'-import { LemonButton, LemonInput, LemonSelect, LemonSwitch, LemonTag, LemonTextArea, Link } from '@posthog/lemon-ui'+import {+ LemonButton,+ LemonCard,+ LemonInput,+ LemonSelect,+ LemonSwitch,+ LemonTag,+ LemonTextArea,+ Link,+} from '@posthog/lemon-ui'import { pngHoggie } from 'lib/brand/hoggies'import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'@@ -27,16 +38,20 @@ import { ProductKey } from '~/queries/schema/schema-general'import { CreditPriceNote } from '../components/PricingLink'import { ReplayVisionFeedbackButton } from '../components/ReplayVisionFeedbackButton'import { getReplayVisionEditDisabledReason } from '../utils/accessControl'+import { ScannerBudget } from './components/ScannerBudget'import { ScannerGoalDraft } from './components/ScannerGoalDraft'import { ScannerTemplatePicker } from './components/ScannerTemplatePicker'import { ScannerTriggers } from './components/ScannerTriggers'import { ScannerTypeConfigEditor } from './components/ScannerTypeConfigEditor'import { replayScannerLogic } from './replayScannerLogic'import {+ SCANNER_EDITOR_STEPS,SCANNER_EDITOR_STEP_ORDER,ScannerEditorStep,+ UNVALIDATED_SCANNER_STEPS,+ scannerStepErrors,scannerEditorSceneLogic,- scannerStepUrl,+ scannerStepUrlWithParams,} from './scannerEditorSceneLogic'import { ScannerEditorStepper, STEP_LABELS } from './ScannerEditorStepper'import { SCANNER_TYPE_OPTIONS, getModelOptions, modelNamingVariant } from './types'@@ -44,6 +59,8 @@ import { SCANNER_TYPE_OPTIONS, getModelOptions, modelNamingVariant } from './typconst HedgehogConstruction2 = pngHoggie(construction2Png)const HedgehogImTheDriver = pngHoggie(imTheDriverPng)const HedgehogMagnifyingGlass = pngHoggie(magnifyingGlassPng)+const HedgehogReporter = pngHoggie(reporterPng)+const HedgehogMoney = pngHoggie(moneyPng)const HedgehogXRay = pngHoggie(xRayPng)export const scene: SceneExport = {@@ -57,6 +74,11 @@ const STEP_HEADERS: Record<Exclude<ScannerEditorStep, 'template'>,{ hedgehog: JSX.Element; title: string; subtitle: string }> = {+ details: {+ hedgehog: <HedgehogReporter className="h-16 sm:h-24 w-auto shrink-0" />,+ title: 'Name your scanner',+ subtitle: 'All optional. Tags help you find it later in the scanner list.',+ },configure: {hedgehog: <HedgehogMagnifyingGlass className="h-16 sm:h-24 w-auto shrink-0" />,title: 'Configure your scanner',@@ -64,18 +86,19 @@ const STEP_HEADERS: Record<},triggers: {hedgehog: <HedgehogConstruction2 className="h-16 sm:h-24 w-auto shrink-0" />,- title: 'Set up scan conditions',- subtitle: 'Pick which recordings to scan, and how often.',+ title: 'Pick the recordings to scan',+ subtitle: 'Narrow down which sessions this scanner watches.',},- self_driving: {- hedgehog: <HedgehogImTheDriver className="h-16 sm:h-24 w-auto shrink-0" />,- title: 'Self-driving',- subtitle: 'Close the loop: from findings to shipped fixes.',+ budget: {+ hedgehog: <HedgehogMoney className="h-16 sm:h-24 w-auto shrink-0" />,+ title: 'Set your budget',+ subtitle: 'How much of the matching traffic to scan, and what to spend on it.',},}export function ScannerEditorSceneComponent(): JSX.Element {- const { scannerId, step, isNew, visibleSteps } = useValues(scannerEditorSceneLogic)+ const { scannerId, step, isNew } = useValues(scannerEditorSceneLogic)+ const { searchParams } = useValues(router)const scannerLogic = replayScannerLogic({ id: scannerId })useAttachedLogic(scannerLogic, scannerEditorSceneLogic)@@ -88,7 +111,7 @@ export function ScannerEditorSceneComponent(): JSX.Element {showScannerErrors,durationValidationError,} = useValues(scannerLogic)- const { submitScanner, setSubmitIntent } = useActions(scannerLogic)+ const { submitScanner } = useActions(scannerLogic)if (step !== 'template' && (scannerLoading || !scanner)) {return (@@ -100,20 +123,20 @@ export function ScannerEditorSceneComponent(): JSX.Element {const title = isNew ? scanner?.name || 'New scanner' : scanner?.name || 'Scanner'- const stepErrors: Record<ScannerEditorStep, boolean> = {- template: false,- self_driving: false,- configure: showScannerErrors && !!(scannerValidationErrors?.name || scannerValidationErrors?.scanner_config),- triggers:- showScannerErrors &&- (scannerValidationErrors?.sampling_rate != null ||- scannerValidationErrors?.credit_limit != null ||- durationValidationError != null),- }+ const stepErrors = showScannerErrors+ ? scannerStepErrors({ ...scannerValidationErrors, duration: durationValidationError })+ : undefined- // Validate the current step and move on: submit routes to the next visible step on success.+ // Validate the current step and move on: submit routes to the next step on success. A step with+ // nothing to validate navigates straight on, so it can't fail on fields the user hasn't reached.const advance = (): void => {- setSubmitIntent('advance')+ if (UNVALIDATED_SCANNER_STEPS.includes(step)) {+ const next = SCANNER_EDITOR_STEPS[SCANNER_EDITOR_STEPS.indexOf(step) + 1]+ if (next) {+ router.actions.push(scannerStepUrlWithParams(next, scannerId, searchParams))+ return+ }+ }submitScanner()}@@ -123,13 +146,13 @@ export function ScannerEditorSceneComponent(): JSX.Element {}if (SCANNER_EDITOR_STEP_ORDER[next] > SCANNER_EDITOR_STEP_ORDER[step]) {if (step === 'template') {- router.actions.push(urls.replayVisionScannerConfigure(scannerId))+ router.actions.push(urls.replayVisionScannerDetails(scannerId))return}advance()return}- router.actions.push(scannerStepUrl(next, scannerId))+ router.actions.push(scannerStepUrlWithParams(next, scannerId, searchParams))}return (@@ -143,9 +166,12 @@ export function ScannerEditorSceneComponent(): JSX.Element {/><ScannerEditorSteppercurrentStep={step}- steps={visibleSteps}+ steps={SCANNER_EDITOR_STEPS}onStepClick={goToStep}stepErrors={stepErrors}+ disabledSteps={+ isNew ? undefined : { template: 'A saved scanner keeps the template it was created from' }+ }/>{step === 'template' ? (<>@@ -178,24 +204,22 @@ export function ScannerEditorSceneComponent(): JSX.Element {<div className="text-sm text-muted">{STEP_HEADERS[step].subtitle}</div></div></div>- {step === 'configure' ? (+ {step === 'details' ? (+ <DetailsStep />+ ) : step === 'configure' ? (<ConfigureStep />) : step === 'triggers' ? (<ScannerTriggers scannerId={scannerId} />) : (- <SelfDrivingStep />+ <ScannerBudget scannerId={scannerId} />)}<EditorFooterstep={step}scannerId={scannerId}- visibleSteps={visibleSteps}isNew={isNew}isSubmitting={isScannerSubmitting}onAdvance={advance}- onSave={() => {- setSubmitIntent('save')- submitScanner()- }}+ onSave={() => submitScanner()}/></div></Form>@@ -206,32 +230,12 @@ export function ScannerEditorSceneComponent(): JSX.Element {)}-function ConfigureStep(): JSX.Element {- const { scannerId } = useValues(scannerEditorSceneLogic)- const { scanner, isNew, goalDraft } = useValues(replayScannerLogic({ id: scannerId }))- const { setScannerType } = useActions(replayScannerLogic({ id: scannerId }))- const { searchParams } = useValues(router)- const { featureFlags } = useValues(featureFlagLogic)+function DetailsStep(): JSX.Element {const { tags: allTags } = useValues(tagsModel)- const namingVariant = modelNamingVariant(featureFlags[FEATURE_FLAGS.REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT])- const isTypeSelectable = isNew && !searchParams.template-- if (!scanner) {- return <></>- }return (<div className="flex flex-col gap-4">- {isNew && goalDraft?.rationale ? (- <div- className="flex items-start gap-2 rounded border border-[var(--color-ai)] p-3 text-sm"- data-attr="vision-goal-draft-rationale"- >- <IconSparkles className="text-ai mt-0.5 size-4 shrink-0" />- <span>{goalDraft.rationale}</span>- </div>- ) : null}- <LemonField name="name" label="Name">+ <LemonField name="name" label="Name (optional)"><LemonInput placeholder="e.g. Checkout friction" /></LemonField>@@ -253,13 +257,40 @@ function ConfigureStep(): JSX.Element {tags={value ?? []}onChange={onChange}saving={false}- // Tags from other products can contain commas; the scanner API rejects those, so don't offer them.+ // Tags from other products can contain commas; the scanner API rejects those.tagsAvailable={allTags.filter((tag) => !tag.includes(',') && !value?.includes(tag))}data-attr="vision-editor-tags"/>)}</LemonField>+ </div>+ )+}+function ConfigureStep(): JSX.Element {+ const { scannerId } = useValues(scannerEditorSceneLogic)+ const { scanner, isNew, goalDraft } = useValues(replayScannerLogic({ id: scannerId }))+ const { setScannerType } = useActions(replayScannerLogic({ id: scannerId }))+ const { searchParams } = useValues(router)+ const { featureFlags } = useValues(featureFlagLogic)+ const namingVariant = modelNamingVariant(featureFlags[FEATURE_FLAGS.REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT])+ const isTypeSelectable = isNew && !searchParams.template++ if (!scanner) {+ return <></>+ }++ return (+ <div className="flex flex-col gap-4">+ {isNew && goalDraft?.rationale ? (+ <div+ className="flex items-start gap-2 rounded border border-[var(--color-ai)] p-3 text-sm"+ data-attr="vision-goal-draft-rationale"+ >+ <IconSparkles className="text-ai mt-0.5 size-4 shrink-0" />+ <span>{goalDraft.rationale}</span>+ </div>+ ) : null}{isTypeSelectable ? (<LemonField name="scanner_type" label="Scanner type" className="items-start"><LemonSelect@@ -335,34 +366,33 @@ function ConfigureStep(): JSX.Element {</div><ScannerTypeConfigEditor scannerId={scannerId} />- </div>- )-}-function SelfDrivingStep(): JSX.Element {- return (- <div className="flex flex-col gap-4">- <p className="text-sm text-muted m-0">- Don't just find problems, fix them. As this scanner reviews recordings, any issues it spots flow into- PostHog Signals, where agents dig into the root cause and draft a pull request. You stay in control of- what ships.{' '}- <Link to="https://posthog.com/self-driving" target="_blank">- Learn more about PostHog self-driving- </Link>- .- </p><LemonField name="emits_signals">{({ value, onChange }) => (- <div className="flex items-center gap-3">- <LemonSwitch checked={!!value} onChange={onChange} />- <div>- <div className="text-sm font-medium">Emit findings as Signals</div>- <div className="text-xs text-muted">- Adds a side mission to each scan: clear, actionable product issues are emitted as- PostHog Signals to feed the self-driving loop.+ <LemonCard hoverEffect={false} className="p-3">+ <div className="flex items-center gap-4">+ <HedgehogImTheDriver className="h-16 sm:h-20 w-auto shrink-0" />+ <div className="flex-1 space-y-1">+ <div className="text-sm font-medium">Self-driving</div>+ <div className="text-xs text-muted">+ Don't just find problems, fix them. Issues this scanner spots flow into PostHog+ Signals, where agents dig into the root cause and draft a pull request. You stay in+ control of what ships.{' '}+ <Link to="https://posthog.com/self-driving" target="_blank">+ Learn more about PostHog self-driving+ </Link>+ .+ </div></div>+ <LemonSwitch+ checked={!!value}+ onChange={onChange}+ label="Emit findings as Signals"+ bordered+ className="shrink-0"+ /></div>- </div>+ </LemonCard>)}</LemonField></div>@@ -372,7 +402,6 @@ function SelfDrivingStep(): JSX.Element {function EditorFooter({step,scannerId,- visibleSteps,isNew,isSubmitting,onAdvance,@@ -380,21 +409,22 @@ function EditorFooter({}: {step: ScannerEditorStepscannerId: string- visibleSteps: readonly ScannerEditorStep[]isNew: booleanisSubmitting: booleanonAdvance: () => voidonSave: () => void}): JSX.Element {const { scanner, durationValidationError, hasUnsavedChanges } = useValues(replayScannerLogic({ id: scannerId }))+ const { searchParams } = useValues(router)const { discardScannerDraft } = useActions(replayScannerLogic({ id: scannerId }))- const stepIndex = visibleSteps.indexOf(step)- const prevStep = stepIndex > 0 ? visibleSteps[stepIndex - 1] : null- const nextStep = stepIndex < visibleSteps.length - 1 ? visibleSteps[stepIndex + 1] : null+ const stepIndex = SCANNER_EDITOR_STEPS.indexOf(step)+ const previous = stepIndex > 0 ? SCANNER_EDITOR_STEPS[stepIndex - 1] : null+ const prevStep = previous === 'template' && !isNew ? null : previous+ const nextStep = stepIndex < SCANNER_EDITOR_STEPS.length - 1 ? SCANNER_EDITOR_STEPS[stepIndex + 1] : null// A broken duration filter blocks the save, but only from the triggers step onward: gating an// earlier step's button on it blocks the wizard with a reason nothing on screen explains. RBAC// takes priority and must match the backend's create/update requirement exactly.- const ownsDurationFilter = step === 'triggers' || step === 'self_driving'+ const ownsDurationFilter = step === 'triggers' || step === 'budget'const durationError = ownsDurationFilter ? durationValidationError : nullconst saveDisabledReason = getReplayVisionEditDisabledReason(scanner?.user_access_level) ?? durationError@@ -420,21 +450,13 @@ function EditorFooter({return (<div className="flex flex-col gap-2">- {/* On self-driving the duration field isn't on screen, so a tooltip alone isn't enough. */}- {step === 'self_driving' && durationError ? (- <div className="text-danger text-sm">{durationError}</div>- ) : null}+ {/* The duration field lives on the recordings step, so budget needs the error spelled out. */}+ {step === 'budget' && durationError ? <div className="text-danger text-sm">{durationError}</div> : null}<div className="flex flex-wrap items-center justify-between gap-2">- {/* First form step of a new scanner goes back to the template picker; a mid-flow step goes to the- previous visible step; editing's first step (configure, no template) has no back. */}- {isNew && step === 'configure' ? (- <LemonButton type="tertiary" to={urls.replayVisionTemplates()} data-attr="vision-editor-back">- Back to templates- </LemonButton>- ) : prevStep ? (+ {prevStep ? (<LemonButtontype="tertiary"- to={scannerStepUrl(prevStep, scannerId)}+ to={scannerStepUrlWithParams(prevStep, scannerId, searchParams)}data-attr="vision-editor-back">Backdiff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsxindex 49d5bd31ef18..871ffa825346 100644--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx@@ -7,9 +7,10 @@ import { SCANNER_EDITOR_STEP_ORDER, ScannerEditorStep } from './scannerEditorSceexport const STEP_LABELS: Record<ScannerEditorStep, string> = {template: 'Template',+ details: 'Details',configure: 'Configure',- triggers: 'Scan conditions',- self_driving: 'Self-driving',+ triggers: 'Recordings',+ budget: 'Budget',}interface ScannerEditorStepperProps {@@ -17,6 +18,8 @@ interface ScannerEditorStepperProps {steps: readonly ScannerEditorStep[]onStepClick: (step: ScannerEditorStep) => voidstepErrors?: Partial<Record<ScannerEditorStep, boolean>>+ /** Steps that stay in the sequence for consistent numbering but can't be navigated to. */+ disabledSteps?: Partial<Record<ScannerEditorStep, string>>}export function ScannerEditorStepper({@@ -24,6 +27,7 @@ export function ScannerEditorStepper({steps,onStepClick,stepErrors = {},+ disabledSteps = {},}: ScannerEditorStepperProps): JSX.Element {const currentOrder = SCANNER_EDITOR_STEP_ORDER[currentStep]@@ -35,6 +39,7 @@ export function ScannerEditorStepper({const isCompleted = currentOrder > stepOrderconst isCurrent = currentStep === step.keyconst hasErrors = !!stepErrors[step.key]+ const disabledReason = disabledSteps[step.key]return (<div key={step.key} className="flex items-center">@@ -50,47 +55,52 @@ export function ScannerEditorStepper({)}/>)}- <button- type="button"- onClick={() => onStepClick(step.key)}- data-attr={`vision-editor-step-${step.key}`}- className={cn(- 'group flex items-center gap-1.5 px-2 py-1 rounded transition-all duration-150',- 'focus:outline-none focus-visible:ring-1 focus-visible:ring-accent',- 'hover:bg-fill-button-tertiary-hover active:scale-[0.98]'- )}- aria-current={isCurrent ? 'step' : undefined}- >- {/* Errors outrank the completed checkmark. */}- {hasErrors ? (- <Tooltip title="This step has errors to fix">- <IconWarning className="size-5 text-warning" />- </Tooltip>- ) : isCompleted ? (- <IconCheckCircle className="size-5 text-success" />- ) : (+ <Tooltip title={disabledReason}>+ <button+ type="button"+ onClick={() => !disabledReason && onStepClick(step.key)}+ aria-disabled={!!disabledReason}+ data-attr={`vision-editor-step-${step.key}`}+ className={cn(+ 'group flex items-center gap-1.5 px-2 py-1 rounded transition-all duration-150',+ 'focus:outline-none focus-visible:ring-1 focus-visible:ring-accent',+ disabledReason+ ? 'opacity-50 cursor-default'+ : 'hover:bg-fill-button-tertiary-hover active:scale-[0.98]'+ )}+ aria-current={isCurrent ? 'step' : undefined}+ >+ {/* Errors outrank the completed checkmark. */}+ {hasErrors ? (+ <Tooltip title="This step has errors to fix">+ <IconWarning className="size-5 text-warning" />+ </Tooltip>+ ) : isCompleted ? (+ <IconCheckCircle className="size-5 text-success" />+ ) : (+ <span+ className={cn(+ 'flex items-center justify-center size-5 rounded-full text-xs font-semibold',+ 'transition-all duration-150',+ isCurrent && 'bg-accent text-primary-inverse ring-2 ring-accent/25',+ !isCurrent && 'bg-surface-secondary text-secondary border border-primary'+ )}+ >+ {index + 1}+ </span>+ )}<spanclassName={cn(- 'flex items-center justify-center size-5 rounded-full text-xs font-semibold',- 'transition-all duration-150',- isCurrent && 'bg-accent text-primary-inverse ring-2 ring-accent/25',- !isCurrent && 'bg-surface-secondary text-secondary border border-primary'+ 'text-sm transition-colors duration-150',+ isCurrent && 'font-semibold text-primary',+ isCompleted && 'font-medium text-primary',+ !isCompleted && !isCurrent && 'text-secondary')}>- {index + 1}+ {step.label}</span>- )}- <span- className={cn(- 'text-sm transition-colors duration-150',- isCurrent && 'font-semibold text-primary',- isCompleted && 'font-medium text-primary',- !isCompleted && !isCurrent && 'text-secondary'- )}- >- {step.label}- </span>- </button>+ </button>+ </Tooltip></div>)})}diff --git a/products/replay_vision/frontend/replay_scanners/components/ConfigChangeCards.tsx b/products/replay_vision/frontend/replay_scanners/components/ConfigChangeCards.tsxindex 9c44d519ea39..a54c6e82140d 100644--- a/products/replay_vision/frontend/replay_scanners/components/ConfigChangeCards.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ConfigChangeCards.tsx@@ -93,7 +93,7 @@ function EditableTags({onChange={setDraft}onPressEnter={addDraft}onBlur={addDraft}- placeholder="Add tag…"+ placeholder="Add category…"className="w-24 [&_input]:placeholder:text-tertiary [&_input]:placeholder:text-xs"/></div>diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.scss b/products/replay_vision/frontend/replay_scanners/components/ScannerBudget.scsssimilarity index 100%rename from products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.scssrename to products/replay_vision/frontend/replay_scanners/components/ScannerBudget.scssdiff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerBudget.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerBudget.tsxnew file mode 100644index 000000000000..c5e50dcc549e--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerBudget.tsx@@ -0,0 +1,96 @@+import './ScannerBudget.scss'++import { useValues } from 'kea'++import { LemonCard, LemonInput, LemonSegmentedButton } from '@posthog/lemon-ui'++import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonLabel } from 'lib/lemon-ui/LemonLabel'+import { LemonSlider } from 'lib/lemon-ui/LemonSlider'++import { replayScannerLogic } from '../replayScannerLogic'+import { SAMPLING_MODE_OPTIONS, SamplingMode } from '../types'+import { ScannerCreditLimit } from './ScannerCreditLimit'+import { ScannerQuotaForecast } from './ScannerQuotaForecast'++/** How much of the matching traffic to spend on: what the scanner watches is set on the previous step. */+export function ScannerBudget({ scannerId }: { scannerId: string }): JSX.Element {+ const { scanner } = useValues(replayScannerLogic({ id: scannerId }))++ if (!scanner) {+ return <div className="text-muted">Loading…</div>+ }++ return (+ <div className="space-y-6">+ <LemonField name="sampling_rate">+ {({ value, onChange }) => {+ const ratio = typeof value === 'number' ? value : 0+ const samplingPercent = Math.round(ratio * 1000) / 10+ return (+ <LemonCard hoverEffect={false} className="p-3 space-y-3">+ <div className="space-y-1">+ <LemonLabel>Sampling</LemonLabel>+ <div className="text-xs text-muted">+ Each observation counts against your monthly Vision quota.+ </div>+ </div>+ <div className="flex items-center gap-4">+ <div className="flex-1">+ <LemonSlider+ value={samplingPercent}+ onChange={(v) => onChange(v / 100)}+ min={0.1}+ max={100}+ step={0.1}+ />+ </div>+ <div className="w-24">+ <LemonInput+ type="number"+ value={samplingPercent}+ onChange={(v) => onChange(Math.min(100, Number(v) || 0) / 100)}+ min={0.1}+ max={100}+ step={0.1}+ suffix={<span>%</span>}+ status={samplingPercent < 0.1 ? 'danger' : undefined}+ />+ </div>+ </div>+ </LemonCard>+ )+ }}+ </LemonField>++ <LemonField name="sampling_mode">+ {({ value, onChange }) => {+ const mode = (value ?? 'comprehensive') as SamplingMode+ const option = SAMPLING_MODE_OPTIONS.find((o) => o.value === mode)+ return (+ <LemonCard hoverEffect={false} className="p-3 space-y-3">+ <div className="space-y-1">+ <LemonLabel info="Filters which matching recordings this scanner watches, based on how much activity a recording has (interactions, errors, navigation). Narrower options skip low-activity recordings so your budget goes to recordings worth watching.">+ Session coverage+ </LemonLabel>+ </div>+ <div className="space-y-1 @container">+ <LemonSegmentedButton+ className="ScannerSessionCoverage"+ value={mode}+ onChange={onChange}+ options={SAMPLING_MODE_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}+ />+ <div className="text-xs text-muted">{option?.description}</div>+ </div>+ </LemonCard>+ )+ }}+ </LemonField>++ <ScannerCreditLimit scannerId={scannerId} />++ <ScannerQuotaForecast scannerId={scannerId} />+ </div>+ )+}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsxindex bd22c306cc0f..a45c2926291c 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx@@ -180,7 +180,7 @@ function BehaviorCardContent({ scanner }: { scanner: ReplayScanner }): JSX.Eleme)}{scanner.scanner_type === 'classifier' && (<>- <LabeledRow label="Tag vocabulary">+ <LabeledRow label="Categories">{scanner.scanner_config.tags.length ? (<div className="flex flex-wrap gap-1">{scanner.scanner_config.tags.map((tag) => (@@ -193,10 +193,10 @@ function BehaviorCardContent({ scanner }: { scanner: ReplayScanner }): JSX.Eleme<span className="text-muted">—</span>)}</LabeledRow>- <LabeledRow label="Multiple tags per session">+ <LabeledRow label="Multiple categories per session"><BooleanTag value={!!scanner.scanner_config.multi_label} /></LabeledRow>- <LabeledRow label="Freeform tags">+ <LabeledRow label="Freeform categories"><BooleanTag value={!!scanner.scanner_config.allow_freeform_tags} /></LabeledRow></>diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerGoalDraft.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerGoalDraft.tsxindex ecbc5a41267f..22f83a4ac7fa 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerGoalDraft.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerGoalDraft.tsx@@ -8,7 +8,7 @@ import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'import { replayScannerLogic } from '../replayScannerLogic'/** "Tell PostHog AI what you want to accomplish" box on the template step and the zero-scanner- * empty state: drafts a full scanner from the stated goal and drops the user into the configure+ * empty state: drafts a full scanner from the stated goal and drops the user into the details* step to review it. */export function ScannerGoalDraft({gateSubmit,@@ -40,9 +40,7 @@ export function ScannerGoalDraft({<div className="space-y-6"><div className="flex items-center gap-4"><div className="flex-1 border-t border-border" />- <span className="text-xs text-tertiary uppercase tracking-wide">- or tell PostHog AI what you want to accomplish- </span>+ <span className="text-xs text-tertiary uppercase tracking-wide">or describe what you want to find</span><div className="flex-1 border-t border-border" /></div>diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerInsightsChart.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerInsightsChart.tsxindex 675f538800bf..cbf2e1df1b9f 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerInsightsChart.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerInsightsChart.tsx@@ -140,7 +140,7 @@ function chartTitle(scannerType: ScannerType): string {return 'Yes rate (%) over time'}if (scannerType === 'classifier') {- return 'Tag mix over time'+ return 'Category mix over time'}if (scannerType === 'scorer') {return 'Score percentiles over time'diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsxindex 9e749ab1b819..c3d724fa2d5e 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx@@ -302,7 +302,8 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):)}{scannerType === 'classifier' && tagFilterOptions.length > 0 && (<FilterPill<string>- label="Tag"+ label="Category"+ searchPlaceholder="Search categories"options={tagFilterOptions}value={observationTagFilter}onChange={setObservationTagFilter}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsxindex 19377108fb9e..811f88e3c489 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx@@ -257,18 +257,18 @@ function ClassifierOverview({ scannerId }: { scannerId: string }): JSX.Element |}const freeformAllowed = !!scanner.scanner_config.allow_freeform_tagsconst fixedEmpty = hasActiveOverviewFilters- ? 'No fixed-vocabulary tags match the current filter.'- : 'No fixed-vocabulary tags emitted yet.'+ ? 'No configured categories match the current filter.'+ : 'No configured categories emitted yet.'const freeformEmpty = hasActiveOverviewFilters- ? 'No freeform tags match the current filter.'- : 'No freeform tags emitted yet.'+ ? 'No freeform categories match the current filter.'+ : 'No freeform categories emitted yet.'const cohortAction = (tag: string): JSX.Element => (<LemonButtontype="secondary"size="xsmall"icon={<IconPeople />}- tooltip={`Save users tagged "${tag}" in the last 30 days as a cohort`}+ tooltip={`Save users in category "${tag}" from the last 30 days as a cohort`}onClick={() => saveAffectedCohort(tag)}loading={affectedCohortLoading && savingCohortTag === tag}disabledReason={@@ -282,7 +282,7 @@ function ClassifierOverview({ scannerId }: { scannerId: string }): JSX.Element |return (<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">- <OverviewPanel title="Top fixed tags" subtitle="from configured vocabulary" fill>+ <OverviewPanel title="Top configured categories" subtitle="from the categories you defined" fill><RankedTermListranked={fixedRanked}loading={overviewStatsApiLoading}@@ -293,8 +293,8 @@ function ClassifierOverview({ scannerId }: { scannerId: string }): JSX.Element |</OverviewPanel><OverviewPanel- title="Top freeform tags"- subtitle={freeformAllowed ? 'outside configured vocabulary' : 'disabled'}+ title="Top freeform categories"+ subtitle={freeformAllowed ? 'outside the categories you defined' : 'disabled'}disabled={!freeformAllowed}fill>@@ -308,8 +308,9 @@ function ClassifierOverview({ scannerId }: { scannerId: string }): JSX.Element |/>) : (<div className="text-muted text-sm">- Freeform tags are disabled for this scanner, so the model can only pick from your configured- vocabulary. Enable "Allow freeform tags" in the scanner config to let it propose new ones.+ Freeform categories are disabled for this scanner, so the model can only pick from the+ categories you defined. Enable "Allow freeform categories" in the scanner config to let it+ propose new ones.</div>)}</OverviewPanel>diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerOverviewFilters.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerOverviewFilters.tsxindex 9fec6742619c..29c41d5ca063 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerOverviewFilters.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerOverviewFilters.tsx@@ -67,7 +67,8 @@ export function ScannerOverviewFilters({ scannerId }: { scannerId: string }): JS)}{scannerType === 'classifier' && tagOptions.length > 0 && (<FilterPill<string>- label="Tag"+ label="Category"+ searchPlaceholder="Search categories"options={tagOptions}value={overviewTagFilter}onChange={setOverviewTagFilter}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerTemplatePicker.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerTemplatePicker.tsxindex ecdba545cb04..0ae1c29d96ba 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerTemplatePicker.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerTemplatePicker.tsx@@ -50,7 +50,7 @@ export function TemplateCard({const templateKey = isBlank ? null : template.keyreplayScannerLogic({ id: 'new' }).actions.startFromTemplate(templateKey)const params = isBlank ? searchParams : { ...searchParams, template: template.key }- router.actions.push(combineUrl(urls.replayVisionScannerConfigure('new'), params).url)+ router.actions.push(combineUrl(urls.replayVisionScannerDetails('new'), params).url)}const handleClick = (): void => {@@ -126,7 +126,7 @@ function ResumeDraftBanner(): JSX.Element | null {const handleResume = (): void => {const { template: _template, ...params } = searchParams- router.actions.push(combineUrl(urls.replayVisionScannerConfigure('new'), params).url)+ router.actions.push(combineUrl(urls.replayVisionScannerDetails('new'), params).url)}return (@@ -177,10 +177,10 @@ export function ScannerTemplatePicker(): JSX.Element {<div className="flex flex-col gap-6"><ResumeDraftBanner /><div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">- <TemplateCard template="blank" />{defaultScannerTemplates.map((template) => (<TemplateCard key={template.key} template={template} />))}+ <TemplateCard template="blank" /></div></div>)diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsxindex 9458d64058a1..3ba7fbd9aa54 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx@@ -1,8 +1,6 @@-import './ScannerTriggers.scss'-import { useActions, useValues } from 'kea'-import { LemonBanner, LemonCard, LemonInput, LemonInputSelect, LemonSegmentedButton, LemonTag } from '@posthog/lemon-ui'+import { LemonBanner, LemonCard, LemonInputSelect, LemonTag } from '@posthog/lemon-ui'import { resolveCategoryDropdownVariant, TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { TestAccountFilterSwitch } from 'lib/components/TestAccountFiltersSwitch'@@ -14,7 +12,6 @@ import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { LemonField } from 'lib/lemon-ui/LemonField'import { LemonLabel } from 'lib/lemon-ui/LemonLabel'-import { LemonSlider } from 'lib/lemon-ui/LemonSlider'import { Link } from 'lib/lemon-ui/Link'import { Tooltip } from 'lib/lemon-ui/Tooltip'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'@@ -36,9 +33,6 @@ import { PropertyFilterType, RecordingUniversalFilters, UniversalFiltersGroup }import { clampDurationFilter, durationFilterError, MAX_ACTIVE_LABEL } from '../durationBounds'import { replayScannerLogic } from '../replayScannerLogic'-import { SAMPLING_MODE_OPTIONS, SamplingMode } from '../types'-import { ScannerCreditLimit } from './ScannerCreditLimit'-import { ScannerQuotaForecast } from './ScannerQuotaForecast'// Mirrors the recordings list taxonomy, including suggested filters so the search bar surfaces them.// Group properties are appended per-project from groupsModel (see scannerFilterTypes below).@@ -331,75 +325,6 @@ export function ScannerTriggers({ scannerId }: { scannerId: string }): JSX.Eleme)}}</LemonField>-- <LemonField name="sampling_rate">- {({ value, onChange }) => {- const ratio = typeof value === 'number' ? value : 0- const samplingPercent = Math.round(ratio * 1000) / 10- return (- <LemonCard hoverEffect={false} className="p-3 space-y-3">- <div className="space-y-1">- <LemonLabel>Sampling</LemonLabel>- <div className="text-xs text-muted">- Each observation counts against your monthly Vision quota.- </div>- </div>- <div className="flex items-center gap-4">- <div className="flex-1">- <LemonSlider- value={samplingPercent}- onChange={(v) => onChange(v / 100)}- min={0.1}- max={100}- step={0.1}- />- </div>- <div className="w-24">- <LemonInput- type="number"- value={samplingPercent}- onChange={(v) => onChange(Math.min(100, Number(v) || 0) / 100)}- min={0.1}- max={100}- step={0.1}- suffix={<span>%</span>}- status={samplingPercent < 0.1 ? 'danger' : undefined}- />- </div>- </div>- </LemonCard>- )- }}- </LemonField>-- <LemonField name="sampling_mode">- {({ value, onChange }) => {- const mode = (value ?? 'comprehensive') as SamplingMode- const option = SAMPLING_MODE_OPTIONS.find((o) => o.value === mode)- return (- <LemonCard hoverEffect={false} className="p-3 space-y-3">- <div className="space-y-1">- <LemonLabel info="Filters which matching recordings this scanner watches, based on how much activity a recording has (interactions, errors, navigation). Narrower options skip low-activity recordings so your budget goes to recordings worth watching.">- Session coverage- </LemonLabel>- </div>- <div className="space-y-1 @container">- <LemonSegmentedButton- className="ScannerSessionCoverage"- value={mode}- onChange={onChange}- options={SAMPLING_MODE_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}- />- <div className="text-xs text-muted">{option?.description}</div>- </div>- </LemonCard>- )- }}- </LemonField>-- <ScannerCreditLimit scannerId={scannerId} />-- <ScannerQuotaForecast scannerId={scannerId} /></div>)}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerTypeConfigEditor.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerTypeConfigEditor.tsxindex a4a1c398b85f..38f1380fdfbd 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerTypeConfigEditor.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerTypeConfigEditor.tsx@@ -42,8 +42,10 @@ function ScannerPromptField({caption?: string}): JSX.Element {const logic = replayScannerLogic({ id: scannerId })- const { scanner } = useValues(logic)+ const { scanner, isNew, goalDraft } = useValues(logic)const { setScannerValue } = useActions(logic)+ // The AI already wrote this prompt one step ago, so offering to write it reads as a no-op.+ const promptWasDrafted = isNew && !!goalDraftconst onDraftedPrompt = useCallback((toolOutput: { prompt?: string; error?: string }) => {@@ -64,7 +66,9 @@ function ScannerPromptField({contextDescription: scanner? { text: `${scannerTypeLabel(scanner.scanner_type)} scanner`, icon: iconForType('session_replay') }: undefined,- initialMaxPrompt: 'Help me write the prompt for this scanner',+ initialMaxPrompt: promptWasDrafted+ ? 'Help me rewrite the prompt for this scanner'+ : 'Help me write the prompt for this scanner',callback: onDraftedPrompt,})@@ -94,7 +98,7 @@ function ScannerPromptField({onClick={() => openMax()}data-attr="replay-vision-write-prompt-with-ai">- Write with PostHog AI+ {promptWasDrafted ? 'Rewrite with PostHog AI' : 'Write with PostHog AI'}</LemonButton>)}</div>@@ -124,7 +128,7 @@ function ClassifierTagSuggestions({ scannerId }: { scannerId: string }): JSX.Elereturn (<LemonCard className="space-y-2"><div className="flex items-center justify-between">- <span className="text-sm font-medium">Suggested tags</span>+ <span className="text-sm font-medium">Suggested categories</span><div className="flex items-center gap-1"><LemonButton size="xsmall" type="secondary" onClick={() => acceptAllTagSuggestions()}>Add all@@ -146,7 +150,7 @@ function ClassifierTagSuggestions({ scannerId }: { scannerId: string }): JSX.Elesize="xsmall"type="secondary"icon={<IconPlus />}- tooltip="Add to vocabulary"+ tooltip="Add to categories"onClick={() => acceptTagSuggestion(suggestion.tag)}/><div className="flex-1 min-w-0">@@ -169,11 +173,13 @@ function ClassifierTagSuggestions({ scannerId }: { scannerId: string }): JSX.Ele/** Tag-vocabulary field with an AI entry point that suggests grounded tags to add. */function ClassifierTagsField({ scannerId }: { scannerId: string }): JSX.Element {const logic = replayScannerLogic({ id: scannerId })- const { scanner, tagSuggestionsLoading } = useValues(logic)+ const { scanner, isNew, goalDraft, tagSuggestionsLoading } = useValues(logic)const { loadTagSuggestions } = useActions(logic)const config = scanner?.scanner_config as ClassifierScannerConfig | undefinedconst hasPrompt = !!config?.prompt?.trim()+ // The draft already filled these in, so the offer is more of them, not a first set.+ const categoriesWereDrafted = isNew && !!goalDraft && !!config?.tags?.lengthreturn (<div className="space-y-2">@@ -181,7 +187,7 @@ function ClassifierTagsField({ scannerId }: { scannerId: string }): JSX.Elementname="scanner_config.tags"label={<span className="flex w-full flex-wrap items-center justify-between gap-2">- Tag vocabulary+ Categories<LemonButtonsize="xsmall"type="secondary"@@ -191,7 +197,7 @@ function ClassifierTagsField({ scannerId }: { scannerId: string }): JSX.ElementonClick={() => loadTagSuggestions()}data-attr="replay-vision-suggest-tags-with-ai">- Suggest tags with PostHog AI+ {categoriesWereDrafted ? 'Suggest more categories' : 'Suggest categories with PostHog AI'}</LemonButton></span>}@@ -200,7 +206,7 @@ function ClassifierTagsField({ scannerId }: { scannerId: string }): JSX.Element<LemonInputSelectmode="multiple"allowCustomValues- placeholder="Type a tag and press enter..."+ placeholder="Type a category and press enter..."value={(value as string[]) ?? []}onChange={onChange}options={((value as string[]) ?? []).map((t) => ({ key: t, label: t }))}@@ -266,8 +272,8 @@ export function ScannerTypeConfigEditor({ scannerId }: { scannerId: string }): J<div className="space-y-4"><ScannerPromptFieldscannerId={scannerId}- placeholder="Categorize this session by what the user came to do: first-time setup, regular work, exploring features, or troubleshooting a problem. If they did several, tag the one they spent the most time on."- caption="Your prompt tells the agent how to decide which of your tags fit each session. Include anything the agent should know about your product or this flow."+ placeholder="Categorize this session by what the user came to do: first-time setup, regular work, exploring features, or troubleshooting a problem. If they did several, pick the one they spent the most time on."+ caption="Your prompt tells the agent how to decide which of your categories fit each session. Include anything the agent should know about your product or this flow."/><ClassifierTagsField scannerId={scannerId} /><LemonField name="scanner_config.multi_label">@@ -275,9 +281,9 @@ export function ScannerTypeConfigEditor({ scannerId }: { scannerId: string }): J<div className="flex items-center gap-2"><LemonSwitch checked={!!value} onChange={onChange} /><div>- <div className="text-sm font-medium">Allow multiple tags per session</div>+ <div className="text-sm font-medium">Allow multiple categories per session</div><div className="text-xs text-muted">- Otherwise the model picks exactly one tag from your vocabulary.+ Otherwise the model picks exactly one of your categories.</div></div></div>@@ -288,9 +294,9 @@ export function ScannerTypeConfigEditor({ scannerId }: { scannerId: string }): J<div className="flex items-center gap-2"><LemonSwitch checked={!!value} onChange={onChange} /><div>- <div className="text-sm font-medium">Allow freeform tags</div>+ <div className="text-sm font-medium">Allow freeform categories</div><div className="text-xs text-muted">- Lets the model emit tags outside your tag vocabulary.+ Lets the model use categories outside the ones you defined.</div></div></div>diff --git a/products/replay_vision/frontend/replay_scanners/components/configChanges.ts b/products/replay_vision/frontend/replay_scanners/components/configChanges.tsindex bb7958033259..dcfdf480f90d 100644--- a/products/replay_vision/frontend/replay_scanners/components/configChanges.ts+++ b/products/replay_vision/frontend/replay_scanners/components/configChanges.ts@@ -64,11 +64,11 @@ export interface FieldEditorMeta {// Labels mirror the scanner configuration tab so both surfaces read the same.const FIELD_EDITORS: Record<string, FieldEditorMeta> = {prompt: { kind: 'prompt', label: 'Prompt' },- tags: { kind: 'tags', label: 'Tag vocabulary' },+ tags: { kind: 'tags', label: 'Categories' },scale: { kind: 'scale', label: 'Scale' },length: { kind: 'length', label: 'Summary length' },- multi_label: { kind: 'flag', label: 'Multiple tags per session' },- allow_freeform_tags: { kind: 'flag', label: 'Freeform tags' },+ multi_label: { kind: 'flag', label: 'Multiple categories per session' },+ allow_freeform_tags: { kind: 'flag', label: 'Freeform categories' },allow_inconclusive: { kind: 'flag', label: 'Allow inconclusive verdicts' },}diff --git a/products/replay_vision/frontend/replay_scanners/components/versionChanges.test.ts b/products/replay_vision/frontend/replay_scanners/components/versionChanges.test.tsindex 826ff9e9975b..6d187b0cd937 100644--- a/products/replay_vision/frontend/replay_scanners/components/versionChanges.test.ts+++ b/products/replay_vision/frontend/replay_scanners/components/versionChanges.test.ts@@ -28,7 +28,7 @@ describe('versionChanges', () => {version({ version: 2, scannerConfig: afterConfig }))expect(changes).toEqual([- { field: 'multi_label', label: 'Multiple tags per session', kind: 'value', before, after },+ { field: 'multi_label', label: 'Multiple categories per session', kind: 'value', before, after },])})diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.tsindex 90219ab6144b..1bb30d540bc5 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts@@ -78,7 +78,7 @@ describe('replayScannerLogic', () => {it('new scanner starts as monitor with empty prompt and default sampling', () => {expect(logic.values.scanner).toMatchObject({id: 'new',- name: '',+ name: 'MockHog App + Marketing monitor',enabled: true,scanner_type: 'monitor',scanner_config: { prompt: '' },@@ -105,7 +105,7 @@ describe('replayScannerLogic', () => {it.each([['the template step', urls.replayVisionScannerTemplate('new')],['the empty scanner list', urls.replayVision()],- ])('seeds the form from the AI draft and routes to the configure step from %s', async (_origin, path) => {+ ])('seeds the form from the AI draft and routes to the details step from %s', async (_origin, path) => {const draft = {name: 'User intent',description: 'Tags each session by intent.',@@ -135,7 +135,7 @@ describe('replayScannerLogic', () => {query: draft.query,})// The test router prefixes paths with /project/:id, so match on the suffix.- expect(router.values.location.pathname).toContain(urls.replayVisionScannerConfigure('new'))+ expect(router.values.location.pathname).toContain(urls.replayVisionScannerDetails('new'))// The rationale stays available for the configure step, until a template pick replaces the draft.expect(logic.values.goalDraft?.rationale).toEqual(draft.rationale)@@ -171,7 +171,10 @@ describe('replayScannerLogic', () => {.toFinishAllListeners()expect(logic.values.goalDraft).toBeNull()- expect(logic.values.scanner).toMatchObject({ name: '', scanner_type: 'monitor' })+ expect(logic.values.scanner).toMatchObject({+ name: 'MockHog App + Marketing monitor',+ scanner_type: 'monitor',+ })expect(router.values.location.pathname).toEqual(pathBefore)})})@@ -317,19 +320,16 @@ describe('replayScannerLogic', () => {name: 'Test scanner',scanner_config: { prompt: 'Q?' },})- logic.actions.setSubmitIntent('advance')await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()expect(router.values.location.pathname).toContain('/replay-vision/new/triggers')- expect(logic.values.submitIntent).toBe('save')})it('advance does not mark the draft as saved, so the unsaved-changes guard stays armed', async () => {router.actions.push('/replay-vision/new/configure')logic.actions.setScannerValues({ name: 'Draft scanner', scanner_config: { prompt: 'Q?' } })- logic.actions.setSubmitIntent('advance')await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()// The draft must not be adopted as the saved baseline — no API write happened.- expect(logic.values.originalScanner?.name).toBe('')+ expect(logic.values.originalScanner?.name).toBe('MockHog App + Marketing monitor')expect(logic.values.hasUnsavedChanges).toBe(true)})@@ -341,11 +341,18 @@ describe('replayScannerLogic', () => {expect(router.values.location.pathname).toContain('/replay-vision/new/triggers')})+ it('keeps the ?template param when advancing, so the type stays fixed to the template', async () => {+ router.actions.push(`${urls.replayVisionScannerConfigure('new')}?template=dead_end`)+ logic.actions.setScannerValues({ name: 'Test scanner', scanner_config: { prompt: 'Q?' } })+ await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()+ expect(router.values.location.pathname).toContain('/replay-vision/new/triggers')+ expect(router.values.searchParams.template).toEqual('dead_end')+ })+it('advances from the step the editor scene reports, even when the URL matches no step', async () => {router.actions.push('/replay-vision/new/not-a-step')scannerEditorSceneLogic.actions.setStep('configure')logic.actions.setScannerValues({ name: 'Test scanner', scanner_config: { prompt: 'Q?' } })- logic.actions.setSubmitIntent('advance')await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()expect(router.values.location.pathname).toContain('/replay-vision/new/triggers')})@@ -353,7 +360,6 @@ describe('replayScannerLogic', () => {it('routes a rejected submit to the step that renders the errored fields', async () => {// Defaults leave name and prompt empty, both configure-owned.router.actions.push('/replay-vision/new/triggers')- logic.actions.setSubmitIntent('advance')await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()expect(createSpy).not.toHaveBeenCalled()expect(router.values.location.pathname).toContain('/replay-vision/new/configure')@@ -361,8 +367,8 @@ describe('replayScannerLogic', () => {it('submitting the final step creates the scanner, lands on it, and announces the first scan', async () => {const success = jest.spyOn(lemonToast, 'success')- router.actions.push('/replay-vision/new/self-driving')- scannerEditorSceneLogic.actions.setStep('self_driving')+ router.actions.push('/replay-vision/new/budget')+ scannerEditorSceneLogic.actions.setStep('budget')logic.actions.setScannerValues({ name: 'Test scanner', scanner_config: { prompt: 'Q?' } })await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()expect(createSpy).toHaveBeenCalledTimes(1)@@ -513,11 +519,6 @@ describe('replayScannerLogic', () => {describe('validation errors', () => {it.each([- {- name: 'flags missing name',- setup: () => undefined,- expectedErrors: { name: 'Name is required' },- },{name: 'flags missing prompt',setup: () => undefined,@@ -591,7 +592,7 @@ describe('replayScannerLogic', () => {})},expectedErrors: {- scanner_config: expect.objectContaining({ tags: expect.stringContaining('at least one tag') }),+ scanner_config: expect.objectContaining({ tags: expect.stringContaining('at least one category') }),},},{@@ -607,7 +608,7 @@ describe('replayScannerLogic', () => {})},expectedErrors: {- scanner_config: expect.objectContaining({ tags: 'Tags must be unique' }),+ scanner_config: expect.objectContaining({ tags: 'Categories must be unique' }),},},{@@ -623,7 +624,7 @@ describe('replayScannerLogic', () => {})},expectedErrors: {- scanner_config: expect.objectContaining({ tags: "Tags can't be blank" }),+ scanner_config: expect.objectContaining({ tags: "Categories can't be blank" }),},},])('$name', async ({ setup, expectedErrors }) => {@@ -767,6 +768,30 @@ describe('replayScannerLogic', () => {})})+ it('Enter on the details step advances rather than failing validation on unseen fields', async () => {+ // A from-scratch scanner has an empty prompt, which only the configure step can fix.+ router.actions.push(urls.replayVisionScannerDetails('new'))+ scannerEditorSceneLogic.actions.setStep('details')+ await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()+ expect(router.values.location.pathname).toContain(urls.replayVisionScannerConfigure('new'))+ })++ it('keeps the ?template param when a rejected submit jumps to the errored step', async () => {+ router.actions.push(`${urls.replayVisionScannerTriggers('new')}?template=dead_end`)+ scannerEditorSceneLogic.actions.setStep('triggers')+ logic.actions.setScannerValues({ scanner_config: { prompt: '' } })+ await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()+ expect(router.values.location.pathname).toContain(urls.replayVisionScannerConfigure('new'))+ expect(router.values.searchParams.template).toEqual('dead_end')+ })++ it('Enter on an intermediate step advances instead of saving and leaving the wizard', async () => {+ await expectLogic(editLogic, () => editLogic.actions.loadScanner()).toFinishAllListeners()+ router.actions.push(urls.replayVisionScannerDetails('limited-1'))+ await expectLogic(editLogic, () => editLogic.actions.submitScanner()).toFinishAllListeners()+ expect(router.values.location.pathname).toContain(urls.replayVisionScannerConfigure('limited-1'))+ })+it('strips the form-only toggle from the update payload', async () => {let patchedBody: anyuseMocks({@@ -778,6 +803,8 @@ describe('replayScannerLogic', () => {},})await expectLogic(editLogic, () => editLogic.actions.loadScanner()).toFinishAllListeners()+ // Only the final step persists; earlier ones advance, so save from where the button lives.+ router.actions.push(urls.replayVisionScannerBudget('sid'))editLogic.actions.setScannerValues({ credit_limit_enabled: true, credit_limit: 100 })await expectLogic(editLogic, () => editLogic.actions.submitScanner()).toDispatchActions(['scannerSaved'])expect(patchedBody.credit_limit).toBe(100)diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex d7b41525477c..68cbc391e173 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -77,6 +77,8 @@ import {firstErroredScannerStep,scannerEditorSceneLogic,scannerStepUrl,+ scannerStepUrlWithParams,+ UNVALIDATED_SCANNER_STEPS,} from './scannerEditorSceneLogic'import type { ObservationStatusStats } from './scannerStats'import { availableTagsFromStats, daysFromDateRange, deriveObservationStatusStats } from './scannerStats'@@ -84,6 +86,7 @@ import { findScannerTemplate, newScanner } from './scannerTemplates'import {MAX_CREDIT_LIMIT,ScannerConfig,+ defaultScannerName,ScannerFormValues,ScannerType,ReplayScanner,@@ -341,7 +344,6 @@ export interface replayScannerLogicValues {scannerValidationErrors: DeepPartialMap<ScannerFormValues, ValidationErrorType>showScannerErrors: booleansidePanelContext: SidePanelSceneContext | null- submitIntent: 'advance' | 'save'tagSuggestions: TagSuggestionApi[]tagSuggestionsLoading: booleantogglingEnabled: boolean@@ -602,9 +604,6 @@ export interface replayScannerLogicActions {setScannerValues: (values: DeepPartial<ScannerFormValues>) => {values: DeepPartial<ScannerFormValues>}- setSubmitIntent: (intent: 'advance' | 'save') => {- intent: 'advance' | 'save'- }startFromTemplate: (templateKey: string | null) => {templateKey: string | null}@@ -719,7 +718,6 @@ export const replayScannerLogic = kea<replayScannerLogicType>([startFromTemplate: (templateKey: string | null) => ({ templateKey }),discardScannerDraft: true,setScannerDraftSavedAt: (savedAt: number | null) => ({ savedAt }),- setSubmitIntent: (intent: 'save' | 'advance') => ({ intent }),// Fired only after an actual API write, unlike submitScannerSuccess (which the advance path emits too).scannerSaved: (scanner: ScannerFormValues) => ({ scanner }),appendClassifierTags: (tags: string[]) => ({ tags }),@@ -779,9 +777,12 @@ export const replayScannerLogic = kea<replayScannerLogicType>([copyAllObservationsFinished: true,}),- forms(({ props, values, actions }) => ({+ forms(({ props, actions }) => ({scanner: {- defaults: newScanner(props.id === 'new' ? currentTemplateKey() : null),+ defaults: newScanner(+ props.id === 'new' ? currentTemplateKey() : null,+ teamLogic.findMounted()?.values.currentTeam?.name+ ),errors: (scanner: ScannerFormValues) => {// API-loaded scanners never carry the UI-only toggle, so fall back to whether a limit is set.const creditLimitEnabled = scanner.credit_limit_enabled ?? scanner.credit_limit != null@@ -792,11 +793,11 @@ export const replayScannerLogic = kea<replayScannerLogicType>([if (scanner.scanner_type === 'classifier') {const tags = scanner.scanner_config.tags ?? []if (tags.length === 0) {- configErrors.tags = 'Add at least one tag to the vocabulary'+ configErrors.tags = 'Add at least one category'} else if (tags.some((t) => !t.trim())) {- configErrors.tags = "Tags can't be blank"+ configErrors.tags = "Categories can't be blank"} else if (new Set(tags.map((t) => t.trim().toLowerCase())).size !== tags.length) {- configErrors.tags = 'Tags must be unique'+ configErrors.tags = 'Categories must be unique'}}if (scanner.scanner_type === 'scorer') {@@ -813,7 +814,6 @@ export const replayScannerLogic = kea<replayScannerLogicType>([}}return {- name: !scanner.name?.trim() ? 'Name is required' : undefined,sampling_rate:scanner.sampling_rate > 0 && scanner.sampling_rate <= 1? undefined@@ -832,14 +832,12 @@ export const replayScannerLogic = kea<replayScannerLogicType>([}},submit: async (scanner: ScannerFormValues) => {- // Advance to the next visible step instead of persisting, when the footer asked to (intent- // 'advance') or a new scanner submitted mid-wizard via Enter on any non-final step.- const steps = scannerEditorSceneLogic.findMounted()?.values.visibleSteps ?? SCANNER_EDITOR_STEPS+ // A non-final step only ever offers "Next", so any submit there advances rather than persisting.+ // Enter would otherwise save an existing scanner and leave the wizard from the middle of it.const currentStep = scannerEditorSceneLogic.findMounted()?.values.step ?? 'configure'- const nextStep = steps[steps.indexOf(currentStep) + 1]- if (nextStep && (values.submitIntent === 'advance' || values.isNew)) {- actions.setSubmitIntent('save')- router.actions.push(scannerStepUrl(nextStep, props.id))+ const nextStep = SCANNER_EDITOR_STEPS[SCANNER_EDITOR_STEPS.indexOf(currentStep) + 1]+ if (nextStep) {+ router.actions.push(scannerStepUrlWithParams(nextStep, props.id, router.values.searchParams))return}const teamId = teamLogic.values.currentTeamId@@ -847,7 +845,13 @@ export const replayScannerLogic = kea<replayScannerLogicType>([return}// credit_limit_enabled is UI-only form state; the API payload carries only credit_limit itself.- const { credit_limit_enabled: _creditLimitEnabled, ...apiScanner } = scanner+ const { credit_limit_enabled: _creditLimitEnabled, ...rest } = scanner+ // The name is optional in the UI but required by the API, so an emptied one falls back.+ const apiScanner = {+ ...rest,+ name:+ rest.name?.trim() || defaultScannerName(teamLogic.values.currentTeam?.name, rest.scanner_type),+ }const body = apiScanner.query == null ? omitQuery(apiScanner) : apiScannertry {if (props.id === 'new') {@@ -870,6 +874,13 @@ export const replayScannerLogic = kea<replayScannerLogicType>([router.actions.push(urls.replayVision(props.id))}} catch (error: any) {+ // A duplicate name is the one field error the details step can fix, so route back to it.+ if (error.attr === 'name' && error.detail) {+ actions.setScannerManualErrors({ name: error.detail })+ router.actions.push(urls.replayVisionScannerDetails(props.id))+ lemonToast.error(error.detail)+ throw error+ }lemonToast.error(`Failed to save scanner${error.detail ? `: ${error.detail}` : ''}`)throw error}@@ -1065,13 +1076,6 @@ export const replayScannerLogic = kea<replayScannerLogicType>([loadScannerFailure: () => false,},],- submitIntent: [- 'save' as 'save' | 'advance',- {- setSubmitIntent: (_, { intent }) => intent,- loadScannerSuccess: () => 'save' as 'save' | 'advance',- },- ],tagSuggestions: {// Accepted suggestions leave the panel; the listener adds them to the vocabulary.acceptTagSuggestion: (state: TagSuggestionApi[], { tag }: { tag: string }) =>@@ -1451,10 +1455,22 @@ export const replayScannerLogic = kea<replayScannerLogicType>([if (error?.message !== 'Validation Failed') {return}- const erroredStep = firstErroredScannerStep(values.scannerValidationErrors)const currentStep = scannerEditorSceneLogic.findMounted()?.values.step+ // Enter submits the whole form, so leaving a step that validates nothing must behave like+ // its Next button: move on, rather than red-flag fields the user has not reached yet.+ if (currentStep && UNVALIDATED_SCANNER_STEPS.includes(currentStep)) {+ const next = SCANNER_EDITOR_STEPS[SCANNER_EDITOR_STEPS.indexOf(currentStep) + 1]+ if (next) {+ router.actions.push(scannerStepUrlWithParams(next, props.id, router.values.searchParams))+ }+ return+ }+ const erroredStep = firstErroredScannerStep({+ ...values.scannerValidationErrors,+ duration: values.durationValidationError,+ })if (erroredStep && erroredStep !== currentStep) {- router.actions.push(scannerStepUrl(erroredStep, props.id))+ router.actions.push(scannerStepUrlWithParams(erroredStep, props.id, router.values.searchParams))}// Yield so the step change renders before scrollToFormError looks for `.Field--error`.await Promise.resolve()@@ -1473,6 +1489,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([// strip the param so the URL matches what the user actually gets.const templateKey =!draft && urlTemplateKey && findScannerTemplate(urlTemplateKey) ? urlTemplateKey : null+ const teamName = teamLogic.findMounted()?.values.currentTeam?.nameconst experimentParams = parseExperimentScannerParams(router.values.searchParams)// Strip the params the wizard has now consumed so a reload doesn't re-run the prefill// over the user's edits: an unknown template that fell back to from-scratch (a valid@@ -1502,7 +1519,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([variantKeys: reconcileVariantKeys(experiment, experimentParams.variantKeys),useExposureFallback: experimentParams.useExposureFallback,}- const prefilled = prefillScannerForExperiment(newScanner(templateKey), context)+ const prefilled = prefillScannerForExperiment(newScanner(templateKey, teamName), context)// Set the context only after the prefill is built, so a throw inside it// doesn't leave a dangling context that the next startFromTemplate re-applies.actions.setExperimentContext(context)@@ -1511,7 +1528,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([// Clear any context a partial run left set before surfacing the failure.actions.setExperimentContext(null)lemonToast.error("Couldn't load the experiment. Set recording filters manually instead.")- actions.loadScannerSuccess(newScanner(templateKey))+ actions.loadScannerSuccess(newScanner(templateKey, teamName))} finally {cache.restoringDraft = false}@@ -1519,7 +1536,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([}cache.restoringDraft = truetry {- actions.loadScannerSuccess(newScanner(templateKey))+ actions.loadScannerSuccess(newScanner(templateKey, teamName))if (draft) {actions.setScannerValues(draft.scanner)actions.setScannerDraftSavedAt(draft.savedAt)@@ -1576,8 +1593,13 @@ export const replayScannerLogic = kea<replayScannerLogicType>([if (!current) {return}+ const teamName = teamLogic.values.currentTeam?.name+ // Only re-derive a name the user never edited, so a typed name always survives a type change.+ const keepsDefaultName =+ !current.name?.trim() || current.name === defaultScannerName(teamName, current.scanner_type)actions.resetScanner({...current,+ name: keepsDefaultName ? defaultScannerName(teamName, scannerType) : current.name,scanner_type: scannerType,scanner_config: defaultConfigForType(scannerType),} as ScannerFormValues)@@ -1599,7 +1621,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([) {return}- actions.resetScanner(newScanner())+ actions.resetScanner(newScanner(null, teamLogic.values.currentTeam?.name))// Applied as form values (not baked into the reset) so the draft persists like hand-edited// input and survives a reload of the configure step.actions.setScannerValues({@@ -1611,7 +1633,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([// shows it for review like any hand-picked filter....(goalDraft.query ? { query: goalDraft.query as RecordingsQuery } : {}),})- router.actions.push(urls.replayVisionScannerConfigure('new'))+ router.actions.push(urls.replayVisionScannerDetails('new'))},draftScannerFromGoalFailure: ({ errorObject }) => {@@ -1661,7 +1683,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([actions.setScannerDraftSavedAt(null)// An experiment prefill (targeted query, scoped name) has to survive the template// reset, so re-apply it when the wizard was entered from an experiment.- const base = newScanner(templateKey)+ const base = newScanner(templateKey, teamLogic.values.currentTeam?.name)const context = values.experimentContextactions.resetScanner(context ? prefillScannerForExperiment(base, context) : base)},@@ -2051,7 +2073,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([lemonToast.info('Draft saved', {button: {label: 'Resume',- action: () => router.actions.push(urls.replayVisionScannerConfigure('new')),+ action: () => router.actions.push(urls.replayVisionScannerDetails('new')),dataAttr: 'vision-draft-resume-toast',},})@@ -2080,9 +2102,8 @@ export type ObservationsUrlParams = Partial<Record<(typeof TABLE_URL_PARAM_KEYS)/** The step URLs of a scanner's editor wizard. */function scannerEditorPaths(scannerId: string): string[] {return [- urls.replayVisionScannerTemplate(scannerId),- urls.replayVisionScannerConfigure(scannerId),- urls.replayVisionScannerTriggers(scannerId),+ ...SCANNER_EDITOR_STEPS.map((step) => scannerStepUrl(step, scannerId)),+ // Retired step: the redirect off it must not trip the unsaved-changes guard.urls.replayVisionScannerSelfDriving(scannerId),]}diff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.tsindex 9120c5d5901d..e3d1c4ac9a69 100644--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.test.ts@@ -9,10 +9,9 @@ import { firstErroredScannerStep, scannerEditorSceneLogic } from './scannerEditodescribe('firstErroredScannerStep', () => {it.each([- ['name error lands on configure', { name: 'Required' }, 'configure'],['config error lands on configure', { scanner_config: { prompt: 'Required' } }, 'configure'],- ['sampling error lands on triggers', { sampling_rate: 'Out of range' }, 'triggers'],- ['credit limit error lands on triggers', { credit_limit: 'Enter a credit amount' }, 'triggers'],+ ['sampling error lands on budget', { sampling_rate: 'Out of range' }, 'budget'],+ ['credit limit error lands on budget', { credit_limit: 'Enter a credit amount' }, 'budget'],['no errors maps nowhere', {}, null],])('%s', (_label, errors, expected) => {expect(firstErroredScannerStep(errors)).toBe(expected)@@ -60,30 +59,14 @@ describe('scannerEditorSceneLogic', () => {})})- it('redirects /:id/template → /:id/configure for existing scanners', async () => {+ it('redirects /:id/template → /:id/details for existing scanners', async () => {router.actions.push(urls.replayVisionScannerTemplate('abc-123'))await expectLogic(logic).toMatchValues({scannerId: 'abc-123',- step: 'configure',+ step: 'details',isNew: false,})- expect(router.values.location.pathname.endsWith(urls.replayVisionScannerConfigure('abc-123'))).toBe(true)- })- })-- describe('visibleSteps', () => {- it('shows all four steps for a new scanner', async () => {- router.actions.push(urls.replayVisionScannerConfigure('new'))- await expectLogic(logic).toMatchValues({- visibleSteps: ['template', 'configure', 'triggers', 'self_driving'],- })- })-- it('hides only the template step for an existing scanner', async () => {- router.actions.push(urls.replayVisionScannerConfigure('abc-123'))- await expectLogic(logic).toMatchValues({- visibleSteps: ['configure', 'triggers', 'self_driving'],- })+ expect(router.values.location.pathname.endsWith(urls.replayVisionScannerDetails('abc-123'))).toBe(true)})})diff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.tsindex 38c204fe62c2..604af2c87f67 100644--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts@@ -1,46 +1,78 @@import { MakeLogicType, actions, afterMount, connect, kea, path, reducers, selectors } from 'kea'-import { router, urlToAction } from 'kea-router'+import { combineUrl, router, urlToAction } from 'kea-router'import { urls } from 'scenes/urls'import { tagsModel } from '~/models/tagsModel'import { Breadcrumb } from '~/types'-export type ScannerEditorStep = 'template' | 'configure' | 'triggers' | 'self_driving'-export const SCANNER_EDITOR_STEPS: readonly ScannerEditorStep[] = ['template', 'configure', 'triggers', 'self_driving']+export type ScannerEditorStep = 'template' | 'details' | 'configure' | 'triggers' | 'budget'+export const SCANNER_EDITOR_STEPS: readonly ScannerEditorStep[] = [+ 'template',+ 'details',+ 'configure',+ 'triggers',+ 'budget',+]export const SCANNER_EDITOR_STEP_ORDER: Record<ScannerEditorStep, number> = {template: 0,- configure: 1,- triggers: 2,- self_driving: 3,+ details: 1,+ configure: 2,+ triggers: 3,+ budget: 4,}-/** Earliest step rendering an errored form field; must match which step component mounts which fields. */-export function firstErroredScannerStep(errors: {- name?: unknown+export interface ScannerFieldErrors {scanner_config?: unknownsampling_rate?: unknowncredit_limit?: unknown-}): ScannerEditorStep | null {- if (errors.name || errors.scanner_config) {- return 'configure'- }- if (errors.sampling_rate || errors.credit_limit) {- return 'triggers'+ duration?: unknown+}++/** Steps that mount no validated field, so leaving them must not run whole-form validation. */+export const UNVALIDATED_SCANNER_STEPS: readonly ScannerEditorStep[] = ['template', 'details']++/** Which step mounts each validated field. The stepper badges and the post-submit jump both read this. */+export function scannerStepErrors(errors: ScannerFieldErrors): Record<ScannerEditorStep, boolean> {+ return {+ template: false,+ details: false,+ configure: !!errors.scanner_config,+ triggers: !!errors.duration,+ budget: !!(errors.sampling_rate || errors.credit_limit),}- return null+}++/** Earliest step rendering an errored field, so a failed submit lands where the user can fix it. */+export function firstErroredScannerStep(errors: ScannerFieldErrors): ScannerEditorStep | null {+ const stepErrors = scannerStepErrors(errors)+ return SCANNER_EDITOR_STEPS.find((step) => stepErrors[step]) ?? null+}++/**+ * Step URL carrying the current query string. ?template drives the type selector and the reload+ * prefill, so every hop between steps has to preserve it, backwards as well as forwards.+ */+export function scannerStepUrlWithParams(+ step: ScannerEditorStep,+ scannerId: string,+ searchParams: Record<string, any>+): string {+ return combineUrl(scannerStepUrl(step, scannerId), searchParams).url}export function scannerStepUrl(step: ScannerEditorStep, scannerId: string): string {switch (step) {case 'template':return urls.replayVisionScannerTemplate(scannerId)+ case 'details':+ return urls.replayVisionScannerDetails(scannerId)case 'configure':return urls.replayVisionScannerConfigure(scannerId)case 'triggers':return urls.replayVisionScannerTriggers(scannerId)- case 'self_driving':- return urls.replayVisionScannerSelfDriving(scannerId)+ case 'budget':+ return urls.replayVisionScannerBudget(scannerId)}}@@ -50,7 +82,6 @@ export interface scannerEditorSceneLogicValues {isNew: booleanscannerId: stringstep: ScannerEditorStep- visibleSteps: readonly ScannerEditorStep[]}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -68,7 +99,6 @@ export interface scannerEditorSceneLogicActions {export interface scannerEditorSceneLogicMeta {__keaTypeGenInternalSelectorTypes: {isNew: (scannerId: string) => boolean- visibleSteps: (isNew: boolean) => readonly ScannerEditorStep[]breadcrumbs: (scannerId: string, isNew: boolean) => Breadcrumb[]}}@@ -109,12 +139,6 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([selectors({isNew: [(s) => [s.scannerId], (scannerId: string): boolean => scannerId === 'new'],- visibleSteps: [- (s) => [s.isNew],- (isNew: boolean): readonly ScannerEditorStep[] =>- // The template picker only exists for a new scanner; every other step, self-driving included, always shows.- SCANNER_EDITOR_STEPS.filter((step) => isNew || step !== 'template'),- ],breadcrumbs: [(s) => [s.scannerId, s.isNew],(scannerId: string, isNew: boolean): Breadcrumb[] => {@@ -153,7 +177,7 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([[urls.replayVisionScannerTemplate(':id')]: ({ id }) => {const scannerId = id || 'new'if (scannerId !== 'new') {- router.actions.replace(urls.replayVisionScannerConfigure(scannerId))+ router.actions.replace(urls.replayVisionScannerDetails(scannerId))return}if (scannerId !== values.scannerId) {@@ -163,6 +187,15 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([actions.setStep('template')}},+ [urls.replayVisionScannerDetails(':id')]: ({ id }) => {+ const scannerId = id || 'new'+ if (scannerId !== values.scannerId) {+ actions.setScannerId(scannerId)+ }+ if (values.step !== 'details') {+ actions.setStep('details')+ }+ },[urls.replayVisionScannerConfigure(':id')]: ({ id }) => {const scannerId = id || 'new'if (scannerId !== values.scannerId) {@@ -181,15 +214,19 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([actions.setStep('triggers')}},- [urls.replayVisionScannerSelfDriving(':id')]: ({ id }) => {+ [urls.replayVisionScannerBudget(':id')]: ({ id }) => {const scannerId = id || 'new'if (scannerId !== values.scannerId) {actions.setScannerId(scannerId)}- if (values.step !== 'self_driving') {- actions.setStep('self_driving')+ if (values.step !== 'budget') {+ actions.setStep('budget')}},+ // The self-driving toggle moved onto the configure step; old links still resolve.+ [urls.replayVisionScannerSelfDriving(':id')]: ({ id }) => {+ router.actions.replace(urls.replayVisionScannerConfigure(id || 'new'))+ },})),afterMount(({ actions }) => {diff --git a/products/replay_vision/frontend/replay_scanners/scannerTemplates.test.ts b/products/replay_vision/frontend/replay_scanners/scannerTemplates.test.tsindex 7ea6d3ade396..bf40c49e821b 100644--- a/products/replay_vision/frontend/replay_scanners/scannerTemplates.test.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerTemplates.test.ts@@ -24,7 +24,7 @@ describe('newScanner', () => {expect(newScanner(input)).toMatchObject({scanner_type: 'monitor',scanner_config: { prompt: '' },- name: '',+ name: 'New monitor',})})diff --git a/products/replay_vision/frontend/replay_scanners/scannerTemplates.ts b/products/replay_vision/frontend/replay_scanners/scannerTemplates.tsindex ff5bb1bf2691..aeada8b8a512 100644--- a/products/replay_vision/frontend/replay_scanners/scannerTemplates.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerTemplates.ts@@ -9,7 +9,7 @@ import type {ScorerScannerConfig,SummarizerScannerConfig,} from './types'-import { DEFAULT_MODEL, DEFAULT_PROVIDER, OBSERVATION_CREDITS_BY_MODEL } from './types'+import { DEFAULT_MODEL, DEFAULT_PROVIDER, OBSERVATION_CREDITS_BY_MODEL, defaultScannerName } from './types'export type ScannerTemplateIcon = 'warning' | 'notebook' | 'target' | 'thumbs-down' | 'check'@@ -77,9 +77,9 @@ export const defaultScannerTemplates: readonly ScannerTemplate[] = [icon: 'target',scanner_type: 'classifier',scanner_name: 'User intent',- scanner_description: 'Tag each session with the likely intent behind it.',+ scanner_description: 'Categorize each session by the likely intent behind it.',scanner_config: {- prompt: 'Classify what the user appeared to be trying to accomplish in this session, based on their primary actions. Pick from the configured tag vocabulary.',+ prompt: 'Classify what the user appeared to be trying to accomplish in this session, based on their primary actions. Pick from the configured categories.',tags: ['browsing', 'purchasing', 'researching', 'support', 'account_management', 'returning_task'],multi_label: false,},@@ -100,13 +100,13 @@ export const defaultScannerTemplates: readonly ScannerTemplate[] = [{key: 'session_outcome',name: 'Session outcome',- description: 'Tag each session with what actually happened: task completed, abandoned, errored, etc.',+ description: 'Categorize each session by what actually happened: task completed, abandoned, errored, etc.',icon: 'check',scanner_type: 'classifier',scanner_name: 'Session outcome',scanner_description: 'Classify the outcome of each session.',scanner_config: {- prompt: 'Classify what happened in this session. Did the user complete what they were trying to do, abandon partway through, hit an error that blocked them, or just browse without a clear task? Pick from the configured tag vocabulary.',+ prompt: 'Classify what happened in this session. Did the user complete what they were trying to do, abandon partway through, hit an error that blocked them, or just browse without a clear task? Pick from the configured categories.',tags: ['task_completed', 'task_abandoned', 'blocked_by_error', 'browsing_only', 'inconclusive'],multi_label: false,},@@ -120,7 +120,7 @@ export function findScannerTemplate(key: string | undefined): ScannerTemplate |return defaultScannerTemplates.find((t) => t.key === key)}-export function newScanner(templateKey?: string | null): ScannerFormValues {+export function newScanner(templateKey?: string | null, teamName?: string | null): ScannerFormValues {const base = {id: 'new',enabled: true,@@ -167,7 +167,8 @@ export function newScanner(templateKey?: string | null): ScannerFormValues {}return {...base,- name: '',+ // Every details field is optional, so an unnamed scanner starts from a name that already reads sensibly.+ name: defaultScannerName(teamName, 'monitor'),description: '',scanner_type: 'monitor',scanner_config: { prompt: '' },diff --git a/products/replay_vision/frontend/replay_scanners/types.ts b/products/replay_vision/frontend/replay_scanners/types.tsindex 0ef7d6b64c76..04df323e5e5b 100644--- a/products/replay_vision/frontend/replay_scanners/types.ts+++ b/products/replay_vision/frontend/replay_scanners/types.ts@@ -296,6 +296,12 @@ export function modelName(model: string | null | undefined, namingVariant: Modelreturn names[model as ScannerModelEnumApi] ?? model}+/** Fallback name for a scanner the user never named, e.g. "Hedgebox classifier". */+export function defaultScannerName(teamName: string | null | undefined, scannerType: ScannerType): string {+ const type = scannerTypeLabel(scannerType).toLowerCase()+ return teamName ? `${teamName} ${type}` : `New ${type}`+}+export function scannerTypeLabel(scannerType: ScannerType | null | undefined): string {if (!scannerType) {return '—'@@ -307,7 +313,7 @@ export function scannerTypeLabel(scannerType: ScannerType | null | undefined): s// know the type names. Kept short so it reads as a chip subtitle / tooltip.const SCANNER_TYPE_OUTPUT_HINT: Record<ScannerType, string> = {monitor: 'yes or no',- classifier: 'a tag from a set you define',+ classifier: 'a category from a set you define',scorer: 'a number score',summarizer: 'a text summary',}@@ -338,7 +344,7 @@ export const SCANNER_TYPE_OPTIONS: { value: ScannerType; label: string; descript{value: 'classifier',label: 'Classifier',- description: 'Tags the session with one or more categories from a fixed vocabulary.',+ description: 'Sorts the session into one or more categories you define.',},{value: 'scorer',diff --git a/products/replay_vision/manifest.tsx b/products/replay_vision/manifest.tsxindex 132c5ef79cd1..53a2ae5dee52 100644--- a/products/replay_vision/manifest.tsx+++ b/products/replay_vision/manifest.tsx@@ -67,8 +67,10 @@ export const manifest: ProductManifest = {'/replay-vision/actions/:actionId': ['ReplayVisionAction', 'replayVisionAction'],'/replay-vision/:scannerId/actions/new': ['ReplayVisionActionEditor', 'replayVisionActionNew'],'/replay-vision/:id/template': ['ReplayVisionScannerEditor', 'replayVisionScannerTemplate'],+ '/replay-vision/:id/details': ['ReplayVisionScannerEditor', 'replayVisionScannerDetails'],'/replay-vision/:id/configure': ['ReplayVisionScannerEditor', 'replayVisionScannerConfigure'],'/replay-vision/:id/triggers': ['ReplayVisionScannerEditor', 'replayVisionScannerTriggers'],+ '/replay-vision/:id/budget': ['ReplayVisionScannerEditor', 'replayVisionScannerBudget'],'/replay-vision/:id/self-driving': ['ReplayVisionScannerEditor', 'replayVisionScannerSelfDriving'],'/replay-vision/:id': ['ReplayVisionScanner', 'replayVision'],},@@ -81,8 +83,10 @@ export const manifest: ProductManifest = {(id?: string): string => (id ? `/replay-vision/${id}` : '/replay-vision'),replayVisionTemplates: (): string => '/replay-vision/new/template',replayVisionScannerTemplate: (id: string): string => `/replay-vision/${id}/template`,+ replayVisionScannerDetails: (id: string): string => `/replay-vision/${id}/details`,replayVisionScannerConfigure: (id: string): string => `/replay-vision/${id}/configure`,replayVisionScannerTriggers: (id: string): string => `/replay-vision/${id}/triggers`,+ replayVisionScannerBudget: (id: string): string => `/replay-vision/${id}/budget`,replayVisionScannerSelfDriving: (id: string): string => `/replay-vision/${id}/self-driving`,replayVisionObservation: (observationId: string): string => `/replay-vision/observations/${observationId}`,replayVisionAction: (actionId: string): string => `/replay-vision/actions/${actionId}`,diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex ebf868092c23..45e4e5ab5011 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -50151,7 +50151,7 @@ export namespace Schemas {*/description?: string;/**- * Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas.+ * Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas.* @maxItems 32* @items.maxLength 255*/@@ -59406,7 +59406,7 @@ export namespace Schemas {*/description?: string;/**- * Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas.+ * Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas.* @maxItems 32* @items.maxLength 255*/@@ -75524,7 +75524,7 @@ export namespace Schemas {*/prompt: string;/**- * The current tag vocabulary, so suggestions never duplicate a tag the user already has.+ * The categories already configured, so suggestions never duplicate one the user has.* @maxItems 200* @items.maxLength 200*/diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.tsindex cb87385744dc..68b6864e7535 100644--- a/services/mcp/src/generated/replay_vision/api.ts+++ b/services/mcp/src/generated/replay_vision/api.ts@@ -703,7 +703,7 @@ export const VisionScannersCreateBody = /* @__PURE__ */ zod.max(visionScannersCreateBodyTagsMax).optional().describe(- "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas."+ "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas."),scanner_type: zod.enum(['monitor', 'classifier', 'scorer', 'summarizer'])@@ -856,7 +856,7 @@ export const VisionScannersPartialUpdateBody = /* @__PURE__ */ zod.max(visionScannersPartialUpdateBodyTagsMax).optional().describe(- "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas."+ "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas."),scanner_type: zod.enum(['monitor', 'classifier', 'scorer', 'summarizer'])diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-create.jsonindex 6e584d1e3cd7..7e264ddce3d1 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-create.json@@ -102,7 +102,7 @@"type": "string"},"tags": {- "description": "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas.",+ "description": "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas.","items": {"maxLength": 255,"type": "string"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-update.jsonindex 6f30a585dfa9..1e2dc9d4e560 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-update.json@@ -105,7 +105,7 @@"type": "string"},"tags": {- "description": "Organizational tags for this scanner. Distinct from a classifier's tag vocabulary in scanner_config. Tags cannot contain commas.",+ "description": "Organizational tags for this scanner. Distinct from a classifier's categories in scanner_config. Tags cannot contain commas.","items": {"maxLength": 255,"type": "string"