Skip to content

: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.

feat(replay-vision): tier-name experiment for scanner model picker (#79866)

coryslater9fdfe78583ec
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 987ce5e9148f..01ca0c6e0da9 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7002,6 +7002,10 @@ snapshots:
hash: v1.k794b7964.743d310929077c6f9536dfc962dce2f27df811003c65cc516fd17d8f0b5eeecd.aW0-0vZESyFTHDpkkwh-h9qMuBPV_vSckCJPimIcCw0
scenes-app-replay-vision--scanner-configuration--light:
hash: v1.k794b7964.1206162998fff84813f6229193f0b899b1dd6070278daacf44aecc05221a93e7.ojPoX16jVxawSkCy296WSxvBu8RtOPQBH5RcaNX13hw
+ scenes-app-replay-vision--scanner-configuration-tier-names--dark:
+ hash: v1.k794b7964.b8ac97b2eeb1809548ba38f22f3b9bcf959e05dae7c7b6ab25f0a2a9b8897cbd.zWWTm0YR8k5zyzy1jofPE4GEJrgjqxzirG5jV1PZS1I
+ scenes-app-replay-vision--scanner-configuration-tier-names--light:
+ hash: v1.k794b7964.3a61073bc17d4ebaa1699dfa71674909d94af7571d5114bd1056c053e617d4d4.OhgwYxXR--cEguOyHANN5bfVvM1zQWMH3h1ZMNkiJGA
scenes-app-replay-vision--scanner-digests--dark:
hash: v1.k794b7964.cfb6e46fefd93430d17c650dfceeb62bc813855dd034c2a815db8559686dbeab.4iB6ZrgxCuEO7AoLgZCuqcAMX6eqMa42Fn3j6N6n5Xg
scenes-app-replay-vision--scanner-digests--light:
@@ -7010,6 +7014,10 @@ snapshots:
hash: v1.k794b7964.329c7556ad85d746580d8662dad3a6a0c125926a21aa0cd1cd857ef60559b57c.gRO-AooWlKqPdgRt2ESC64X8njkXNgN3AHc-tz0QIqQ
scenes-app-replay-vision--scanner-editor-configure--light:
hash: v1.k794b7964.a5a08cc989e7c33b8e809d85faf68e5944f8e419d4b56fc200b8758005237933.xcQ7tgZqUe4NJeN-RmXX2rGfxbTvVkILJjka4SL1nzs
+ scenes-app-replay-vision--scanner-editor-configure-tier-names--dark:
+ hash: v1.k794b7964.54a591d5a9c4e7ee136a0ae16f3aba2854890630c1b99fabfd73fe809ea116f3.u6BUDK3AL8hBaHZ__KDmQYLLhvGEuP6qjoW3xKrKCGI
+ scenes-app-replay-vision--scanner-editor-configure-tier-names--light:
+ hash: v1.k794b7964.ce4949dd405f5c3f649603d9ef8c456fdbdb54bba316315da99de61381ed2adb.JE7suDQnoBdS-7uamAnvAQ49DzNNiyKXg8gh2HkeSOw
scenes-app-replay-vision--scanner-editor-triggers--dark:
hash: v1.k794b7964.f3ba8840b00d2ad1cadba6bcc7e3394d5327327e2659676525564444c3502b5c.Cbr24do3OGZCDLPDZvcP8QXJnytpytSi4I8WB8cdz5s
scenes-app-replay-vision--scanner-editor-triggers--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 07292c11e8cc..7de64c0cf753 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -473,6 +473,7 @@ export const FEATURE_FLAGS = {
REPLAY_VIDEO_BASED_SUMMARIZATION: 'replay-video-based-summarization', // owner: #team-replay
REPLAY_VISION: 'replay-vision', // owner: #team-replay
REPLAY_VISION_ACTIONS: 'replay-vision-actions', // owner: #team-replay
+ REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT: 'replay-vision-model-tier-naming-experiment', // owner: #team-replay multivariate=control,test
REVAMPED_PY_NOTEBOOKS: 'revamped-py-notebooks', // owner: #team-data-tools
REVENUE_FIELDS_IN_POWER_USERS_TABLE: 'revenue-fields-in-power-users-table', // owner: @arthurdedeus #team-customer-analytics
REVIEW_HOG: 'review-hog', // owner: #team-devex, gates the Code review menu entry
diff --git a/products/replay_vision/backend/api/scanners.py b/products/replay_vision/backend/api/scanners.py
index 236c0809121d..308bdab9414a 100644
--- a/products/replay_vision/backend/api/scanners.py
+++ b/products/replay_vision/backend/api/scanners.py
@@ -123,6 +123,8 @@ def _scanner_lifecycle_properties(scanner: ReplayScanner) -> dict[str, Any]:
"scanner_id": str(scanner.id),
"scanner_type": scanner.scanner_type,
"model": scanner.model,
+ # The model's price, so experiments on the model picker can compare spend without joining a price table.
+ "credits_per_observation": observation_credits_for_model(scanner.model),
"sampling_rate": scanner.sampling_rate,
"sampling_mode": scanner.sampling_mode,
"enabled": scanner.enabled,
diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.py
index 2a8ac34b4e62..54d57659fc75 100644
--- a/products/replay_vision/backend/tests/test_api.py
+++ b/products/replay_vision/backend/tests/test_api.py
@@ -812,6 +812,8 @@ class TestScannerLifecycleTelemetry(_VisionAPITestCase):
self.assertEqual(len(created), 1)
properties = created[0].kwargs["properties"]
self.assertEqual(properties["scanner_type"], ScannerType.MONITOR)
+ self.assertEqual(properties["model"], ScannerModel.GEMINI_3_6_FLASH)
+ self.assertEqual(properties["credits_per_observation"], 15)
self.assertEqual(properties["sampling_rate"], 0.25)
self.assertTrue(properties["has_filters"])
self.assertTrue(properties["enabled"])
diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsx
index fc6d69803ad1..d26b113cce1c 100644
--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx
+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx
@@ -20,6 +20,7 @@ import { NotFound } from 'lib/components/NotFound'
import { TZLabel } from 'lib/components/TZLabel'
import { FEATURE_FLAGS } from 'lib/constants'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
@@ -115,6 +116,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
const { searchParams } = useValues(router)
const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)
const { featureFlagsTimedOut } = useValues(appLogic)
+ const showTierNames = useFeatureFlag('REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT', 'test')
const [recordingExpanded, setRecordingExpanded] = useState(false)
const [pendingSeek, setPendingSeek] = useState<{ ms: number; trigger: number } | null>(null)
@@ -543,7 +545,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
<div className="flex flex-col gap-3 text-sm">
{snapshot?.model && (
<LabeledRow label="Model">
- <span>{modelLabel(snapshot.model)}</span>
+ <span>{modelLabel(snapshot.model, showTierNames)}</span>
</LabeledRow>
)}
{summarizerLength && (
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
index 80fe3f209b2f..1c504fedb541 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
@@ -508,6 +508,18 @@ export const ScannerConfiguration: StoryObj = {
parameters: { pageUrl: `${urls.replayVision(summarizerScanner.id)}?tab=configuration` },
}
+// Test arm of the model tier-naming experiment: models labeled Basic/Pro/Ultra instead of provider
+// names. A per-story featureFlags replaces the meta's, so REPLAY_VISION must be re-listed.
+export const ScannerConfigurationTierNames: StoryObj = {
+ parameters: {
+ pageUrl: `${urls.replayVision(summarizerScanner.id)}?tab=configuration`,
+ featureFlags: {
+ [FEATURE_FLAGS.REPLAY_VISION]: true,
+ [FEATURE_FLAGS.REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT]: 'test',
+ },
+ },
+}
+
// Renders the pending recommendation's diff and change cards plus the rating list.
export const ScannerCalibration: StoryObj = {
parameters: { pageUrl: `${urls.replayVision(summarizerScanner.id)}?tab=calibration` },
@@ -528,6 +540,16 @@ export const ScannerEditorConfigure: StoryObj = {
parameters: { pageUrl: urls.replayVisionScannerConfigure(summarizerScanner.id) },
}
+export const ScannerEditorConfigureTierNames: StoryObj = {
+ parameters: {
+ pageUrl: urls.replayVisionScannerConfigure(summarizerScanner.id),
+ featureFlags: {
+ [FEATURE_FLAGS.REPLAY_VISION]: true,
+ [FEATURE_FLAGS.REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT]: 'test',
+ },
+ },
+}
+
export const ScannerEditorTriggers: StoryObj = {
parameters: { pageUrl: urls.replayVisionScannerTriggers(summarizerScanner.id) },
}
diff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx
index 5c7454b8d611..7e06fd817de5 100644
--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx
@@ -20,6 +20,7 @@ import {
import { pngHoggie } from 'lib/brand/hoggies'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -45,7 +46,7 @@ import {
scannerStepUrl,
} from './scannerEditorSceneLogic'
import { ScannerEditorStepper, STEP_LABELS } from './ScannerEditorStepper'
-import { MODEL_OPTIONS, SCANNER_TYPE_OPTIONS } from './types'
+import { SCANNER_TYPE_OPTIONS, getModelOptions } from './types'
const HedgehogConstruction2 = pngHoggie(construction2Png)
const HedgehogImTheDriver = pngHoggie(imTheDriverPng)
@@ -223,6 +224,7 @@ function ConfigureStep(): JSX.Element {
const { scanner, isNew } = useValues(replayScannerLogic({ id: scannerId }))
const { setScannerType } = useActions(replayScannerLogic({ id: scannerId }))
const { searchParams } = useValues(router)
+ const showTierNames = useFeatureFlag('REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT', 'test')
const isTypeSelectable = isNew && !searchParams.template
if (!scanner) {
@@ -301,10 +303,16 @@ function ConfigureStep(): JSX.Element {
<div className="flex flex-col gap-1 items-start">
<LemonField name="model" label="Model" className="items-start">
- <LemonSelect className="max-w-full" value={scanner.model} options={MODEL_OPTIONS} />
+ <LemonSelect
+ className="max-w-full"
+ value={scanner.model}
+ options={getModelOptions(showTierNames)}
+ />
</LemonField>
<div className="text-xs text-muted">
- Newer models tend to produce higher-quality observations, but cost more per observation.
+ {showTierNames
+ ? 'Higher tiers tend to produce higher-quality observations, but cost more per observation.'
+ : 'Newer models tend to produce higher-quality observations, but cost more per observation.'}
</div>
</div>
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx
index 23060ce64e2a..9fe125b14e02 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerConfigReadonly.tsx
@@ -17,6 +17,7 @@ import { TZLabel } from 'lib/components/TZLabel'
import { UniversalFilterButton } from 'lib/components/UniversalFilters/UniversalFilterButton'
import { isEntityFilter } from 'lib/components/UniversalFilters/utils'
import { dayjs } from 'lib/dayjs'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'
import { humanFriendlyDurationFilter } from 'scenes/session-recordings/filters/DurationFilter'
import {
@@ -37,7 +38,7 @@ import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'
import { formatCreditsMaybeUsd } from '../../utils/credits'
import { promptUnchangedSince } from '../../utils/labelStats'
import { replayScannerLogic } from '../replayScannerLogic'
-import { MODEL_OPTIONS, ReplayScanner, SAMPLING_MODE_OPTIONS, ScannerType } from '../types'
+import { ReplayScanner, SAMPLING_MODE_OPTIONS, ScannerType, getModelOptions } from '../types'
const SUMMARY_LENGTHS = [
{ value: 'short', label: 'Short' },
@@ -267,6 +268,7 @@ export function ScannerConfigReadonly({ scanner }: { scanner: ReplayScanner }):
const { observationStats, togglingEnabled } = useValues(replayScannerLogic({ id: scanner.id }))
const { showUsd } = useValues(visionQuotaLogic)
const { toggleEnabled } = useActions(replayScannerLogic({ id: scanner.id }))
+ const showTierNames = useFeatureFlag('REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT', 'test')
const samplingPercent = Math.round((scanner.sampling_rate ?? 0) * 1000) / 10
// Read every filter dimension (events, actions, properties, console logs, …), not just top-level properties.
const universal = recordingsQueryToUniversalFilters((scanner.query ?? null) as RecordingsQuery | null)
@@ -295,7 +297,7 @@ export function ScannerConfigReadonly({ scanner }: { scanner: ReplayScanner }):
<Multiline value={scanner.description} />
</LabeledRow>
<LabeledRow label="Model">
- <OptionTags options={MODEL_OPTIONS} selected={scanner.model} />
+ <OptionTags options={getModelOptions(showTierNames)} selected={scanner.model} />
</LabeledRow>
<LabeledRow label="Status">
<div className="flex items-center gap-2">
diff --git a/products/replay_vision/frontend/replay_scanners/components/VisionUsageTab.tsx b/products/replay_vision/frontend/replay_scanners/components/VisionUsageTab.tsx
index 00567ccae980..e6ac35531da3 100644
--- a/products/replay_vision/frontend/replay_scanners/components/VisionUsageTab.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/VisionUsageTab.tsx
@@ -3,6 +3,7 @@ import { useMemo } from 'react'
import { LemonSegmentedButton, LemonTable, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonProgress } from 'lib/lemon-ui/LemonProgress'
import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'
import { urls } from 'scenes/urls'
@@ -62,6 +63,7 @@ export function VisionUsageTab(): JSX.Element {
billedLimitCredits,
showStartupCap,
} = useValues(visionQuotaLogic)
+ const showTierNames = useFeatureFlag('REPLAY_VISION_MODEL_TIER_NAMING_EXPERIMENT', 'test')
const projection = projectQuota(quota)
const hasCap = hasCreditLimit(quota)
@@ -152,7 +154,7 @@ export function VisionUsageTab(): JSX.Element {
<span className="tabular-nums">
{scanner.credits_per_observation} credit{scanner.credits_per_observation === 1 ? '' : 's'}
</span>
- <span className="text-muted"> · {modelName(scanner.model)}</span>
+ <span className="text-muted"> · {modelName(scanner.model, showTierNames)}</span>
</span>
),
},
diff --git a/products/replay_vision/frontend/replay_scanners/types.test.ts b/products/replay_vision/frontend/replay_scanners/types.test.ts
index 6425801b2a1e..70e823043ab6 100644
--- a/products/replay_vision/frontend/replay_scanners/types.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/types.test.ts
@@ -1,6 +1,6 @@
-import { type FailureKind, failureRetryGuidance, observationRetryOffer } from './types'
+import { type FailureKind, failureRetryGuidance, getModelOptions, modelLabel, observationRetryOffer } from './types'
-describe('retry guidance', () => {
+describe('scanner type helpers', () => {
describe('failureRetryGuidance', () => {
// The retry button is always rendered; this is what decides whether we push it. Getting a kind into the wrong
// bucket either discourages the retry that fixes it, or promises one that can only fail the same way.
@@ -60,4 +60,26 @@ describe('retry guidance', () => {
expect(observationRetryOffer('ineligible', 'no_snapshots:nothing to render').hint).not.toBeNull()
})
})
+
+ describe('model naming', () => {
+ // Both maps satisfy the types, so wiring the wrong one into a variant (a Gemini name leaking
+ // into tier labels, or vice versa) would silently contaminate the naming experiment's arms.
+ it('labels models by tier in the experiment variant and by model name by default', () => {
+ expect(getModelOptions(false).map((o) => o.label)).toEqual([
+ 'Gemini 3.5 Flash Lite · 2 credits/observation',
+ 'Gemini 3 Flash · 5 credits/observation',
+ 'Gemini 3.6 Flash · 15 credits/observation',
+ ])
+ expect(getModelOptions(true).map((o) => o.label)).toEqual([
+ 'Basic · 2 credits/observation',
+ 'Pro · 5 credits/observation',
+ 'Ultra · 15 credits/observation',
+ ])
+ })
+
+ it('falls back to the raw id for retired models frozen in old observation snapshots', () => {
+ expect(modelLabel('gemini-1.5-retired', true)).toBe('gemini-1.5-retired')
+ expect(modelLabel('gemini-1.5-retired', false)).toBe('gemini-1.5-retired')
+ })
+ })
})
diff --git a/products/replay_vision/frontend/replay_scanners/types.ts b/products/replay_vision/frontend/replay_scanners/types.ts
index 1ef462c5bee1..897f98ca3754 100644
--- a/products/replay_vision/frontend/replay_scanners/types.ts
+++ b/products/replay_vision/frontend/replay_scanners/types.ts
@@ -242,27 +242,37 @@ const MODEL_NAMES: Record<ScannerModelEnumApi, string> = {
[ScannerModelEnumApi.Gemini36Flash]: 'Gemini 3.6 Flash',
}
-export const MODEL_OPTIONS: { value: ScannerModelEnumApi; label: string }[] = Object.values(ScannerModelEnumApi).map(
- (value) => ({
+// Test variant of the replay-vision-model-tier-naming-experiment flag: capability tiers instead of
+// provider model names. Every surface that shows a model must pass the same variant so a user never
+// sees both naming schemes for one scanner.
+const MODEL_TIER_NAMES: Record<ScannerModelEnumApi, string> = {
+ [ScannerModelEnumApi.Gemini35FlashLite]: 'Basic',
+ [ScannerModelEnumApi.Gemini3FlashPreview]: 'Pro',
+ [ScannerModelEnumApi.Gemini36Flash]: 'Ultra',
+}
+
+export function getModelOptions(showTierNames: boolean): { value: ScannerModelEnumApi; label: string }[] {
+ return Object.values(ScannerModelEnumApi).map((value) => ({
value,
- label: `${MODEL_NAMES[value]} · ${formatCreditCount(OBSERVATION_CREDITS_BY_MODEL[value])}/observation`,
- })
-)
+ label: `${modelName(value, showTierNames)} · ${formatCreditCount(OBSERVATION_CREDITS_BY_MODEL[value])}/observation`,
+ }))
+}
// Falls back to the raw id for retired models frozen in old observation snapshots.
-export function modelLabel(model: string | null | undefined): string {
+export function modelLabel(model: string | null | undefined, showTierNames: boolean = false): string {
if (!model) {
return '—'
}
- return MODEL_OPTIONS.find((opt) => opt.value === model)?.label ?? model
+ return getModelOptions(showTierNames).find((opt) => opt.value === model)?.label ?? model
}
/** Plain model name without the price suffix, for surfaces that show the price separately. */
-export function modelName(model: string | null | undefined): string {
+export function modelName(model: string | null | undefined, showTierNames: boolean = false): string {
if (!model) {
return '—'
}
- return MODEL_NAMES[model as ScannerModelEnumApi] ?? model
+ const names = showTierNames ? MODEL_TIER_NAMES : MODEL_NAMES
+ return names[model as ScannerModelEnumApi] ?? model
}
export function scannerTypeLabel(scannerType: ScannerType | null | undefined): string {