: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): add a breakdown tab to summary observations (#111174)
Tue Haulundabb8af9d3520
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 7afd4e35196e..0ffaf68dd8d3 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12394,6 +12394,14 @@ snapshots:hash: v1.k794b7964.de611d0919ecdbf574e0cc68b87ff8b43d4b693a48925708ac38dc8222af6ad5.Cebsg_fmVC59ZMN6ibQn30wWdRYEzymxgtM06GnDWCUscenes-app-replay-vision--observation-detail-summarize-button--light:hash: v1.k794b7964.9b24f17d0296ba5dcfb8e2f03af9a0e13b0277160c24381c502f12189c4f8861.eWuSEs61l3ZPVMmiB3dxWKyehhuyoczwyZYaScexYMA+ scenes-app-replay-vision--observation-detail-summary-with-timeline--dark:+ hash: v1.k794b7964.0b4b10e7b2ad45c3e23193a9cfd6e2b16ef550d9c0e5b882bc397befb94eb2b2.kSrMrYmDu1VBnP-VWdNV3gk_7vYQq-QQXBFN5PNFCGc+ scenes-app-replay-vision--observation-detail-summary-with-timeline--light:+ hash: v1.k794b7964.6787d94183cd7d607f0ab2779db54da1b62c36300c97796d1f129e92c4fa4d2a.zUQP_6ErxzsXco-qCF7xTjNqrnSgzyRnxqNai0xOKdk+ scenes-app-replay-vision--observation-detail-timeline--dark:+ hash: v1.k794b7964.3c342d403aa7be54d67b6ea782634e775fd918ac71c3db1111be9f76ca00f3f7.69WlqwAjWdyDa0EFoP8cYT6LWuZ3iHkz5fnxZDOOkNU+ scenes-app-replay-vision--observation-detail-timeline--light:+ hash: v1.k794b7964.7504938a1b65b905681656bfdef80ceecd7cad32d10b55e3dc7aa023205fdad0.kF66edZWzTLEwDR8vIQwDyPG9KEICMhihsC8F9NfZg0scenes-app-replay-vision--scanner-alerts--dark:hash: v1.k794b7964.07adaa26f0b868d6c64d7d99e3d1a317307dff376b1dc5d740c9c9cc9c2ff926.c9kS5X0nGVIU2VHq4sxwidzwpjG5bpqnlvPM-r8yEf8scenes-app-replay-vision--scanner-alerts--light:@@ -12526,6 +12534,14 @@ snapshots:hash: v1.k794b7964.aab9212ef24367842f0c4b5c6e0b5568efa7b02455e0b762a0dae56f7a251ded.Vis7Q1vljRgKviTHYsDV5sgLm5fLA8DqNHkJ-26wpBEscenes-app-replay-vision--usage-tab--light:hash: v1.k794b7964.2ef3c1068703daaae8c960f5efde14f65aa0a0db64a5125d06beca44abd35433.H06_UO_8eRcWCyB1p55hCLxFFDlj-5Av13ZGRDpbPaQ+ scenes-app-replay-vision-observations-tab-in-the-player--scans-without-a-summary--dark:+ hash: v1.k794b7964.69709fc1011adf21683f1c5a93607ad670699c103869fb15a79b631444b9797a.pjykbCn7EfwuCIFjrj0XsUH7N1KHIXkY5Z2jmjgb3Lk+ scenes-app-replay-vision-observations-tab-in-the-player--scans-without-a-summary--light:+ hash: v1.k794b7964.f03d17836d474260696ee9b0dbe75e4dbc1637ac37fe8a830081b4cd95e060f0.SVWM3NTyYoqlXNqZf39SUAs6dfdOatK1ucfwRJibnZ8+ scenes-app-replay-vision-observations-tab-in-the-player--timeline-with-scans--dark:+ hash: v1.k794b7964.97c9e49a8217962497ffbda5c004cd0069b5a115a98872f724c85446c5d568a4.SSD4MfAskMOFmj6XeCTXbuLxFlgMory8Ws6NPJzNaVI+ scenes-app-replay-vision-observations-tab-in-the-player--timeline-with-scans--light:+ hash: v1.k794b7964.f93b12b8e199f41e6df50dc5767d59d421673be2b4d271ab241441d8e0f97002.vEx84C0WijEvCk_qb1GPjKWdZ2_PvW90ykJttEPbYXMscenes-app-replay-vision-observationthumbnail--frame--dark:hash: v1.k794b7964.25e0fc3a30206636572afe40dc1dece511909b329125acdd76d5cd6b70e4cebd.vUNWqzn2OcfR4oaaUWZaXz4aKxivNKx8scF34tw7JEEscenes-app-replay-vision-observationthumbnail--frame--light:@@ -12563,21 +12579,21 @@ snapshots:scenes-app-replay-vision-recordingtimeline--medium-recording-with-scans--light:hash: v1.k794b7964.51e6e67b5266789e678498a466586787af05739bec32c7658dde45905d8a1cf0.BlnYjegsM_hjqQLRMB-eiz6fc3yAMIrS1AlmM029jS4scenes-app-replay-vision-recordingtimeline--one-scan-no-summary--dark:- hash: v1.k794b7964.7a797b048f18259d51bbb61409d961bebe67e989e14450b012785796aef3f0ff.YmD9NFpiI-fkinozTKl6wrGH74H1CY6_4m9JsfQBMsk+ hash: v1.k794b7964.f5d45d67e9a7f4594c18238d76a095eea8d8359608ed1e87bff99b9433c9f329.L3twGnnAkxaIDyo8Df2890KhQF7ndI5_tSFiQnBYQ68scenes-app-replay-vision-recordingtimeline--one-scan-no-summary--light:- hash: v1.k794b7964.ee642d929551e335580ca212353fb62ba7f27640558dc0ec93a16243c11733e8.dXgtpRprHyAv0Ed1v5eL4bOu9_Hne-kw23mdSqGFbLY+ hash: v1.k794b7964.ebd95dae2c23e69c397c2a26f3d1fd2f0182dd2a5459941c19d1156914927cb1.0W4SpnxjWsRy22QTOk-YTs3yVfj74shrRdtHkqIF2EAscenes-app-replay-vision-recordingtimeline--short-recording-summary-only--dark:hash: v1.k794b7964.fda12edf03edbc5e2e20f8c2a6ab80b7d1b1d807d668c6f80d3fc900915edf26.Z2T5FhsfpDpSCuOs0REv-IsBhf2rSmcM74xKb9dP0dMscenes-app-replay-vision-recordingtimeline--short-recording-summary-only--light:hash: v1.k794b7964.43c1e3bc81d9ed38bc7c556710bf9a017d137f5571206cc318b3a239cdedfd7a.MJQvCUblaQfiZBUv_lWmoDWBuYhHwxbbHI0_549uA40- scenes-app-replay-vision-recordingtimeline--summary-from-before-breakdowns--dark:- hash: v1.k794b7964.24a1ff1392ac386c427c67fd17001666fd4b45fe2a98714c762c1ede8d6a5bee.0G6QHJ7iN6BNHH5R-aAqiDtU9azuQtAgQIZ-0r0MXug- scenes-app-replay-vision-recordingtimeline--summary-from-before-breakdowns--light:- hash: v1.k794b7964.dd57548ef167a241b4640475c1b678d4e48016e5c468e96263ed6985d4b0e9d1.jVbfu2YWiSVVlvYUefcaZ5X4swQzd4gol6Jnm1rw5zA+ scenes-app-replay-vision-recordingtimeline--summary-from-before-timelines--dark:+ hash: v1.k794b7964.2523abf9fef10be38aeb39baaf563fc7fed9344b60c6998711654a802bd0deb1.NN6jw-y9OyxscEyRWUu-gPeYE1kapfnBlqOWEyNKe1o+ scenes-app-replay-vision-recordingtimeline--summary-from-before-timelines--light:+ hash: v1.k794b7964.7c7605e0e2552aa50d7c9fbfa05dc8654d4553429d5be40211e844b193c1b5c5.ONzz02VNql2y01HaeudumlMoXp4lxKEqBX84qRicO1Qscenes-app-replay-vision-recordingtimeline--summary-in-progress--dark:- hash: v1.k794b7964.02b563e162ad594ce42807ab9f6527dd0b0a94d076f5e376af4aa1c9e0262747.bEOm8Ud6DvSsOnHKkdJqJRO0GoAVFotQDphesBy1s3g+ hash: v1.k794b7964.b2557dbd80a868b3e49dd6ec1700479841705603a6e3e9fc847fc08e6e61772b.BgJDEcIRXddr1uZXjmSaFvRlvPYdksiY7OUFobO1Vcwscenes-app-replay-vision-recordingtimeline--summary-in-progress--light:- hash: v1.k794b7964.2025c9acd9d06dbb0568ff23882c29b23e7ace5ac63a2fa09102ca039b37c0b6.JRxISHQLRnBhFg_FMN_BFXtJgymUQtTiVJyIRGX32-8+ hash: v1.k794b7964.a8876a0e6a7b73cb3bb01ad0b857a4546f659445459079ea7415791522914cbe._Bw9S8ylzkVPwoN_FUAd6NMPha0WBlGJiqzvnhrid-Uscenes-app-replay-vision-recordingtimeline--summary-with-idle-chapters-from-before-inactive-periods--dark:hash: v1.k794b7964.cd013789e544963b8d95bf1d4eacee9b8b4336960e9f4735583d7d9ff353d10d.yD-t6X-ZsnRGTCeHoDB8kgvMnf1dU1G-_waP6cZOmGAscenes-app-replay-vision-recordingtimeline--summary-with-idle-chapters-from-before-inactive-periods--light:diff --git a/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.stories.tsx b/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.stories.tsxnew file mode 100644index 000000000000..b5ce466643d7--- /dev/null+++ b/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.stories.tsx@@ -0,0 +1,159 @@+import { Meta, StoryObj } from '@storybook/react'+import { combineUrl } from 'kea-router'++import { App } from 'scenes/App'+import recordingEventsJson from 'scenes/session-recordings/__mocks__/recording_events_query'+import { recordingMetaJson } from 'scenes/session-recordings/__mocks__/recording_meta'+import { snapshotsAsJSONLines } from 'scenes/session-recordings/__mocks__/recording_snapshots'+import { recordings } from 'scenes/session-recordings/__mocks__/recordings'+import { urls } from 'scenes/urls'++import { mswDecorator } from '~/mocks/browser'+import { sessionFrameResponse } from '~/mocks/fixtures/sessionFrame'+import { SessionRecordingSidebarTab } from '~/types'++import { waitFor } from 'storybook/test'++import {+ MEDIUM,+ MEDIUM_INACTIVE,+ checkoutMonitor,+ frustrationScorer,+ intentClassifier,+ summary,+} from '../__mocks__/recordingTimelineObservations'+import type { ReplayObservationApi } from '../generated/api.schemas'++const SESSION_ID = recordings[0].id++const quota = {+ credit_limit: 10000,+ credits_used: 2400,+ remaining: 7600,+ exhausted: false,+ projected_monthly_credits: 5200,+ scanners_monthly_credits: 5200,+ backfills_committed_credits: 0,+ free_monthly_credits: 2500,+ credits_settled: 2400,+ credits_reserved: 0,+ period_start: '2026-10-01T00:00:00Z',+ period_end: '2026-11-01T00:00:00Z',+}++// The mock recording lasts 11 seconds, so key moments sit inside it to land on the seekbar.+const monitorWithReasoning = ((): ReplayObservationApi => {+ const monitor = checkoutMonitor(5_000)+ const output = monitor.scanner_result!.model_output as Record<string, unknown>+ return {+ ...monitor,+ scanner_result: {+ ...monitor.scanner_result!,+ model_output: {+ ...output,+ reasoning:+ 'The user applied a discount code twice, then the payment form rejected their card. They retried with a second card before the order went through.',+ },+ },+ } as ReplayObservationApi+})()++const playerMocks = (observations: ReplayObservationApi[]): ReturnType<typeof mswDecorator> =>+ mswDecorator({+ get: {+ '/api/environments/:team_id/session_recordings': { has_next: false, results: recordings, version: 1 },+ '/api/environments/:team_id/session_recordings/:id/snapshots': ({ request }) => {+ if (new URL(request.url).searchParams.get('source') === 'blob_v2') {+ return new Response(snapshotsAsJSONLines())+ }+ return [+ 200,+ {+ sources: [+ {+ source: 'blob_v2',+ start_timestamp: '2023-08-11T12:03:36.097000Z',+ end_timestamp: '2023-08-11T12:04:52.268000Z',+ blob_key: '0',+ },+ ],+ },+ ]+ },+ '/api/environments/:team_id/session_recordings/:id': recordingMetaJson,+ '/api/projects/:team_id/session_recording_playlists': { count: 0, results: [] },+ '/api/projects/:team_id/vision/observations/': {+ count: observations.length,+ next: null,+ previous: null,+ results: observations.map((o) => ({ ...o, session_id: SESSION_ID })),+ },+ '/api/projects/:team_id/vision/observations/:id/thumbnail/': () => sessionFrameResponse(),+ '/api/projects/:team_id/vision/scanners/': { count: 0, next: null, previous: null, results: [] },+ '/api/projects/:team_id/vision/quota/': quota,+ },+ // The player marks the recording viewed once it loads.+ patch: {+ '/api/projects/:team_id/session_recordings/:id/': recordingMetaJson,+ '/api/environments/:team_id/session_recordings/:id/': recordingMetaJson,+ },+ post: {+ '/api/environments/:team_id/query/:kind': async ({ request }) => {+ const body = (await request.json()) as Record<string, any>+ if (body.query.kind === 'EventsQuery' && body.query.properties?.length === 1) {+ return Response.json(recordingEventsJson)+ }+ return Response.json({ results: [] })+ },+ },+ })++const meta: Meta = {+ component: App,+ title: 'Scenes-App/Replay Vision/Observations tab in the player',+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ mockDate: '2026-10-02',+ pageUrl: combineUrl(urls.replay(), {+ sessionRecordingId: SESSION_ID,+ sidebarTab: SessionRecordingSidebarTab.OBSERVATIONS,+ inspectorSideBar: true,+ pause: true,+ t: 1,+ }).url,+ waitForSelector: '[data-attr=vision-observations-tab]',+ testOptions: { waitForLoadersToDisappear: false },+ },+ // The player shows its controls for a moment after loading, so a snapshot taken then would flip between runs.+ play: async () => {+ await waitFor(+ () => {+ if (!document.querySelector('.PlayerSeekbar')?.closest('.invisible')) {+ throw new Error('The player controls are still showing')+ }+ },+ { timeout: 10000 }+ )+ },+}+export default meta++type Story = StoryObj<{}>++// The timeline, an opened observation showing its reasoning, and two scans sharing one seekbar mark.+export const TimelineWithScans: Story = {+ decorators: [+ playerMocks([+ monitorWithReasoning,+ summary({ chapters: MEDIUM, inactive: MEDIUM_INACTIVE }),+ frustrationScorer(5_000),+ intentClassifier(8_000),+ ]),+ ],+}++// Without a summary the timeline section offers only the summarize button.+export const ScansWithoutASummary: Story = {+ decorators: [playerMocks([checkoutMonitor(5_000), frustrationScorer(8_000)])],+}diff --git a/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.tsx b/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.tsxindex 0a1b4fda400b..ccb32ec78242 100644--- a/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.tsx+++ b/products/replay_vision/frontend/components/PlayerSidebarObservationsTab.tsx@@ -363,7 +363,8 @@ function ObservationsTabContent({ sessionId }: { sessionId: string }): JSX.Eleme}, [currentIndex, followMoments])return (- <div className="flex flex-col flex-1 min-h-0" data-attr="vision-observations-tab">+ // A container, so long observation text wraps at the sidebar's width instead of widening the sidebar.+ <div className="@container flex flex-col flex-1 min-h-0" data-attr="vision-observations-tab">{observationsLoading && observations.length === 0 ? (<div className="flex items-center gap-2 text-muted p-4"><Spinner /> Loading observations…@@ -419,7 +420,7 @@ function ObservationsTabContent({ sessionId }: { sessionId: string }): JSX.Eleme)}</div><div className="flex-1 min-h-0 overflow-y-auto" ref={timelineRef}>- <SectionHeader label="Breakdown" />+ <SectionHeader label="Timeline" /><RecordingTimelinetimeline={timeline}rows={timelineRows}diff --git a/products/replay_vision/frontend/components/RecordingTimeline.stories.tsx b/products/replay_vision/frontend/components/RecordingTimeline.stories.tsxindex d0acb37756a5..36ce0e225629 100644--- a/products/replay_vision/frontend/components/RecordingTimeline.stories.tsx+++ b/products/replay_vision/frontend/components/RecordingTimeline.stories.tsx@@ -65,7 +65,7 @@ export const SummaryInProgress: Story = {args: { observations: [summary({ status: 'running' }), checkoutMonitor(214_000)] },}-export const SummaryFromBeforeBreakdowns: Story = {+export const SummaryFromBeforeTimelines: Story = {render,args: { observations: [summary({}), checkoutMonitor(214_000)] },}diff --git a/products/replay_vision/frontend/components/RecordingTimeline.tsx b/products/replay_vision/frontend/components/RecordingTimeline.tsxindex 602923ccac6e..886de81db2f0 100644--- a/products/replay_vision/frontend/components/RecordingTimeline.tsx+++ b/products/replay_vision/frontend/components/RecordingTimeline.tsx@@ -43,7 +43,7 @@ function SummaryNotice({className="flex items-center gap-2 px-3 py-2 text-xs text-secondary"data-attr="vision-timeline-pending">- <Spinner className="text-sm" /> Building the breakdown of this recording…+ <Spinner className="text-sm" /> Building the timeline of this recording…</div>)}@@ -52,8 +52,8 @@ function SummaryNotice({<div className="flex flex-col items-start gap-2 px-3 py-3" data-attr="vision-timeline-cta"><span className="text-xs text-secondary">{outdated- ? 'This recording was summarized before breakdowns existed.'- : 'Summarize this recording to get a breakdown of what happened, part by part.'}+ ? 'This recording was summarized before timelines existed.'+ : 'Summarize this recording to get a timeline of what happened.'}</span><LemonButtonsize="small"@@ -64,13 +64,13 @@ function SummaryNotice({disabledReason={summarizeDisabledReason}data-attr={outdated ? 'vision-timeline-rebuild' : 'vision-timeline-summarize'}>- {outdated ? 'Rebuild the breakdown' : 'Summarize this recording'}+ {outdated ? 'Rebuild the timeline' : 'Summarize this recording'}</LemonButton></div>)}-/** The recording's breakdown on a time rail: the summary's chapters and the idle gaps between them. */+/** The recording's timeline on a rail: the summary's chapters and the idle gaps between them. */export function RecordingTimeline(props: RecordingTimelineProps): JSX.Element {const { timeline, rows, currentTimeMs, onSeek } = propsconst currentIndex = currentRowIndex(rows, currentTimeMs)diff --git a/products/replay_vision/frontend/observations/ConfidenceBadge.tsx b/products/replay_vision/frontend/observations/ConfidenceBadge.tsxnew file mode 100644index 000000000000..75c3676d2dea--- /dev/null+++ b/products/replay_vision/frontend/observations/ConfidenceBadge.tsx@@ -0,0 +1,18 @@+import { LemonTag } from '@posthog/lemon-ui'++import type { ReplayObservationApi } from '../generated/api.schemas'+import { confidenceLevel, readConfidence } from '../utils/observation'++/** The model's confidence in an observation's result, as a colored tag. */+export function ConfidenceBadge({ observation }: { observation: ReplayObservationApi }): JSX.Element | null {+ const confidence = readConfidence(observation)+ if (confidence === null) {+ return null+ }+ const { type, label } = confidenceLevel(confidence)+ return (+ <LemonTag type={type} size="small" data-attr="vision-observation-confidence">+ {`${label} confidence · ${Math.round(confidence * 100)}%`}+ </LemonTag>+ )+}diff --git a/products/replay_vision/frontend/observations/ObservationHeadline.tsx b/products/replay_vision/frontend/observations/ObservationHeadline.tsxindex 1bb122011b51..1ef6a3825ea0 100644--- a/products/replay_vision/frontend/observations/ObservationHeadline.tsx+++ b/products/replay_vision/frontend/observations/ObservationHeadline.tsx@@ -1,5 +1,5 @@import { IconCheckCircle, IconQuestion, IconSparkles, IconXCircle } from '@posthog/icons'-import { LemonTag, Tooltip } from '@posthog/lemon-ui'+import { Tooltip } from '@posthog/lemon-ui'import { LabeledRow } from '../components/LabeledRow'import { ObservationPrimaryOutput } from '../components/ObservationCard'@@ -8,14 +8,13 @@ import { configFromSnapshot, type ScorerScannerConfig } from '../replay_scannersimport {type MonitorVerdict,VERDICT_LABEL,- confidenceLevel,- readConfidence,readFixedTags,readFreeformTags,readModelOutput,readScore,readVerdict,} from '../utils/observation'+import { ConfidenceBadge } from './ConfidenceBadge'// Filled, so each category stays visible in dark mode, where a tag's outline alone fades into the card.const CATEGORY_CLASS =@@ -76,19 +75,6 @@ function scoreColor(score: number, min: number, max: number): string {: `color-mix(in oklab, var(--success) ${Math.round((position - 0.5) * 200)}%, var(--warning))`}-function ConfidenceBadge({ observation }: { observation: ReplayObservationApi }): JSX.Element | null {- const confidence = readConfidence(observation)- if (confidence === null) {- return null- }- const { type, label } = confidenceLevel(confidence)- return (- <LemonTag type={type} size="small" data-attr="vision-observation-confidence">- {`${label} confidence · ${Math.round(confidence * 100)}%`}- </LemonTag>- )-}-function HeadlineValue({observation,scannerType,@@ -175,14 +161,20 @@ function HeadlineValue({export function ObservationHeadline({observation,onSeek,+ hideLabel = false,}: {observation: ReplayObservationApionSeek: (timestampMs: number) => void+ /** For when a tab around the headline already names it. */+ hideLabel?: boolean}): JSX.Element | null {const scannerType = observation.scanner_snapshot?.scanner_typeif (!scannerType || !readModelOutput(observation)) {return null}+ if (hideLabel) {+ return <HeadlineValue observation={observation} scannerType={scannerType} onSeek={onSeek} />+ }return (// The badge sits on the heading's line, so it has the same place for every scanner type.<LabeledRowdiff --git a/products/replay_vision/frontend/observations/ObservationTimeline.tsx b/products/replay_vision/frontend/observations/ObservationTimeline.tsxnew file mode 100644index 000000000000..43ac232d9d4f--- /dev/null+++ b/products/replay_vision/frontend/observations/ObservationTimeline.tsx@@ -0,0 +1,61 @@+import { useValues } from 'kea'+import { useEffect, useMemo, useRef } from 'react'++import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'++import { RecordingTimeline } from '../components/RecordingTimeline'+import type { ReplayObservationApi } from '../generated/api.schemas'+import { currentRowIndex, recordingTimeline, timelineRows } from '../utils/recordingTimeline'++/** A summary's chapters on a time rail, following the observation page's embedded player. */+export default function ObservationTimeline({+ observation,+ playerKey,+ onSeek,+}: {+ observation: ReplayObservationApi+ playerKey: string+ onSeek: (ms: number) => void+}): JSX.Element {+ const timeline = useMemo(() => recordingTimeline([observation]), [observation])+ const { currentPlayerTime, sessionPlayerData } = useValues(+ sessionRecordingPlayerLogic({ playerKey, sessionRecordingId: observation.session_id })+ )+ // Unknown until the recording loads, and the rail leaves out its end until then.+ const durationMs = sessionPlayerData.durationMs > 0 ? sessionPlayerData.durationMs : null+ const rows = useMemo(() => timelineRows(timeline, durationMs), [timeline, durationMs])+ const currentIndex = currentRowIndex(rows, currentPlayerTime)+ const scrollRef = useRef<HTMLDivElement>(null)++ // Keeps the playing chapter in view. Scrolls only the rail's own box, so the page itself never moves.+ useEffect(() => {+ const box = scrollRef.current+ const row = box?.querySelector<HTMLElement>('[data-current-moment]')+ if (!box || !row) {+ return+ }+ const boxRect = box.getBoundingClientRect()+ const rowRect = row.getBoundingClientRect()+ if (rowRect.top < boxRect.top || rowRect.bottom > boxRect.bottom) {+ const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches+ box.scrollTo({+ top: box.scrollTop + rowRect.top - boxRect.top - boxRect.height / 3,+ behavior: reduceMotion ? 'auto' : 'smooth',+ })+ }+ }, [currentIndex])++ return (+ // Capped so a long recording scrolls inside the tab rather than stretching the column.+ <div ref={scrollRef} className="-mx-2 max-h-[min(36rem,calc(100vh-20rem))] overflow-y-auto">+ <RecordingTimeline+ timeline={timeline}+ rows={rows}+ currentTimeMs={currentPlayerTime}+ onSeek={onSeek}+ onSummarize={() => {}}+ summarizing={false}+ />+ </div>+ )+}diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsxindex 6b6cf2242c9d..f48d137cff25 100644--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx@@ -1,9 +1,9 @@import { useActions, useValues } from 'kea'import { router } from 'kea-router'-import { Suspense, useEffect, useRef, useState } from 'react'+import { Suspense, useEffect, useMemo, useRef, useState } from 'react'import { IconArrowLeft, IconArrowRight } from '@posthog/icons'-import { LemonButton, LemonCard, Link, Spinner } from '@posthog/lemon-ui'+import { LemonButton, LemonCard, LemonTabs, Link, Spinner } from '@posthog/lemon-ui'import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'@@ -23,7 +23,9 @@ import { ObservationPrompt } from '../components/ObservationPrompt'import { ReplayVisionFeedbackButton } from '../components/ReplayVisionFeedbackButton'import { configFromSnapshot } from '../replay_scanners/types'import { scannerLabel } from '../utils/observation'+import { recordingTimeline } from '../utils/recordingTimeline'import { parseNumericParam } from '../utils/urlParams'+import { ConfidenceBadge } from './ConfidenceBadge'import { ObservationDetails } from './ObservationDetails'import { ObservationFacts } from './ObservationFacts'import { ObservationHeadline } from './ObservationHeadline'@@ -43,6 +45,7 @@ import {import { replayObservationSceneLogic } from './replayObservationSceneLogic'const ObservationRecording = lazyWithRetry(() => import('./ObservationRecording'))+const ObservationTimeline = lazyWithRetry(() => import('./ObservationTimeline'))export const scene: SceneExport = {component: ReplayObservationSceneComponent,@@ -51,7 +54,8 @@ export const scene: SceneExport = {}export function ReplayObservationSceneComponent(): JSX.Element {- const { observationId } = useValues(replayObservationSceneLogic)+ const { observationId, resultTab } = useValues(replayObservationSceneLogic)+ const { setResultTab } = useActions(replayObservationSceneLogic)const { searchParams } = useValues(router)const playerRef = useRef<HTMLDivElement>(null)const [pendingSeek, setPendingSeek] = useState<{ ms: number; trigger: number } | null>(null)@@ -74,6 +78,10 @@ export function ReplayObservationSceneComponent(): JSX.Element {const { observation, observationLoading, retrying, previousObservationId, nextObservationId, neighborsPending } =useValues(observationLogic)const { retryObservation } = useActions(observationLogic)+ const hasTimeline = useMemo(+ () => (observation ? recordingTimeline([observation]).chapters.length > 0 : false),+ [observation]+ )// Filters carried over from the scanner's observations table; preserved on prev/next so// navigation (and the server-computed neighbor ids) stay within the filtered list.@@ -230,18 +238,54 @@ export function ReplayObservationSceneComponent(): JSX.Element {{observation.status === 'succeeded' && snapshot && result && (<>{/* The answer and its evidence sit closer to each other than to the rest. */}- <div className="flex flex-col gap-2">- <ObservationHeadline observation={observation} onSeek={seekEmbeddedPlayer} />- {scannerType !== 'summarizer' && reasoning && (- <LabeledRow label="Reasoning" size="medium">- <ObservationReasoning- reasoning={reasoning}- segments={reasoningSegments}- onSeek={seekEmbeddedPlayer}- />- </LabeledRow>- )}- </div>+ {hasTimeline && (+ <LemonTabs+ size="small"+ activeKey={resultTab}+ onChange={setResultTab}+ tabs={[+ {+ key: 'summary',+ label: 'Summary',+ 'data-attr': 'vision-observation-tab-summary',+ },+ {+ key: 'timeline',+ label: 'Timeline',+ 'data-attr': 'vision-observation-tab-timeline',+ },+ ]}+ barClassName="!mb-0"+ rightSlot={<ConfidenceBadge observation={observation} />}+ rightSlotClassName="bg-transparent pr-0"+ />+ )}+ {hasTimeline && resultTab === 'timeline' ? (+ <Suspense fallback={<Spinner />}>+ <ObservationTimeline+ observation={observation}+ playerKey={playerKey}+ onSeek={seekEmbeddedPlayer}+ />+ </Suspense>+ ) : (+ <div className="flex flex-col gap-2">+ <ObservationHeadline+ observation={observation}+ onSeek={seekEmbeddedPlayer}+ hideLabel={hasTimeline}+ />+ {scannerType !== 'summarizer' && reasoning && (+ <LabeledRow label="Reasoning" size="medium">+ <ObservationReasoning+ reasoning={reasoning}+ segments={reasoningSegments}+ onSeek={seekEmbeddedPlayer}+ />+ </LabeledRow>+ )}+ </div>+ )}<ObservationLabelControlobservationId={observation.id}initialLabel={observation.label}diff --git a/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts b/products/replay_vision/frontend/observations/replayObservationSceneLogic.tsindex 9d516dda0706..0de31f5e9607 100644--- a/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts+++ b/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts@@ -8,6 +8,8 @@ import { Breadcrumb } from '~/types'import type { ReplayObservationApi, VisionObservationsRetrieveParams } from '../generated/api.schemas'import { VISION_ROOT_BREADCRUMB } from '../utils/breadcrumbs'+export type ObservationResultTab = 'summary' | 'timeline'+export interface ObservationsPage {rows: ReplayObservationApi[]number: number@@ -24,6 +26,7 @@ export interface replayObservationSceneLogicValues {breadcrumbs: Breadcrumb[]observationId: stringparentBreadcrumb: Breadcrumb | null+ resultTab: ObservationResultTab}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -34,6 +37,9 @@ export interface replayObservationSceneLogicActions {setParentBreadcrumb: (parentBreadcrumb: Breadcrumb | null) => {parentBreadcrumb: Breadcrumb | null}+ setResultTab: (resultTab: ObservationResultTab) => {+ resultTab: ObservationResultTab+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -58,6 +64,7 @@ export const replayObservationSceneLogic = kea<replayObservationSceneLogicType>(// Pushed by replayObservationLogic once the observation loads. The scene's back button returns// to this crumb, so where it points decides where "back" lands.setParentBreadcrumb: (parentBreadcrumb: Breadcrumb | null) => ({ parentBreadcrumb }),+ setResultTab: (resultTab: ObservationResultTab) => ({ resultTab }),}),reducers({@@ -75,6 +82,13 @@ export const replayObservationSceneLogic = kea<replayObservationSceneLogicType>(setObservationId: () => null,},],+ // Kept across previous and next, so a reviewer can page through timelines.+ resultTab: [+ 'summary' as ObservationResultTab,+ {+ setResultTab: (_, { resultTab }) => resultTab,+ },+ ],}),selectors({diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsxindex c627ac88a322..67cf6b3f37ea 100644--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx@@ -15,6 +15,7 @@ import { StartupProgramLabel } from '~/types'import { userEvent, within } from 'storybook/test'+import { LONG, LONG_INACTIVE, summary as timelineSummary } from '../__mocks__/recordingTimelineObservations'import type {BackfillEstimateResponseApi,DraftScannerResponseApi,@@ -1960,3 +1961,33 @@ export const ScannerEditorGoalOverviewLoading: StoryObj = {},],}++// A summary that carries chapters, so the result card gains Summary and Timeline tabs.+const timelineObservationDetail = (() => {+ const withChapters = timelineSummary({ chapters: LONG, inactive: LONG_INACTIVE })+ const output = withChapters.scanner_result!.model_output as Record<string, unknown>+ return observation({+ ...observationDetail,+ id: '00000000-0000-0000-0000-0000000000d9',+ scanner_result: {+ ...observationDetail.scanner_result!,+ model_output: {+ ...(observationDetail.scanner_result!.model_output as Record<string, unknown>),+ chapters: output.chapters,+ inactive_periods: output.inactive_periods,+ },+ } as ReplayObservationApi['scanner_result'],+ media: withChapters.media,+ })+})()++export const ObservationDetailSummaryWithTimeline: StoryObj = observationDetailStory(timelineObservationDetail)++// The timeline tab on an hour-long recording, the only story where the rail scrolls inside the card.+export const ObservationDetailTimeline: StoryObj = {+ ...observationDetailStory(timelineObservationDetail),+ play: async ({ canvasElement }) => {+ await userEvent.click(await within(canvasElement).findByText('Timeline'))+ await within(canvasElement).findByText('Session start')+ },+}diff --git a/products/replay_vision/frontend/utils/recordingTimeline.test.ts b/products/replay_vision/frontend/utils/recordingTimeline.test.tsindex f82f619df9d1..8f6c0b422e3f 100644--- a/products/replay_vision/frontend/utils/recordingTimeline.test.ts+++ b/products/replay_vision/frontend/utils/recordingTimeline.test.ts@@ -94,13 +94,13 @@ describe('recordingTimeline', () => {it.each<{ name: string; observations: ReplayObservationApi[]; durationMs: number | null; expected: string[] }>([{- name: 'scans without a breakdown leave the rail empty',+ name: 'scans without a timeline leave the rail empty',observations: [monitor('m1', 5_000)],durationMs: 60_000,expected: [],},{- name: 'a breakdown sits between the session start and end',+ name: 'a timeline sits between the session start and end',observations: [summary({ chapters: [chapter(0, 10_000, 'A')] }), monitor('m1', 5_000)],durationMs: 60_000,expected: ['boundary start', 'chapter', 'boundary end'],