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): add What to watch feed tab behind experiment (#98867)

Kim Svatos Dugan129e7a18ddac
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index d2c6db808a65..fc6dd997c8d2 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -9468,6 +9468,14 @@ snapshots:
hash: v1.k794b7964.70707572ec3098ed0c916ac56ec8618ccd95b7b270cffb5a5425d447622912d5.Dayhp1AO69NWJL7h-i4nDDzqeXSh_3lNJjcRDBvOASU
scenes-app-project-homepage--project-homepage--light:
hash: v1.k794b7964.45567c13e93e1def5dabfea7b6a4a5a47253482e6dd5c587be257ae5b9374639.IC346vxEHrTKcFor0vVTajrOk8lCGCu3C5pdFW2iTOQ
+ scenes-app-replay-vision--home-watch-feed--dark:
+ hash: v1.k794b7964.268977e5e04ed1b1bda4c6e08ddd38efcaf687b8a316c297b876ab2262ca9c39.eTy9THa8yZqoJNNNpSe3aV_APrxAOwkefDb1y6CWedI
+ scenes-app-replay-vision--home-watch-feed--light:
+ hash: v1.k794b7964.1d9ed7bef6b3f4ed4ea9cb5b853e1986f397ecca41b52459654409e430526350.h6pTg6AprZOfKXZ6tqv8h53yGlX3nnHmY4meEnFZTg8
+ scenes-app-replay-vision--home-watch-feed-empty--dark:
+ hash: v1.k794b7964.a11e227e448c902b9992de9bce152859ab05891f01cd88c2363cd0c1d8ae0224.auA_OUt2YDuk88h8lAnes98ekvGzA7_-8xrUtAEAoSY
+ scenes-app-replay-vision--home-watch-feed-empty--light:
+ hash: v1.k794b7964.f4d960313b80fd632bd15a5bc789b2d8a37381284b0e4600f849a24071be5b1c.33KiuuIHiIiCZ3gMFApKeH-YYEAJbT9ajcDhdb_Pbr8
scenes-app-replay-vision--observation-detail--dark:
hash: v1.k794b7964.5c1e4dc71fab8dd16212232b0a6483e7b96f884bd6c9761f276e9d6d788192a3.EyeOt5zd-9ySXBJcK-nvwOcO-Q1umL8pWldTB9PWh9s
scenes-app-replay-vision--observation-detail--light:
@@ -9604,6 +9612,10 @@ snapshots:
hash: v1.k794b7964.aab9212ef24367842f0c4b5c6e0b5568efa7b02455e0b762a0dae56f7a251ded.Vis7Q1vljRgKviTHYsDV5sgLm5fLA8DqNHkJ-26wpBE
scenes-app-replay-vision--usage-tab--light:
hash: v1.k794b7964.2ef3c1068703daaae8c960f5efde14f65aa0a0db64a5125d06beca44abd35433.H06_UO_8eRcWCyB1p55hCLxFFDlj-5Av13ZGRDpbPaQ
+ scenes-app-replay-vision--usage-tab-redesigned--dark:
+ hash: v1.k794b7964.30975bcc2085658200ab6ea0f24d7981bdcf1fc13fccc9c3dc758c0063372d46.j1VtD47yDmX3mczn_DBkVGbGZgPUsuAPFLN1COo1n0I
+ scenes-app-replay-vision--usage-tab-redesigned--light:
+ hash: v1.k794b7964.4c8e665d2f6197115d5a0ffb3e914027d2ffa63f2856ca17c7c0e92fb4ea1c84.YIHK8qU8f2M6OTil-h7HvXzENlVMfNUeI3LYVikCjuA
scenes-app-replay-vision-spendtrajectorychart--hits-the-limit--dark:
hash: v1.k794b7964.cf96414912c6d8f0d73808db3f1d833c661d12b3b0449cdd49b95d4dc8059e80.3sA2mn18MksUWQQ4mq6wEPbkJhGP3O258Y6Q2fTWhgM
scenes-app-replay-vision-spendtrajectorychart--hits-the-limit--light:
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
index 48958c45be9a..2f53370ef640 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
@@ -487,6 +487,102 @@ const meta: Meta = {
'/api/projects/:team_id/vision/scanners/': scanners,
'/api/projects/:team_id/vision/scanners/stats/': scannerStats,
'/api/projects/:team_id/vision/scanners/creators/': { creators: [alice, bob] },
+ // One card per reason kind, plus one with no cited timestamps (no clip range on the tile).
+ '/api/projects/:team_id/vision/scanners/watch_feed/': {
+ results: [
+ {
+ observation: observation({
+ id: '00000000-0000-0000-0000-0000000000d1',
+ scanner_id: scanners.results[0].id,
+ scanner_snapshot: {
+ name: 'Confused checkout',
+ scanner_type: 'monitor',
+ scanner_version: 1,
+ model: 'gemini-3.8-flash',
+ provider: 'google',
+ emits_signals: true,
+ scanner_config: { prompt: 'Did the user hesitate at checkout?' },
+ verify_positives: 'off',
+ },
+ scanner_result: {
+ model_output: {
+ scanner_type: 'monitor',
+ verdict: 'yes',
+ confidence: 0.92,
+ reasoning: 'Retried the payment form twice before completing.',
+ reasoning_segments: [
+ { kind: 'chip', timestamp_ms: 62000 },
+ { kind: 'text', value: ' Retried the payment form twice ' },
+ { kind: 'chip', timestamp_ms: 154000 },
+ ],
+ },
+ signals_count: 2,
+ verification: null,
+ },
+ viewed: false,
+ }),
+ reason: { kind: 'signal_emitted', signals_count: 2 },
+ },
+ {
+ observation: observation({
+ id: '00000000-0000-0000-0000-0000000000d2',
+ scanner_id: scanners.results[3].id,
+ scanner_snapshot: {
+ name: 'Intent score',
+ scanner_type: 'scorer',
+ scanner_version: 1,
+ model: 'gemini-3.8-flash',
+ provider: 'google',
+ emits_signals: false,
+ scanner_config: { prompt: 'Score this session.', scale: { min: 0, max: 10 } },
+ verify_positives: 'off',
+ },
+ scanner_result: {
+ model_output: {
+ scanner_type: 'scorer',
+ score: 9.5,
+ confidence: 0.88,
+ reasoning: 'Compared plans, opened billing, invited a teammate.',
+ reasoning_segments: [
+ { kind: 'text', value: 'Compared plans at ' },
+ { kind: 'chip', timestamp_ms: 30000 },
+ { kind: 'text', value: ', opened billing, invited a teammate.' },
+ ],
+ },
+ signals_count: 0,
+ verification: null,
+ },
+ viewed: false,
+ }),
+ reason: { kind: 'outlier_score', score: 9.5, window_mean: 5.1 },
+ },
+ {
+ observation: observation({
+ id: '00000000-0000-0000-0000-0000000000d3',
+ recording_subject_email: '[email protected]',
+ viewed: true,
+ }),
+ reason: { kind: 'unviewed_recent' },
+ },
+ {
+ observation: observation({
+ id: '00000000-0000-0000-0000-0000000000d4',
+ scanner_result: {
+ model_output: {
+ scanner_type: 'summarizer',
+ confidence: 0.8,
+ title: 'Quick bug report',
+ summary: 'Hit an error dialog and filed feedback from the toast.',
+ },
+ signals_count: 0,
+ verification: null,
+ },
+ viewed: true,
+ }),
+ reason: { kind: 'recent' },
+ },
+ ],
+ },
'/api/projects/:team_id/vision/quota/': quota,
'/api/projects/:team_id/vision/quota/spend_series/': spendSeries,
'/api/projects/:team_id/vision/scanners/:id/': summarizerScanner,
@@ -573,6 +669,32 @@ export const UsageTab: StoryObj = {
parameters: { pageUrl: `${urls.replayVision()}?tab=usage` },
}
+// The home-redesign experiment's test arm lands on the What to watch feed.
+export const HomeWatchFeed: StoryObj = {
+ parameters: {
+ featureFlags: { [FEATURE_FLAGS.REPLAY_VISION_HOME_REDESIGN_EXPERIMENT]: 'test' },
+ },
+}
+
+export const HomeWatchFeedEmpty: StoryObj = {
+ decorators: [
+ mswDecorator({
+ get: { '/api/projects/:team_id/vision/scanners/watch_feed/': { results: [] } },
+ }),
+ ],
+ parameters: {
+ featureFlags: { [FEATURE_FLAGS.REPLAY_VISION_HOME_REDESIGN_EXPERIMENT]: 'test' },
+ },
+}
+
+// Test arm of the Usage tab: absorbs the observations chart and enabled-scanners card.
+export const UsageTabRedesigned: StoryObj = {
+ parameters: {
+ pageUrl: `${urls.replayVision()}?tab=usage`,
+ featureFlags: { [FEATURE_FLAGS.REPLAY_VISION_HOME_REDESIGN_EXPERIMENT]: 'test' },
+ },
+}
+
export const SummarizerOverview: StoryObj = {
parameters: { pageUrl: urls.replayVision(summarizerScanner.id) },
}
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
index 96642feea92f..7589835e1b3e 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.tsx
@@ -44,6 +44,7 @@ import { creditsToUsd, formatCreditCount } from '../utils/credits'
import { CreateScannerButton } from './components/CreateScannerButton'
import { VisionMetrics } from './components/VisionMetrics'
import { VisionUsageTab } from './components/VisionUsageTab'
+import { WatchFeedTab } from './components/WatchFeedTab'
import { ReplayScannerTab } from './replayScannerSceneLogic'
import { type ScannersSorting, SCANNERS_PAGE_SIZE, replayScannersLogic } from './replayScannersLogic'
import { LIMIT_REACHED_TOOLTIP } from './scannerCopy'
@@ -154,12 +155,17 @@ export function ReplayScannersScene(): JSX.Element {
const { searchParams } = useValues(router)
const { showUsd } = useValues(visionQuotaLogic)
const { featureFlags } = useValues(featureFlagLogic)
- const onScannersTab = ![ReplayScannerTab.Search, 'usage'].includes(searchParams.tab)
- // Reading the flags proxy reports exposure; guard the read so it fires only where the
- // experiment arms actually diverge (the scanners tab; the Usage tab reads it itself).
+ // On the test arm the tab row itself diverges, so the flag read (which reports exposure)
+ // is correct on every tab of this scene.
const isRedesign =
- onScannersTab &&
homeRedesignVariant(featureFlags[FEATURE_FLAGS.REPLAY_VISION_HOME_REDESIGN_EXPERIMENT]) === 'test'
+ // The feed tab exists only on the test arm and is its default; control users following a
+ // shared ?tab=watch link fall through to the scanners tab.
+ const knownTabs: string[] = isRedesign
+ ? ['watch', 'scanners', ReplayScannerTab.Search, 'usage']
+ : ['scanners', ReplayScannerTab.Search, 'usage']
+ const defaultTab = isRedesign ? 'watch' : 'scanners'
+ const activeTab = knownTabs.includes(searchParams.tab) ? searchParams.tab : defaultTab
const columns: LemonTableColumns<ReplayScanner> = [
{
@@ -293,20 +299,21 @@ export function ReplayScannersScene(): JSX.Element {
)}
<LemonTabs
- activeKey={
- [ReplayScannerTab.Search, 'usage'].includes(searchParams.tab) ? searchParams.tab : 'scanners'
- }
- onChange={(tab) => push(urls.replayVision(), tab === 'scanners' ? {} : { tab })}
+ activeKey={activeTab}
+ onChange={(tab) => push(urls.replayVision(), tab === defaultTab ? {} : { tab })}
tabs={[
+ ...(isRedesign ? [{ key: 'watch', label: 'What to watch', content: <></> }] : []),
{ key: 'scanners', label: 'Scanners', content: <></> },
{ key: ReplayScannerTab.Search, label: 'Search', content: <></> },
{ key: 'usage', label: 'Usage', content: <></> },
]}
/>
- {searchParams.tab === ReplayScannerTab.Search ? (
+ {activeTab === 'watch' ? (
+ <WatchFeedTab />
+ ) : activeTab === ReplayScannerTab.Search ? (
<ObservationSearchTab scanner={null} />
- ) : searchParams.tab === 'usage' ? (
+ ) : activeTab === 'usage' ? (
<VisionUsageTab />
) : (
<>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts
new file mode 100644
index 000000000000..541ef319dcc9
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts
@@ -0,0 +1,64 @@
+import type { ReplayObservationApi, WatchFeedReasonApi } from '../../generated/api.schemas'
+import { observationClipRange, watchReasonCopy } from './WatchFeedCard'
+
+describe('WatchFeedCard helpers', () => {
+ describe('watchReasonCopy', () => {
+ it.each<{ name: string; reason: WatchFeedReasonApi; expected: string }>([
+ {
+ name: 'pluralizes multiple signals',
+ reason: { kind: 'signal_emitted', signals_count: 3 } as WatchFeedReasonApi,
+ expected: 'The scanner raised 3 signals from this session.',
+ },
+ {
+ name: 'rounds the score and window average',
+ reason: { kind: 'outlier_score', score: 9.53846, window_mean: 5.1428 } as WatchFeedReasonApi,
+ expected: "Scored 9.54, far from this scanner's recent average of 5.14.",
+ },
+ {
+ name: 'falls back when an outlier_score arrives without its numbers',
+ reason: { kind: 'outlier_score' } as WatchFeedReasonApi,
+ expected: "Scored far from this scanner's recent average.",
+ },
+ {
+ name: 'falls back when an unusual_verdict arrives without a verdict',
+ reason: { kind: 'unusual_verdict' } as WatchFeedReasonApi,
+ expected: 'The scanner gave a rare answer for this window.',
+ },
+ {
+ name: 'falls back when a rare_tag arrives without a tag',
+ reason: { kind: 'rare_tag' } as WatchFeedReasonApi,
+ expected: 'Tagged something uncommon for this scanner lately.',
+ },
+ {
+ name: 'renders a sentence for a reason kind this frontend does not know',
+ reason: { kind: 'some_future_kind' } as unknown as WatchFeedReasonApi,
+ expected: 'Worth a look.',
+ },
+ ])('$name', ({ reason, expected }) => {
+ expect(watchReasonCopy(reason)).toBe(expected)
+ })
+ })
+
+ describe('observationClipRange', () => {
+ const observation = (scannerType: string | undefined, output: Record<string, unknown>): ReplayObservationApi =>
+ ({
+ scanner_snapshot: scannerType ? { scanner_type: scannerType } : undefined,
+ scanner_result: { model_output: output },
+ }) as unknown as ReplayObservationApi
+
+ it('reads the summary citation when the snapshot type is summarizer, even if the result omits scanner_type', () => {
+ const range = observationClipRange(
+ observation('summarizer', {
+ summary: 'Wrapped up (t 30) cleanly.',
+ reasoning: 'Debugged (t 90) at length.',
+ })
+ )
+ expect(range).toEqual({ startMs: 30_000, endMs: 30_000 })
+ })
+
+ it('reads the reasoning citation for a non-summarizer type', () => {
+ const range = observationClipRange(observation('monitor', { reasoning: 'Retried (t 45) twice.' }))
+ expect(range).toEqual({ startMs: 45_000, endMs: 45_000 })
+ })
+ })
+})
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
new file mode 100644
index 000000000000..bb6cfb3e6434
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
@@ -0,0 +1,208 @@
+import { useActions } from 'kea'
+import { router } from 'kea-router'
+
+import { IconPlay } from '@posthog/icons'
+import { LemonButton, LemonDivider, Link, Tooltip } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+import posthog from 'lib/posthog-typed'
+import { colonDelimitedDuration } from 'lib/utils/durations'
+import { sessionPlayerModalLogic } from 'scenes/session-recordings/player/modal/sessionPlayerModalLogic'
+import { urls } from 'scenes/urls'
+
+import { CitedText, ObservationResultSummary, readResult } from '../../components/ObservationCard'
+import { ScannerTypeBadge } from '../../components/ScannerTypeBadge'
+import type { ReplayObservationApi, WatchFeedItemApi, WatchFeedReasonApi } from '../../generated/api.schemas'
+import { citedTimestampRange } from '../../utils/citations'
+import { ScannerType } from '../types'
+
+const roundScore = (value: number): number => Math.round(value * 100) / 100
+
+export function watchReasonCopy(reason: WatchFeedReasonApi): string {
+ switch (reason.kind) {
+ case 'signal_emitted':
+ return (reason.signals_count ?? 0) > 1
+ ? `The scanner raised ${reason.signals_count} signals from this session.`
+ : 'The scanner raised a signal from this session.'
+ case 'unusual_verdict':
+ return reason.verdict
+ ? `The scanner answered ${reason.verdict}, which is rare for it in this window.`
+ : 'The scanner gave a rare answer for this window.'
+ case 'verdict_yes':
+ return 'The scanner answered yes for this session.'
+ case 'outlier_score':
+ return reason.score != null && reason.window_mean != null
+ ? `Scored ${roundScore(reason.score)}, far from this scanner's recent average of ${roundScore(reason.window_mean)}.`
+ : "Scored far from this scanner's recent average."
+ case 'rare_tag':
+ return reason.tag
+ ? `Tagged "${reason.tag}", which is uncommon for this scanner lately.`
+ : 'Tagged something uncommon for this scanner lately.'
+ case 'novel_summary':
+ return "Reads unlike this scanner's other sessions in this window."
+ case 'friction':
+ return 'The session shows signs of friction, like errors, retries, or dead ends.'
+ case 'unviewed_recent':
+ return 'New since you last looked.'
+ case 'recent':
+ return 'The newest from this scanner.'
+ default:
+ // The backend owns this enum, so a kind that ships before this frontend deploys still needs a sentence.
+ return 'Worth a look.'
+ }
+}
+
+/** The moment span the observation cites, read from the type's cited field. */
+export function observationClipRange(observation: ReplayObservationApi): { startMs: number; endMs: number } | null {
+ const result = readResult(observation)
+ if (!result) {
+ return null
+ }
+ const scannerType =
+ (observation.scanner_snapshot?.scanner_type as ScannerType | undefined) ??
+ (result.scanner_type as ScannerType | undefined)
+ const [text, segments] =
+ scannerType === 'summarizer'
+ ? [result.summary, result.summary_segments]
+ : [result.reasoning, result.reasoning_segments]
+ return typeof text === 'string' ? citedTimestampRange(text, segments) : null
+}
+
+interface WatchFeedCardProps {
+ item: WatchFeedItemApi
+ /** Zero-based place in the feed, captured so we can see how deep people read. */
+ position: number
+}
+
+export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Element {
+ const { observation, reason } = item
+ const { openSessionPlayer } = useActions(sessionPlayerModalLogic)
+ const clip = observationClipRange(observation)
+ const scannerType = observation.scanner_snapshot?.scanner_type as ScannerType | undefined
+ const scannerName = (observation.scanner_snapshot?.name as string | undefined) || '(untitled scanner)'
+ const person = observation.recording_subject_email || observation.distinct_id
+ // Summarizers already tell the story through title + summary; the other types show only an
+ // outcome chip, so bring their reasoning along for context, clamped to keep the card scannable.
+ const result = readResult(observation)
+ const reasoning =
+ scannerType !== 'summarizer' && typeof result?.reasoning === 'string'
+ ? { text: result.reasoning, segments: result.reasoning_segments }
+ : null
+ // t=0 when nothing is cited, so the observation page still opens with the player expanded.
+ const observationUrl = `${urls.replayVisionObservation(observation.id)}?t=${clip ? Math.floor(clip.startMs / 1000) : 0}`
+ const capture = (target: 'clip_modal' | 'observation'): void => {
+ posthog.capture('replay_vision_watch_clip_clicked', {
+ scanner_id: observation.scanner_id,
+ scanner_type: scannerType,
+ observation_id: observation.id,
+ position,
+ reason_kind: reason.kind,
+ target,
+ })
+ }
+ const watchClipInModal = (): void => {
+ capture('clip_modal')
+ // The modal's own `initialTimestamp` is an absolute unix-ms time, but a clip start is an
+ // offset into the recording. The player reads `?t=<seconds>` as an offset on first load and
+ // the modal preserves existing search params, so set (or clear) `t` before opening.
+ const { location, searchParams, hashParams } = router.values
+ router.actions.replace(
+ location.pathname,
+ { ...searchParams, t: clip ? Math.floor(clip.startMs / 1000) : undefined },
+ hashParams
+ )
+ openSessionPlayer({ id: observation.session_id })
+ }
+
+ return (
+ <div
+ className="@container relative border rounded bg-bg-light p-4 flex gap-4 hover:border-accent"
+ data-attr="vision-watch-feed-card"
+ >
+ {/* The thumbnail column spans the card's full height; everything else stacks beside it. */}
+ <div className="hidden @md:flex w-48 shrink-0 flex-col gap-1">
+ <div className="h-24 rounded bg-surface-secondary border flex items-center justify-center relative">
+ <IconPlay className="text-2xl text-muted" />
+ {!observation.viewed && (
+ <Tooltip title="You haven't opened this observation yet">
+ <span
+ className="absolute -top-1 -right-1 w-2.5 h-2.5 rounded-full bg-accent border border-bg-light z-10"
+ aria-label="Unviewed"
+ />
+ </Tooltip>
+ )}
+ {clip && (
+ <span className="absolute bottom-1 right-1 text-xs tabular-nums bg-bg-light border rounded px-1">
+ {colonDelimitedDuration(Math.floor(clip.startMs / 1000), null)} to{' '}
+ {colonDelimitedDuration(Math.floor(clip.endMs / 1000), null)}
+ </span>
+ )}
+ </div>
+ {clip && clip.endMs > clip.startMs && (
+ <span className="text-xs text-muted">
+ {colonDelimitedDuration(Math.ceil((clip.endMs - clip.startMs) / 1000), null)} of the session
+ cited
+ </span>
+ )}
+ </div>
+ <div className="flex-1 min-w-0 flex flex-col gap-2">
+ <div className="flex items-start justify-between gap-2">
+ <div className="flex flex-wrap items-center gap-2 min-w-0">
+ {scannerType && <ScannerTypeBadge scannerType={scannerType} />}
+ <span className="text-muted text-sm truncate">{scannerName}</span>
+ </div>
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconPlay />}
+ onClick={watchClipInModal}
+ className="relative z-10 shrink-0"
+ data-attr="vision-watch-clip"
+ >
+ Watch clip
+ </LemonButton>
+ </div>
+ {/* Stretched to cover the card: clicking anywhere opens the observation with the
+ player expanded at the first cited moment. Inner links and the button sit
+ above it via `relative z-10`, so the anchors never nest. */}
+ <Link
+ to={observationUrl}
+ onClick={() => capture('observation')}
+ className="text-sm text-default after:absolute after:inset-0 after:content-['']"
+ data-attr="vision-watch-feed-card-body"
+ >
+ <div className="flex flex-col gap-1">
+ <ObservationResultSummary observation={observation} />
+ {reasoning && (
+ <p className="text-muted m-0 line-clamp-2">
+ <CitedText text={reasoning.text} segments={reasoning.segments} />
+ </p>
+ )}
+ </div>
+ </Link>
+ <LemonDivider className="my-0" />
+ <div className="text-xs text-secondary">
+ <span className="font-semibold uppercase">Why this clip</span> {watchReasonCopy(reason)}
+ </div>
+ <div className="flex flex-wrap items-center justify-between gap-2 text-xs text-muted">
+ {person ? (
+ observation.distinct_id ? (
+ <Link
+ to={urls.personByDistinctId(observation.distinct_id)}
+ className="relative z-10 truncate min-w-0"
+ data-attr="vision-watch-feed-person"
+ >
+ {person}
+ </Link>
+ ) : (
+ <span className="truncate min-w-0">{person}</span>
+ )
+ ) : (
+ <span />
+ )}
+ <TZLabel time={observation.created_at} className="shrink-0" />
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
new file mode 100644
index 000000000000..68e43750e0ad
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
@@ -0,0 +1,112 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonButton, LemonSkeleton } from '@posthog/lemon-ui'
+
+import { DateFilter } from 'lib/components/DateFilter/DateFilter'
+import { dateMapping } from 'lib/utils/dateFilters'
+import { pluralize } from 'lib/utils/strings'
+
+import { FilterPill } from '../../components/FilterPill'
+import { SCANNER_TYPE_OPTIONS, ScannerType } from '../types'
+import { watchFeedLogic } from '../watchFeedLogic'
+import { WatchFeedCard, observationClipRange } from './WatchFeedCard'
+
+const TYPE_OPTIONS: { value: ScannerType; label: string }[] = SCANNER_TYPE_OPTIONS.map(({ value, label }) => ({
+ value,
+ label,
+}))
+
+// The endpoint caps the window at 90 days and rejects "All time" style bounds, so offer only ranges it accepts.
+const FEED_DATE_OPTION_KEYS = new Set([
+ 'Today',
+ 'Yesterday',
+ 'Last 24 hours',
+ 'Last 7 days',
+ 'Last 14 days',
+ 'Last 30 days',
+ 'Last 90 days',
+])
+const FEED_DATE_OPTIONS = dateMapping.filter((option) => FEED_DATE_OPTION_KEYS.has(option.key))
+
+export function WatchFeedTab(): JSX.Element {
+ const { feedItems, feedItemsLoading, feedFailed, dateFrom, dateTo, scannerTypeFilter } = useValues(watchFeedLogic)
+ const { setDateRange, setScannerTypeFilter, loadFeed } = useActions(watchFeedLogic)
+
+ const items = feedItems ?? []
+ const scannerCount = new Set(items.map((item) => item.observation.scanner_id)).size
+ // Only observations that actually cite a moment contribute to the total; a non-cited card has no clip.
+ const citedMinutes = Math.round(
+ items.reduce((total, item) => {
+ const clip = observationClipRange(item.observation)
+ return total + (clip ? Math.max(clip.endMs - clip.startMs, 30_000) : 0)
+ }, 0) / 60_000
+ )
+
+ return (
+ <div className="flex flex-col gap-4">
+ <div className="flex flex-wrap items-end justify-between gap-2">
+ <div className="flex flex-col gap-1">
+ <h2 className="text-xl font-semibold m-0">
+ {items.length > 0
+ ? `${pluralize(items.length, 'clip')}, about ${pluralize(Math.max(citedMinutes, 1), 'minute')}`
+ : 'What to watch'}
+ </h2>
+ <p className="text-muted text-sm m-0">
+ {items.length > 0
+ ? `Picked from ${pluralize(scannerCount, 'scanner')} in this window. Each clip is the moment an observation cites.`
+ : 'The observations most worth a look, picked across your scanners.'}
+ </p>
+ </div>
+ <div className="flex flex-wrap items-center gap-2">
+ <FilterPill<ScannerType>
+ label="Type"
+ options={TYPE_OPTIONS}
+ value={scannerTypeFilter ? [scannerTypeFilter] : []}
+ onChange={(values) => setScannerTypeFilter(values[values.length - 1] ?? null)}
+ />
+ <DateFilter
+ dateFrom={dateFrom}
+ dateTo={dateTo}
+ dateOptions={FEED_DATE_OPTIONS}
+ showRollingRangePicker={false}
+ onChange={(from, to) => setDateRange(from ?? null, to ?? null)}
+ />
+ </div>
+ </div>
+
+ {feedItemsLoading && feedItems === null ? (
+ <div className="flex flex-col gap-3">
+ {[0, 1, 2].map((i) => (
+ <LemonSkeleton key={i} className="h-32 rounded" />
+ ))}
+ </div>
+ ) : (
+ <div className="flex flex-col gap-3">
+ {/* kea-loaders keeps the last value on failure, so a later filter or date change can fail
+ with cards still on screen. Show the error above them rather than replacing them. */}
+ {feedFailed && (
+ <div className="flex items-center gap-2 text-sm text-secondary border rounded p-4">
+ <span>
+ {items.length > 0
+ ? "Couldn't refresh the feed. Showing the last results."
+ : "Couldn't load the feed."}
+ </span>
+ <LemonButton size="small" type="secondary" onClick={() => loadFeed()}>
+ Try again
+ </LemonButton>
+ </div>
+ )}
+ {items.length > 0 ? (
+ items.map((item, index) => (
+ <WatchFeedCard key={item.observation.id} item={item} position={index} />
+ ))
+ ) : !feedFailed ? (
+ <div className="text-sm text-secondary border border-dashed rounded p-6 text-center">
+ Nothing worth watching in this window yet. Observations appear here as your scanners run.
+ </div>
+ ) : null}
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts
new file mode 100644
index 000000000000..cfaaa61496a1
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts
@@ -0,0 +1,73 @@
+import { expectLogic } from 'kea-test-utils'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { watchFeedLogic } from './watchFeedLogic'
+
+describe('watchFeedLogic', () => {
+ let logic: ReturnType<typeof watchFeedLogic.build>
+ let feedSpy: jest.Mock
+
+ const item = (id: string, reasonKind: string): Record<string, any> => ({
+ observation: {
+ id,
+ scanner_id: 'scanner-a',
+ session_id: `session-${id}`,
+ status: 'succeeded',
+ created_at: '2026-05-12T00:00:00Z',
+ },
+ reason: { kind: reasonKind },
+ })
+
+ beforeEach(() => {
+ feedSpy = jest.fn(() => [200, { results: [item('o1', 'signal_emitted'), item('o2', 'recent')] }])
+ useMocks({
+ get: {
+ '/api/projects/:team/vision/scanners/watch_feed/': feedSpy,
+ },
+ })
+ initKeaTests()
+ logic = watchFeedLogic.build()
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ })
+
+ it('loads on mount and reloads with params when filters change', async () => {
+ logic.mount()
+ await expectLogic(logic).toDispatchActions(['loadFeed', 'loadFeedSuccess']).toFinishAllListeners()
+ expect(logic.values.feedItems).toHaveLength(2)
+ expect(new URL(feedSpy.mock.calls[0][0].request.url).searchParams.get('date_from')).toBe('-7d')
+
+ await expectLogic(logic, () => {
+ logic.actions.setScannerTypeFilter('monitor')
+ })
+ .toDispatchActions(['loadFeed', 'loadFeedSuccess'])
+ .toFinishAllListeners()
+ const lastUrl = new URL(feedSpy.mock.calls.at(-1)[0].request.url)
+ expect(lastUrl.searchParams.get('scanner_type')).toBe('monitor')
+
+ await expectLogic(logic, () => {
+ logic.actions.setDateRange('-30d', null)
+ })
+ .toDispatchActions(['loadFeed', 'loadFeedSuccess'])
+ .toFinishAllListeners()
+ expect(new URL(feedSpy.mock.calls.at(-1)[0].request.url).searchParams.get('date_from')).toBe('-30d')
+ })
+
+ it('flags a failed load and clears the flag on retry', async () => {
+ feedSpy.mockImplementation(() => [500, { detail: 'nope' }])
+ logic.mount()
+ await expectLogic(logic)
+ .toDispatchActions(['loadFeed', 'loadFeedFailure'])
+ .toMatchValues({ feedFailed: true, feedItems: null })
+ feedSpy.mockImplementation(() => [200, { results: [] }])
+ await expectLogic(logic, () => {
+ logic.actions.loadFeed()
+ })
+ .toDispatchActions(['loadFeedSuccess'])
+ .toMatchValues({ feedFailed: false, feedItems: [] })
+ })
+})
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
new file mode 100644
index 000000000000..d736eec39bea
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
@@ -0,0 +1,168 @@
+import { MakeLogicType, actions, afterMount, kea, listeners, path, reducers } from 'kea'
+import { loaders } from 'kea-loaders'
+import { router } from 'kea-router'
+
+import posthog from 'lib/posthog-typed'
+import { sessionPlayerModalLogic } from 'scenes/session-recordings/player/modal/sessionPlayerModalLogic'
+import { teamLogic } from 'scenes/teamLogic'
+
+import { visionScannersWatchFeedRetrieve } from '../generated/api'
+import type { VisionScannersWatchFeedRetrieveParams, WatchFeedItemApi } from '../generated/api.schemas'
+import type { ScannerTypeEnumApi } from '../generated/api.schemas'
+import { ScannerType } from './types'
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface watchFeedLogicValues {
+ dateFrom: string
+ dateTo: string | null
+ feedFailed: boolean
+ feedItems: WatchFeedItemApi[] | null
+ feedItemsLoading: boolean
+ scannerTypeFilter: ScannerType | null
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface watchFeedLogicActions {
+ loadFeed: () => {
+ value: true
+ }
+ loadFeedFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadFeedSuccess: (
+ feedItems: WatchFeedItemApi[],
+ payload?: {
+ value: true
+ }
+ ) => {
+ feedItems: WatchFeedItemApi[]
+ payload?: {
+ value: true
+ }
+ }
+ setDateRange: (
+ dateFrom: string | null,
+ dateTo: string | null
+ ) => {
+ dateFrom: string | null
+ dateTo: string | null
+ }
+ setScannerTypeFilter: (scannerType: ScannerType | null) => {
+ scannerType: ScannerTypeEnumApi | null
+ }
+}
+
+export type watchFeedLogicType = MakeLogicType<watchFeedLogicValues, watchFeedLogicActions>
+
+export const DEFAULT_FEED_DATE_FROM: string = '-7d'
+
+/** Data for the What to watch tab: the window's most watchable observations, ranked server-side. */
+export const watchFeedLogic = kea<watchFeedLogicType>([
+ path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchFeedLogic']),
+
+ actions({
+ setDateRange: (dateFrom: string | null, dateTo: string | null) => ({ dateFrom, dateTo }),
+ setScannerTypeFilter: (scannerType: ScannerType | null) => ({ scannerType }),
+ loadFeed: true,
+ }),
+
+ loaders(({ values }) => ({
+ feedItems: [
+ null as WatchFeedItemApi[] | null,
+ {
+ loadFeed: async (_, breakpoint) => {
+ const teamId = teamLogic.values.currentTeamId
+ if (!teamId) {
+ // Reporting this as a successful empty result would read as "nothing to watch";
+ // fail instead so the tab shows the error state and a retry.
+ throw new Error('No current team')
+ }
+ const params: VisionScannersWatchFeedRetrieveParams = { date_from: values.dateFrom }
+ if (values.dateTo) {
+ params.date_to = values.dateTo
+ }
+ if (values.scannerTypeFilter) {
+ params.scanner_type = values.scannerTypeFilter
+ }
+ const response = await visionScannersWatchFeedRetrieve(String(teamId), params)
+ // Drop out-of-order responses — the most recent filter change owns the feed.
+ breakpoint()
+ return response.results
+ },
+ },
+ ],
+ })),
+
+ reducers({
+ dateFrom: [
+ DEFAULT_FEED_DATE_FROM,
+ {
+ setDateRange: (_, { dateFrom }) => dateFrom ?? DEFAULT_FEED_DATE_FROM,
+ },
+ ],
+ dateTo: [
+ null as string | null,
+ {
+ setDateRange: (_, { dateTo }) => dateTo,
+ },
+ ],
+ scannerTypeFilter: [
+ null as ScannerType | null,
+ {
+ setScannerTypeFilter: (_, { scannerType }) => scannerType,
+ },
+ ],
+ feedFailed: [
+ false,
+ {
+ loadFeed: () => false,
+ loadFeedFailure: () => true,
+ },
+ ],
+ }),
+
+ listeners(({ actions, values }) => ({
+ setDateRange: () => {
+ posthog.capture('replay_vision_watch_feed_filtered', {
+ date_from: values.dateFrom,
+ date_to: values.dateTo,
+ scanner_type: values.scannerTypeFilter,
+ })
+ actions.loadFeed()
+ },
+ setScannerTypeFilter: () => {
+ posthog.capture('replay_vision_watch_feed_filtered', {
+ date_from: values.dateFrom,
+ date_to: values.dateTo,
+ scanner_type: values.scannerTypeFilter,
+ })
+ actions.loadFeed()
+ },
+ loadFeedSuccess: ({ feedItems }) => {
+ posthog.capture('replay_vision_watch_feed_viewed', {
+ clip_count: feedItems?.length ?? 0,
+ scanner_count: new Set((feedItems ?? []).map((item) => item.observation.scanner_id)).size,
+ })
+ },
+ // A card writes `?t=<seconds>` so the player opens at the cited moment; clear it on close so a
+ // link copied afterwards doesn't seek a recording the user is no longer looking at.
+ [sessionPlayerModalLogic.actionTypes.closeSessionPlayer]: () => {
+ const { location, searchParams, hashParams } = router.values
+ if (searchParams.t === undefined) {
+ return
+ }
+ const nextParams = { ...searchParams }
+ delete nextParams.t
+ router.actions.replace(location.pathname, nextParams, hashParams)
+ },
+ })),
+
+ // The tab content mounts only while the tab is active, so mount is the fetch signal.
+ afterMount(({ actions }) => {
+ actions.loadFeed()
+ }),
+])
diff --git a/products/replay_vision/frontend/utils/citations.ts b/products/replay_vision/frontend/utils/citations.ts
index f7f0941165a2..5ab653bdd81a 100644
--- a/products/replay_vision/frontend/utils/citations.ts
+++ b/products/replay_vision/frontend/utils/citations.ts
@@ -98,3 +98,13 @@ export function citedTextToPlainText(text: string, segments: unknown): string {
}
return out
}
+
+/** The moment span a cited field points at: min to max cited timestamp, or null when nothing is cited. */
+export function citedTimestampRange(text: string, segments: unknown): { startMs: number; endMs: number } | null {
+ const chips = parseCitedSegments(text, segments).filter((segment) => segment.kind === 'chip')
+ if (chips.length === 0) {
+ return null
+ }
+ const timestamps = chips.map((chip) => Math.max(0, chip.timestamp_ms))
+ return { startMs: Math.min(...timestamps), endMs: Math.max(...timestamps) }
+}