: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): observations section in the watch panel and linked issues move (#126319)
Hayne Ryu4815993b669c
diff --git a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.tsindex d323c3cdb67a..442540d77be8 100644--- a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts+++ b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts@@ -15,7 +15,7 @@ import { urls } from 'scenes/urls'import { AutoplayDirection, ReplayTabs, SessionRecordingSidebarStacking } from '~/types'-export type WatchPanelSection = 'overview'+export type WatchPanelSection = 'overview' | 'observations'export type WatchDebugDock = 'bottom' | 'right'export enum TimestampFormat {@@ -67,6 +67,9 @@ export interface playerSettingsLogicActions {dismissDebugHint: () => {value: true}+ openWatchPanelSection: (section: WatchPanelSection) => {+ section: WatchPanelSection+ }setAutoplayDirection: (autoplayDirection: AutoplayDirection) => {autoplayDirection: AutoplayDirection}@@ -125,7 +128,7 @@ export interface playerSettingsLogicActions {dock: WatchDebugDock}toggleWatchPanelSection: (section: WatchPanelSection) => {- section: 'overview'+ section: WatchPanelSection}}@@ -181,6 +184,7 @@ export const playerSettingsLogic = kea<playerSettingsLogicType>([setPreferClassicReplayLayout: (preferClassicReplayLayout: boolean) => ({ preferClassicReplayLayout }),setStaffLayoutOverride: (layout: ReplayLayout | null) => ({ layout }),toggleWatchPanelSection: (section: WatchPanelSection) => ({ section }),+ openWatchPanelSection: (section: WatchPanelSection) => ({ section }),setWatchDebugDock: (dock: WatchDebugDock) => ({ dock }),dismissDebugHint: true,setLegacyDebugLinkPending: (pending: boolean) => ({ pending }),@@ -301,6 +305,7 @@ export const playerSettingsLogic = kea<playerSettingsLogicType>([{toggleWatchPanelSection: (state, { section }) =>state.includes(section) ? state.filter((s) => s !== section) : [...state, section],+ openWatchPanelSection: (state, { section }) => (state.includes(section) ? state : [...state, section]),},],})),diff --git a/frontend/src/scenes/session-recordings/player/watch/MomentTicker.tsx b/frontend/src/scenes/session-recordings/player/watch/MomentTicker.tsxdeleted file mode 100644index 56c10dc58918..000000000000--- a/frontend/src/scenes/session-recordings/player/watch/MomentTicker.tsx+++ /dev/null@@ -1,76 +0,0 @@-import { useValues } from 'kea'--import { IconChevronRight, IconSparkles } from '@posthog/icons'-import { LemonButton } from '@posthog/lemon-ui'--import { colonDelimitedDuration } from 'lib/utils/durations'-import { replayListColumnLogic } from 'scenes/session-recordings/playlist/replayListColumnLogic'--import { observationsDockLogic } from 'products/replay_vision/frontend/logics/observationsDockLogic'-import {- momentCount,- surroundingMoments,- timelineMoments,-} from 'products/replay_vision/frontend/utils/recordingTimeline'--import { sessionRecordingPlayerLogic } from '../sessionRecordingPlayerLogic'--const formatMs = (ms: number): string => colonDelimitedDuration(ms / 1000, ms >= 3_600_000 ? 3 : 2)--export function MomentTicker({ sessionId }: { sessionId: string }): JSX.Element | null {- const { timeline } = useValues(observationsDockLogic({ sessionId }))- const { logicProps, currentPlayerTime } = useValues(sessionRecordingPlayerLogic)- const moments = timelineMoments(timeline)- if (moments.length === 0) {- return null- }- const { current, next } = surroundingMoments(moments, currentPlayerTime)- const seek = (ms: number): void => {- sessionRecordingPlayerLogic.findMounted(logicProps)?.actions.seekToTime(ms)- }-- return (- <div className="flex items-center gap-1 flex-wrap text-xs" data-attr="moment-ticker">- {current && (- <LemonButton- size="xsmall"- onClick={() => seek(current.atMs)}- data-attr="moment-ticker-current"- className="max-w-full"- >- <span className="truncate">- <span className="text-secondary tabular-nums">{formatMs(current.atMs)}</span>{' '}- <span>{current.label}</span>- </span>- </LemonButton>- )}- {next && (- <LemonButton- size="xsmall"- sideIcon={<IconChevronRight />}- onClick={() => seek(next.atMs)}- data-attr="moment-ticker-next"- className="max-w-full"- >- <span className="truncate">- <span className="text-secondary">next</span>{' '}- <span className="text-secondary tabular-nums">{formatMs(next.atMs)}</span>{' '}- <span>{next.label}</span>- </span>- </LemonButton>- )}- <LemonButton- size="xsmall"- type="tertiary"- icon={<IconSparkles />}- className="ml-auto"- onClick={() =>- replayListColumnLogic.findMounted({ logicKey: logicProps.playerKey })?.actions.setSegment('moments')- }- data-attr="moment-ticker-open-moments"- >- <span>{momentCount(timeline)}</span> moments- </LemonButton>- </div>- )-}diff --git a/frontend/src/scenes/session-recordings/player/watch/RecordingObservationsSection.tsx b/frontend/src/scenes/session-recordings/player/watch/RecordingObservationsSection.tsxnew file mode 100644index 000000000000..f11238a754d8--- /dev/null+++ b/frontend/src/scenes/session-recordings/player/watch/RecordingObservationsSection.tsx@@ -0,0 +1,54 @@+import { useActions, useValues } from 'kea'++import { IconSparkles } from '@posthog/icons'+import { LemonBadge, LemonCollapse, LemonSkeleton } from '@posthog/lemon-ui'++import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'++import { RecordingMoments } from 'products/replay_vision/frontend/components/RecordingMoments'+import { RecordingObservationsEmptyState } from 'products/replay_vision/frontend/components/RecordingObservationsEmptyState'+import { observationsDockLogic } from 'products/replay_vision/frontend/logics/observationsDockLogic'+import { momentCount } from 'products/replay_vision/frontend/utils/recordingTimeline'+import { recordingScanBlock } from 'products/replay_vision/frontend/utils/scanEligibility'++export function RecordingObservationsSection({ sessionId }: { sessionId: string }): JSX.Element {+ const { logicProps, sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)+ const { observations, hasLoadedObservations, timeline } = useValues(observationsDockLogic({ sessionId }))+ const { watchPanelOpenSections } = useValues(playerSettingsLogic)+ const { toggleWatchPanelSection } = useActions(playerSettingsLogic)+ const count = momentCount(timeline)++ const content = !hasLoadedObservations ? (+ <LemonSkeleton className="h-24 m-2" />+ ) : observations.length === 0 ? (+ <RecordingObservationsEmptyState sessionId={sessionId} scanBlock={recordingScanBlock(sessionPlayerMetaData)} />+ ) : (+ <div className="flex flex-col max-h-[60vh]">+ <RecordingMoments key={sessionId} sessionId={sessionId} playerLogicProps={logicProps} />+ </div>+ )++ return (+ <LemonCollapse+ size="small"+ panels={[+ {+ key: 'observations',+ header: (+ <span className="flex items-center gap-1.5">+ <IconSparkles />+ <span>Observations</span>+ {count > 0 && <LemonBadge.Number count={count} size="small" status="muted" />}+ </span>+ ),+ content,+ className: 'p-0',+ dataAttr: 'watch-panel-section-observations',+ },+ ]}+ activeKey={watchPanelOpenSections.includes('observations') ? 'observations' : null}+ onChange={() => toggleWatchPanelSection('observations')}+ />+ )+}diff --git a/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx b/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsxindex 1ee4ad48e8a0..c6a32768912e 100644--- a/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx+++ b/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx@@ -31,7 +31,7 @@ export function RecordingTitleBlock({ actions }: { actions?: ReactNode }): JSX.Econst { setPlaylistCollapsed } = useActions(playerSettingsLogic)const actionBar = (- <div className="shrink-0 flex items-center gap-2" data-attr="watch-panel-title-actions">+ <div className="ml-auto flex items-center gap-2 flex-wrap" data-attr="watch-panel-title-actions">{actions}<PinToPlaylistButton size="small" type="secondary" labelled /></div>@@ -68,7 +68,7 @@ export function RecordingTitleBlock({ actions }: { actions?: ReactNode }): JSX.Ereturn (<div className="flex items-start gap-3 min-w-0 flex-wrap" data-attr="watch-panel-title">{sessionPerson && <PersonIcon person={sessionPerson} size="lg" className="mr-0 shrink-0" />}- <div className="flex flex-col gap-0.5 min-w-0 flex-1">+ <div className="flex flex-col gap-0.5 min-w-0 flex-1 basis-72"><h2 className="text-base font-semibold truncate m-0 ph-no-capture">{personHref ? (<Link to={personHref} subtle data-attr="watch-panel-title-person">diff --git a/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx b/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsxindex 3e8312b593ea..72e2630365b1 100644--- a/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx+++ b/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx@@ -1,15 +1,16 @@import { useValues } from 'kea'import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'+import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'import { SummarizeRecordingBar } from 'products/replay_vision/frontend/components/SummarizeRecordingBar'import { visionSurfaceShown } from 'products/replay_vision/frontend/utils/visionSurface'import { sessionRecordingPlayerLogic } from '../sessionRecordingPlayerLogic'import { DebugModeBanner } from './DebugModeBanner'-import { MomentTicker } from './MomentTicker'import { RecordingCommentsList } from './RecordingCommentsList'import { RecordingDebugSection } from './RecordingDebugSection'+import { RecordingObservationsSection } from './RecordingObservationsSection'import { RecordingOverviewDisclosure } from './RecordingOverviewDisclosure'import { RecordingTitleBlock } from './RecordingTitleBlock'@@ -21,6 +22,7 @@ export function WatchPanel({}): JSX.Element | null {const { logicProps, sessionRecordingId } = useValues(sessionRecordingPlayerLogic)const { debugMode, watchDebugDock } = useValues(playerSettingsLogic)+ const { dataProcessingAccepted } = useValues(aiConsentLogic)if (!sessionRecordingId) {return null}@@ -29,13 +31,13 @@ export function WatchPanel({return (<div className="flex flex-col gap-4 px-1 pt-3 pb-6" data-attr="watch-panel"><DebugModeBanner />- {vision && <MomentTicker sessionId={sessionRecordingId} />}<RecordingTitleBlockactions={vision ? <SummarizeRecordingBar inline extraActions={summaryActions} /> : summaryActions}/><RecordingOverviewDisclosure /><RecordingCommentsList sessionId={sessionRecordingId} />{debugMode && watchDebugDock === 'bottom' && <RecordingDebugSection />}+ {vision && dataProcessingAccepted && <RecordingObservationsSection sessionId={sessionRecordingId} />}</div>)}diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsxindex 9abf0cc0db19..ad2fd659b079 100644--- a/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx+++ b/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx@@ -1,23 +1,9 @@import { useActions, useValues } from 'kea'import { ReactNode, useEffect } from 'react'-import { IconSparkles } from '@posthog/icons'-import { LemonBadge, LemonSegmentedButton, Spinner } from '@posthog/lemon-ui'--import { colonDelimitedDuration } from 'lib/utils/durations'-import { SessionRecordingPlayerLogicProps } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'--import { SessionRecordingType } from '~/types'--import { PersonIcon } from 'products/persons/frontend/components/PersonDisplay'-import { asDisplay } from 'products/persons/frontend/person-utils'-import { RecordingMoments } from 'products/replay_vision/frontend/components/RecordingMoments'-import { observationsDockLogic } from 'products/replay_vision/frontend/logics/observationsDockLogic'-import { momentCount } from 'products/replay_vision/frontend/utils/recordingTimeline'+import { LemonBadge, LemonSegmentedButton } from '@posthog/lemon-ui'import { ReplayListPicksMode, ReplayListSegment, replayListColumnLogic } from './replayListColumnLogic'-import { sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'-import { usePlayerMounted } from './usePlayerMounted'export interface ReplayListColumnProps {logicKey: string@@ -29,48 +15,22 @@ export interface ReplayListColumnProps {onPicksSelected?: (selected: boolean) => void}-export function ReplayListColumn(props: ReplayListColumnProps): JSX.Element {- const { activeSessionRecording } = useValues(sessionRecordingsPlaylistLogic)- return activeSessionRecording ? (- <ReplayListColumnForRecording {...props} recording={activeSessionRecording} />- ) : (- <ReplayListColumnView {...props} recording={null} momentsAvailable={null} />- )-}--/** Scans shows once the recording has an observation or a summary on the way, so an empty pane never opens. */-function ReplayListColumnForRecording({- recording,- ...props-}: ReplayListColumnProps & { recording: SessionRecordingType }): JSX.Element {- const { observations, summarizePending, hasLoadedObservations } = useValues(- observationsDockLogic({ sessionId: recording.id })- )- const momentsAvailable = observations.length > 0 || summarizePending ? true : hasLoadedObservations ? false : null- return <ReplayListColumnView {...props} recording={recording} momentsAvailable={momentsAvailable} />-}--function ReplayListColumnView({+export function ReplayListColumn({logicKey,recordingsList,picksList,picksMode,unwatchedPicksCount = 0,onPicksSelected,- recording,- momentsAvailable,-}: ReplayListColumnProps & { recording: SessionRecordingType | null; momentsAvailable: boolean | null }): JSX.Element {+}: ReplayListColumnProps): JSX.Element {const logic = replayListColumnLogic({ logicKey })const { effectiveSegmentFor } = useValues(logic)const { setSegment, settleSegment } = useActions(logic)- const playerLogicProps: SessionRecordingPlayerLogicProps | null = recording- ? { playerKey: logicKey, sessionRecordingId: recording.id, watchLayout: true }- : null- const segment = effectiveSegmentFor(picksMode, momentsAvailable)+ const segment = effectiveSegmentFor(picksMode)useEffect(() => {- settleSegment(picksMode, momentsAvailable)- }, [picksMode, momentsAvailable, settleSegment])+ settleSegment(picksMode)+ }, [picksMode, settleSegment])const options = [...(picksList@@ -91,24 +51,9 @@ function ReplayListColumnView({: []),{value: 'recordings' as const,- label: picksList && momentsAvailable ? 'All' : 'All recordings',+ label: 'All recordings','data-attr': 'list-segment-recordings',},- ...(momentsAvailable && playerLogicProps- ? [- {- value: 'moments' as const,- label: (- <span className="flex items-center gap-1">- <IconSparkles />- <span>Scans</span>- <MomentsBadge sessionId={playerLogicProps.sessionRecordingId} />- </span>- ),- 'data-attr': 'list-segment-moments',- },- ]- : []),]return (@@ -128,63 +73,7 @@ function ReplayListColumnView({options={options}/>)}- <div className="flex flex-col flex-1 min-h-0">- {segment === 'picks' ? (- picksList- ) : segment === 'moments' && playerLogicProps && recording ? (- <MomentsSegment- key={recording.id}- playerLogicProps={playerLogicProps}- personDisplay={asDisplay(recording.person)}- person={recording.person}- durationSeconds={recording.recording_duration}- />- ) : (- recordingsList- )}- </div>- </div>- )-}--function MomentsBadge({ sessionId }: { sessionId: string }): JSX.Element | null {- const { timeline } = useValues(observationsDockLogic({ sessionId }))- const count = momentCount(timeline)- return count > 0 ? <LemonBadge.Number count={count} size="small" status="muted" /> : null-}--function MomentsSegment({- playerLogicProps,- personDisplay,- person,- durationSeconds,-}: {- playerLogicProps: SessionRecordingPlayerLogicProps- personDisplay: string- person: SessionRecordingType['person']- durationSeconds: number | undefined-}): JSX.Element {- const playerState = usePlayerMounted(playerLogicProps)- if (playerState === 'waiting') {- return (- <div className="flex items-center gap-2 text-muted p-4">- <Spinner /> Loading…- </div>- )- }- if (playerState === 'missing') {- return <p className="text-muted text-sm p-4 m-0">Open a recording to see its scans.</p>- }- return (- <div className="flex flex-col flex-1 min-h-0 border rounded bg-surface-primary overflow-hidden">- <div className="flex items-center gap-2 px-2 py-1.5 border-b text-xs ph-no-capture">- <PersonIcon person={person} size="sm" className="mr-0" />- <span className="font-medium truncate flex-1">{personDisplay}</span>- {durationSeconds !== undefined && (- <span className="text-secondary tabular-nums">{colonDelimitedDuration(durationSeconds)}</span>- )}- </div>- <RecordingMoments sessionId={playerLogicProps.sessionRecordingId} playerLogicProps={playerLogicProps} />+ <div className="flex flex-col flex-1 min-h-0">{segment === 'picks' ? picksList : recordingsList}</div></div>)}diff --git a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.ts b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.tsindex ac9928df7334..6ace0695d6ae 100644--- a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.ts+++ b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.ts@@ -1,9 +1,5 @@-import { expectLogic } from 'kea-test-utils'-import { initKeaTests } from '~/test/init'-import { SessionRecordingSidebarTab } from '~/types'-import { playerSidebarLogic } from '../player/sidebar/playerSidebarLogic'import { replayListColumnLogic } from './replayListColumnLogic'import { sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'@@ -17,53 +13,32 @@ describe('replayListColumnLogic', () => {})it.each([- { chosen: null, picksMode: null, moments: false, expected: 'recordings' },- { chosen: null, picksMode: 'picks', moments: false, expected: 'picks' },- { chosen: null, picksMode: 'picks', moments: true, expected: 'picks' },- { chosen: null, picksMode: null, moments: true, expected: 'recordings' },- { chosen: 'recordings', picksMode: null, moments: true, expected: 'recordings' },- { chosen: 'picks', picksMode: null, moments: false, expected: 'recordings' },- { chosen: 'moments', picksMode: 'picks', moments: true, expected: 'moments' },- { chosen: 'moments', picksMode: 'picks', moments: false, expected: 'recordings' },- { chosen: 'moments', picksMode: null, moments: null, expected: 'recordings' },- { chosen: 'recordings', picksMode: 'picks', moments: true, expected: 'recordings' },- ] as const)(- 'chosen $chosen with picks $picksMode and moments $moments shows $expected',- ({ chosen, picksMode, moments, expected }) => {- if (chosen) {- logic.actions.setSegment(chosen)- }- expect(logic.values.effectiveSegmentFor(picksMode, moments)).toBe(expected)+ { chosen: null, picksMode: null, expected: 'recordings' },+ { chosen: null, picksMode: 'picks', expected: 'picks' },+ { chosen: 'recordings', picksMode: 'picks', expected: 'recordings' },+ { chosen: 'picks', picksMode: null, expected: 'recordings' },+ ] as const)('chosen $chosen with picks $picksMode shows $expected', ({ chosen, picksMode, expected }) => {+ if (chosen) {+ logic.actions.setSegment(chosen)}- )+ expect(logic.values.effectiveSegmentFor(picksMode)).toBe(expected)+ })it.each([- { chosen: 'moments', picksMode: null, moments: null, kept: 'moments' },- { chosen: 'moments', picksMode: null, moments: true, kept: 'moments' },- { chosen: 'moments', picksMode: null, moments: false, kept: null },- { chosen: 'picks', picksMode: 'picks', moments: null, kept: 'picks' },- { chosen: 'picks', picksMode: null, moments: null, kept: null },- ] as const)(- 'chosen $chosen settles to $kept with picks $picksMode and moments $moments',- ({ chosen, picksMode, moments, kept }) => {- logic.actions.setSegment(chosen)- logic.actions.settleSegment(picksMode, moments)- expect(logic.values.segment).toBe(kept)- }- )+ { picksMode: 'picks', kept: 'picks' },+ { picksMode: null, kept: null },+ ] as const)('a picks choice settles to $kept with picks $picksMode', ({ picksMode, kept }) => {+ logic.actions.setSegment('picks')+ logic.actions.settleSegment(picksMode)+ expect(logic.values.segment).toBe(kept)+ })it('shows the recordings when its list is filtered to a person', () => {const playlistLogicProps = { logicKey: 'person' }const column = replayListColumnLogic({ logicKey: 'person', playlistLogicProps })column.mount()- column.actions.setSegment('moments')+ column.actions.setSegment('picks')sessionRecordingsPlaylistLogic(playlistLogicProps).actions.filterByPerson('p')expect(column.values.segment).toBe('recordings')})-- it('switches to moments when something asks for the observations tab', async () => {- await expectLogic(logic, () => {- playerSidebarLogic.actions.setTab(SessionRecordingSidebarTab.OBSERVATIONS)- }).toMatchValues({ segment: 'moments' })- })})diff --git a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.ts b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.tsindex 51b2c753de05..95c2f6ff63b5 100644--- a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.ts+++ b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.ts@@ -1,14 +1,10 @@-import { MakeLogicType, actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'+import { MakeLogicType, actions, kea, key, listeners, path, props, reducers, selectors } from 'kea'import posthog from 'posthog-js'-import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'--import { SessionRecordingSidebarTab } from '~/types'-import { SessionRecordingPlaylistLogicProps, sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'-export type ReplayListSegment = 'picks' | 'recordings' | 'moments'-export type ReplayListSegmentSource = 'user' | 'observations' | 'person-filter'+export type ReplayListSegment = 'picks' | 'recordings'+export type ReplayListSegmentSource = 'user' | 'person-filter'export type ReplayListPicksMode = 'picks' | 'recordings' | null// A column built without its list, as the tests and findMounted callers do, listens to nothing.@@ -25,15 +21,12 @@ export interface ReplayListColumnLogicProps {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface replayListColumnLogicValues {- effectiveSegmentFor: (picksMode: ReplayListPicksMode, momentsAvailable: boolean | null) => ReplayListSegment+ effectiveSegmentFor: (picksMode: ReplayListPicksMode) => ReplayListSegmentsegment: ReplayListSegment | null}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface replayListColumnLogicActions {- setSidebarTab: (tab: SessionRecordingSidebarTab) => {- tab: SessionRecordingSidebarTab- } // playerSidebarLogicdropSegmentChoice: () => {value: true}@@ -44,11 +37,7 @@ export interface replayListColumnLogicActions {segment: ReplayListSegmentsource: ReplayListSegmentSource}- settleSegment: (- picksMode: ReplayListPicksMode,- momentsAvailable: boolean | null- ) => {- momentsAvailable: boolean | null+ settleSegment: (picksMode: ReplayListPicksMode) => {picksMode: ReplayListPicksMode}}@@ -59,7 +48,7 @@ export interface replayListColumnLogicMeta {__keaTypeGenInternalSelectorTypes: {effectiveSegmentFor: (segment: ReplayListSegment | null- ) => (picksMode: ReplayListPicksMode, momentsAvailable: boolean | null) => ReplayListSegment+ ) => (picksMode: ReplayListPicksMode) => ReplayListSegment}}@@ -74,17 +63,11 @@ export const replayListColumnLogic = kea<replayListColumnLogicType>([path((key) => ['scenes', 'session-recordings', 'playlist', 'replayListColumnLogic', key]),props({} as ReplayListColumnLogicProps),key((props) => props.logicKey),- connect(() => ({- actions: [playerSidebarLogic, ['setTab as setSidebarTab']],- })),actions({setSegment: (segment: ReplayListSegment, source: ReplayListSegmentSource = 'user') => ({ segment, source }),// Or the choice resurfaces on a later recording.dropSegmentChoice: true,- settleSegment: (picksMode: ReplayListPicksMode, momentsAvailable: boolean | null) => ({- picksMode,- momentsAvailable,- }),+ settleSegment: (picksMode: ReplayListPicksMode) => ({ picksMode }),}),reducers({// Null until the viewer picks one, so the picks logic keeps deciding where a fresh page lands.@@ -97,15 +80,9 @@ export const replayListColumnLogic = kea<replayListColumnLogicType>([effectiveSegmentFor: [(s) => [s.segment],(segment: ReplayListSegment | null) =>- (picksMode: ReplayListPicksMode, momentsAvailable: boolean | null): ReplayListSegment => {+ (picksMode: ReplayListPicksMode): ReplayListSegment => {const chosen = segment ?? picksMode ?? 'recordings'- if (chosen === 'picks' && picksMode === null) {- return 'recordings'- }- if (chosen === 'moments' && !momentsAvailable) {- return 'recordings'- }- return chosen+ return chosen === 'picks' && picksMode === null ? 'recordings' : chosen},],}),@@ -118,17 +95,10 @@ export const replayListColumnLogic = kea<replayListColumnLogicType>([setSegment: ({ segment, source }) => {posthog.capture('session recording list segment changed', { segment, source })},- settleSegment: ({ picksMode, momentsAvailable }) => {- const chosen = values.segment- if ((chosen === 'picks' && picksMode === null) || (chosen === 'moments' && momentsAvailable === false)) {+ settleSegment: ({ picksMode }) => {+ if (values.segment === 'picks' && picksMode === null) {actions.dropSegmentChoice()}},- // Summarize and View details still ask for the Observations tab. In this layout that content is the Moments segment.- setSidebarTab: ({ tab }) => {- if (tab === SessionRecordingSidebarTab.OBSERVATIONS && values.segment !== 'moments') {- actions.setSegment('moments', 'observations')- }- },})),])diff --git a/frontend/src/scenes/session-recordings/playlist/usePlayerMounted.ts b/frontend/src/scenes/session-recordings/playlist/usePlayerMounted.tsdeleted file mode 100644index ae7f110c856a..000000000000--- a/frontend/src/scenes/session-recordings/playlist/usePlayerMounted.ts+++ /dev/null@@ -1,26 +0,0 @@-import { useEffect, useState } from 'react'--import {- SessionRecordingPlayerLogicProps,- sessionRecordingPlayerLogic,-} from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'--const PLAYER_MOUNT_WAIT_FRAMES = 20--export type PlayerMountState = 'mounted' | 'waiting' | 'missing'--// The list column renders before the keyed player in the same commit, so the first frame after a recording changes-// finds no instance. Building one here would start a second player, so wait a few frames, and give up when the host-// renders no player at all.-export function usePlayerMounted(playerLogicProps: SessionRecordingPlayerLogicProps): PlayerMountState {- const [attempts, setAttempts] = useState(0)- const mounted = !!sessionRecordingPlayerLogic.findMounted(playerLogicProps)- useEffect(() => {- if (mounted || attempts >= PLAYER_MOUNT_WAIT_FRAMES) {- return- }- const frame = requestAnimationFrame(() => setAttempts((n) => n + 1))- return () => cancelAnimationFrame(frame)- }, [mounted, attempts])- return mounted ? 'mounted' : attempts >= PLAYER_MOUNT_WAIT_FRAMES ? 'missing' : 'waiting'-}diff --git a/products/replay_vision/frontend/components/DocsLink.tsx b/products/replay_vision/frontend/components/DocsLink.tsxindex 5200830a7156..4ed01f87c96c 100644--- a/products/replay_vision/frontend/components/DocsLink.tsx+++ b/products/replay_vision/frontend/components/DocsLink.tsx@@ -20,18 +20,20 @@ export function visionDocsUrl(page?: VisionDocsPage): string {/** Docs link for replay vision surfaces. Opens in a new tab so the user keeps their place in the app. */export function VisionDocsLink({page,+ anchor,dataAttr,onClick,children,}: {page?: VisionDocsPage+ anchor?: stringdataAttr: stringonClick?: () => voidchildren: React.ReactNode}): JSX.Element {return (<Link- to={`${visionDocsUrl(page)}?utm_medium=in-product&utm_campaign=empty-state-docs-link`}+ to={`${visionDocsUrl(page)}?utm_medium=in-product&utm_campaign=empty-state-docs-link${anchor ? `#${anchor}` : ''}`}target="_blank"onClick={onClick}data-attr={dataAttr}diff --git a/products/replay_vision/frontend/components/RecordingMoments.tsx b/products/replay_vision/frontend/components/RecordingMoments.tsxindex 2aae5c3c28ea..ecd2bb4ea620 100644--- a/products/replay_vision/frontend/components/RecordingMoments.tsx+++ b/products/replay_vision/frontend/components/RecordingMoments.tsx@@ -2,11 +2,10 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { useEffect, useMemo, useRef } from 'react'-import { IconChevronDown, IconChevronRight, IconEye } from '@posthog/icons'-import { LemonButton, LemonInput, LemonSwitch, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'+import { IconChevronRight } from '@posthog/icons'+import { LemonButton, LemonSwitch, LemonTag, Link, Spinner, Tooltip } from '@posthog/lemon-ui'import { useResizeObserver } from 'lib/hooks/useResizeObserver'-import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown/LemonDropdown'import { cn } from 'lib/utils/css-classes'import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'import {@@ -14,9 +13,8 @@ import {sessionRecordingPlayerLogic,} from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'import { playerUsesWatchLayout } from 'scenes/session-recordings/playlist/replayLayout'-import { urls } from 'scenes/urls'-import type { ReplayObservationApi, ReplayScannerApi } from '../generated/api.schemas'+import type { ReplayObservationApi } from '../generated/api.schemas'import { observationsDockLogic } from '../logics/observationsDockLogic'import { visionQuotaLogic } from '../logics/visionQuotaLogic'import { SCANNER_TYPE_TAG_TYPE, scannerTypeLabel } from '../replay_scanners/types'@@ -24,7 +22,7 @@ import { RECORDING_ORIGIN, currentReturnPath, observationFromOriginUrl } from '.import { isSummaryObservation, readModelOutput, readReasoning, scannerLabel } from '../utils/observation'import { quotaUx } from '../utils/quotaProjection'import { currentRowIndex, nextTimelineStopMs, timelineRows as buildTimelineRows } from '../utils/recordingTimeline'-import { ScanBlock, recordingScanBlock } from '../utils/scanEligibility'+import { recordingScanBlock } from '../utils/scanEligibility'import { CitedMarkdown } from './CitedMarkdown'import {FailureDetail,@@ -36,100 +34,8 @@ import {import { ObservationProgressBar } from './ObservationProgressBar'import { ObservationRetryButton } from './ObservationRetryButton'import { RecordingTimeline } from './RecordingTimeline'-import { ScannerTypeBadge, scannerTypeIcon } from './ScannerTypeBadge'--function ScannerPicker({- sessionId,- scanBlock,- type = 'primary',- placement = 'bottom-start',-}: {- sessionId: string- scanBlock: ScanBlock | null- type?: 'primary' | 'secondary'- placement?: 'bottom-start' | 'top-start'-}): JSX.Element {- const logic = observationsDockLogic({ sessionId })- const { scanners, scannersLoading, filteredScanners, scannerSearch, scannerPickerOpen, observing } =- useValues(logic)- const { observe, setScannerSearch, setScannerPickerOpen } = useActions(logic)- const { quota } = useValues(visionQuotaLogic)- const { disabledReason: quotaDisabledReason, tooltip: quotaTooltip } = quotaUx(quota)-- return (- <LemonDropdown- visible={scannerPickerOpen}- onVisibilityChange={setScannerPickerOpen}- closeOnClickInside={false}- placement={placement}- overlay={- <div className="w-80">- <div className="p-1 border-b">- <LemonInput- data-attr="vision-observations-tab-search"- type="search"- size="small"- placeholder="Search scanners…"- value={scannerSearch}- onChange={setScannerSearch}- autoFocus- />- </div>- <div className="max-h-80 overflow-y-auto p-1">- {scanners.length === 0 && scannersLoading ? (- <div className="flex items-center gap-2 px-2 py-3 text-sm text-muted">- <Spinner /> Loading scanners…- </div>- ) : scanners.length === 0 ? (- <Link- data-attr="vision-observations-open-scanners"- to={urls.replayVision()}- target="_blank"- className="block px-2 py-3 text-sm"- >- No scanners yet. Create one- </Link>- ) : filteredScanners.length === 0 ? (- <div className="px-2 py-3 text-sm text-muted">No scanners match your search.</div>- ) : (- filteredScanners.map((scanner: ReplayScannerApi) => (- <LemonButton- key={scanner.id}- fullWidth- size="small"- onClick={() => observe(scanner.id)}- disabledReason={observing ? 'Starting an observation…' : undefined}- data-attr="vision-scan-pick-scanner"- data-ph-capture-attribute-scanner-type={scanner.scanner_type}- >- <span className="flex items-center justify-between gap-2 w-full">- <span className="truncate">{scanner.name}</span>- <span className="shrink-0">- <ScannerTypeBadge scannerType={scanner.scanner_type} size="small" />- </span>- </span>- </LemonButton>- ))- )}- </div>- </div>- }- >- <LemonButton- size="small"- type={type}- icon={<IconEye />}- sideIcon={<IconChevronDown />}- loading={observing}- disabledReason={scanBlock?.reason ?? quotaDisabledReason}- tooltip={quotaTooltip}- data-attr="vision-scan-recording"- >- Scan this recording- </LemonButton>- </LemonDropdown>- )-}+import { ScannerPicker } from './ScannerPicker'+import { scannerTypeIcon } from './ScannerTypeBadge'const CURRENT_MOMENT_SELECTOR = '[data-current-moment]'@@ -315,7 +221,6 @@ export interface RecordingMomentsProps {playerLogicProps: SessionRecordingPlayerLogicProps}-/** The chapter timeline and observation runs of one recording: the Observations tab, and the Moments list segment. */export function RecordingMoments({ sessionId, playerLogicProps }: RecordingMomentsProps): JSX.Element {const logic = observationsDockLogic({ sessionId })const { observations, observationsLoading, timeline, followMoments, summarizePending } = useValues(logic)@@ -419,18 +324,33 @@ export function RecordingMoments({ sessionId, playerLogicProps }: RecordingMomen</div>)}</div>- <div className="flex-1 min-h-0 overflow-y-auto" ref={timelineRef}>- <SectionHeader label="Timeline" />- <RecordingTimeline- timeline={timeline}- rows={timelineRows}- currentTimeMs={currentPlayerTime}- onSeek={seekToTime}- onSummarize={() => summarize(inWatchLayout)}- summarizing={summarizePending}- summarizeDisabledReason={scanBlock?.reason ?? quotaDisabledReason}- />- <ObservationRuns sessionId={sessionId} observations={observations} onSeek={seekToTime} />+ <div+ className={cn(+ 'flex-1 min-h-0 overflow-y-auto grid grid-cols-1 content-start',+ inWatchLayout &&+ '@[840px]:content-stretch @[840px]:grid-cols-2 @[840px]:grid-rows-[minmax(0,1fr)] @[840px]:overflow-hidden'+ )}+ ref={timelineRef}+ >+ <div className={cn(inWatchLayout && '@[840px]:min-h-0 @[840px]:overflow-y-auto')}>+ <SectionHeader label="Timeline" />+ <RecordingTimeline+ timeline={timeline}+ rows={timelineRows}+ currentTimeMs={currentPlayerTime}+ onSeek={seekToTime}+ onSummarize={() => summarize(inWatchLayout)}+ summarizing={summarizePending}+ summarizeDisabledReason={scanBlock?.reason ?? quotaDisabledReason}+ />+ </div>+ <div+ className={cn(+ inWatchLayout && '@[840px]:min-h-0 @[840px]:overflow-y-auto @[840px]:border-l'+ )}+ >+ <ObservationRuns sessionId={sessionId} observations={observations} onSeek={seekToTime} />+ </div></div></>)}diff --git a/products/replay_vision/frontend/components/RecordingObservationsEmptyState.tsx b/products/replay_vision/frontend/components/RecordingObservationsEmptyState.tsxnew file mode 100644index 000000000000..e593dd49bdc4--- /dev/null+++ b/products/replay_vision/frontend/components/RecordingObservationsEmptyState.tsx@@ -0,0 +1,104 @@+import { useValues } from 'kea'++import * as asleepPng from '@posthog/brand/hoggies/png/asleep'+import * as magnifyingGlassPng from '@posthog/brand/hoggies/png/magnifying-glass'+import { LemonButton } from '@posthog/lemon-ui'++import { pngHoggie } from 'lib/brand/hoggies'+import { urls } from 'scenes/urls'++import { observationsDockLogic } from '../logics/observationsDockLogic'+import { HighlightPicksStateFrame } from '../replay_scanners/components/HighlightPicksStateFrame'+import { ScanBlock } from '../utils/scanEligibility'+import { VisionDocsLink } from './DocsLink'+import { ScannerPicker } from './ScannerPicker'++const HedgehogMagnifyingGlass = pngHoggie(magnifyingGlassPng)+const HedgehogAsleep = pngHoggie(asleepPng)++const SKIPPED_TITLE: Partial<Record<ScanBlock['kind'], string>> = {+ too_short: 'Too short to scan',+ too_inactive: 'Not enough activity to scan',+ too_long: 'Too long to scan',+}++const TITLE = 'No observations yet'+const BODY =+ 'Summarize this recording above for chapters and a short write-up, or run a scanner to check it for something specific.'++export function RecordingObservationsEmptyState({+ sessionId,+ scanBlock,+}: {+ sessionId: string+ scanBlock: ScanBlock | null+}): JSX.Element {+ const { scanners, scannersLoading } = useValues(observationsDockLogic({ sessionId }))++ if (scanBlock) {+ return (+ <HighlightPicksStateFrame+ size="small"+ image={HedgehogAsleep}+ title={SKIPPED_TITLE[scanBlock.kind] ?? 'Replay vision skipped this recording'}+ body={scanBlock.reason}+ dataAttr="vision-observations-skipped"+ footer={+ <VisionDocsLink+ page="running-scanners"+ anchor="ineligible-sessions"+ dataAttr="vision-observations-skipped-docs"+ >+ Which recordings can be scanned+ </VisionDocsLink>+ }+ />+ )+ }++ const noScanners = !scannersLoading && scanners.length === 0+ const actions = noScanners ? (+ <LemonButton+ type="primary"+ size="small"+ fullWidth+ center+ to={urls.replayVisionNewScanner()}+ data-attr="vision-observations-empty-create-scanner"+ >+ Create a scanner+ </LemonButton>+ ) : (+ <ScannerPicker sessionId={sessionId} scanBlock={scanBlock} fullWidth />+ )+ const footer = (+ <div className="mt-1 flex flex-wrap items-baseline justify-center gap-x-3 gap-y-1">+ {!noScanners && (+ <LemonButton+ type="tertiary"+ size="xsmall"+ to={urls.replayVisionNewScanner()}+ data-attr="vision-observations-empty-new-scanner"+ >+ Create a scanner+ </LemonButton>+ )}+ <VisionDocsLink page="observations" dataAttr="vision-observations-empty-docs">+ How observations work+ </VisionDocsLink>+ </div>+ )++ return (+ <HighlightPicksStateFrame+ size="small"+ image={HedgehogMagnifyingGlass}+ title={TITLE}+ body={BODY}+ dataAttr="vision-observations-empty"+ footer={footer}+ >+ {actions}+ </HighlightPicksStateFrame>+ )+}diff --git a/products/replay_vision/frontend/components/ScannerPicker.tsx b/products/replay_vision/frontend/components/ScannerPicker.tsxnew file mode 100644index 000000000000..b07261796d27--- /dev/null+++ b/products/replay_vision/frontend/components/ScannerPicker.tsx@@ -0,0 +1,111 @@+import { useActions, useValues } from 'kea'++import { IconChevronDown, IconEye } from '@posthog/icons'+import { LemonButton, LemonInput, Link, Spinner } from '@posthog/lemon-ui'++import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown/LemonDropdown'+import { urls } from 'scenes/urls'++import type { ReplayScannerApi } from '../generated/api.schemas'+import { observationsDockLogic } from '../logics/observationsDockLogic'+import { visionQuotaLogic } from '../logics/visionQuotaLogic'+import { quotaUx } from '../utils/quotaProjection'+import { ScanBlock } from '../utils/scanEligibility'+import { ScannerTypeBadge } from './ScannerTypeBadge'++export function ScannerPicker({+ sessionId,+ scanBlock,+ type = 'primary',+ placement = 'bottom-start',+ fullWidth = false,+}: {+ sessionId: string+ scanBlock: ScanBlock | null+ type?: 'primary' | 'secondary'+ placement?: 'bottom-start' | 'top-start'+ fullWidth?: boolean+}): JSX.Element {+ const logic = observationsDockLogic({ sessionId })+ const { scanners, scannersLoading, filteredScanners, scannerSearch, scannerPickerOpen, observing } =+ useValues(logic)+ const { observe, setScannerSearch, setScannerPickerOpen } = useActions(logic)+ const { quota } = useValues(visionQuotaLogic)+ const { disabledReason: quotaDisabledReason, tooltip: quotaTooltip } = quotaUx(quota)++ return (+ <LemonDropdown+ visible={scannerPickerOpen}+ onVisibilityChange={setScannerPickerOpen}+ closeOnClickInside={false}+ placement={placement}+ overlay={+ <div className="w-80">+ <div className="p-1 border-b">+ <LemonInput+ data-attr="vision-observations-tab-search"+ type="search"+ size="small"+ placeholder="Search scanners…"+ value={scannerSearch}+ onChange={setScannerSearch}+ autoFocus+ />+ </div>+ <div className="max-h-80 overflow-y-auto p-1">+ {scanners.length === 0 && scannersLoading ? (+ <div className="flex items-center gap-2 px-2 py-3 text-sm text-muted">+ <Spinner /> Loading scanners…+ </div>+ ) : scanners.length === 0 ? (+ <Link+ data-attr="vision-observations-open-scanners"+ to={urls.replayVision()}+ target="_blank"+ className="block px-2 py-3 text-sm"+ >+ No scanners yet. Create one+ </Link>+ ) : filteredScanners.length === 0 ? (+ <div className="px-2 py-3 text-sm text-muted">No scanners match your search.</div>+ ) : (+ filteredScanners.map((scanner: ReplayScannerApi) => (+ <LemonButton+ key={scanner.id}+ fullWidth+ size="small"+ onClick={() => observe(scanner.id)}+ disabledReason={observing ? 'Starting an observation…' : undefined}+ data-attr="vision-scan-pick-scanner"+ data-ph-capture-attribute-scanner-type={scanner.scanner_type}+ >+ <span className="flex items-center justify-between gap-2 w-full">+ <span className="truncate">{scanner.name}</span>+ <span className="shrink-0">+ <ScannerTypeBadge scannerType={scanner.scanner_type} size="small" />+ </span>+ </span>+ </LemonButton>+ ))+ )}+ </div>+ </div>+ }+ >+ <LemonButton+ size="small"+ type={type}+ fullWidth={fullWidth}+ center={fullWidth}+ icon={<IconEye />}+ sideIcon={<IconChevronDown />}+ loading={observing}+ disabledReason={scanBlock?.reason ?? quotaDisabledReason}+ tooltip={quotaTooltip}+ data-attr="vision-scan-recording"+ >+ Scan this recording+ </LemonButton>+ </LemonDropdown>+ )+}diff --git a/products/replay_vision/frontend/components/SummarizeButton.tsx b/products/replay_vision/frontend/components/SummarizeButton.tsxindex 0f787c913b40..4d3f39448609 100644--- a/products/replay_vision/frontend/components/SummarizeButton.tsx+++ b/products/replay_vision/frontend/components/SummarizeButton.tsx@@ -22,10 +22,12 @@ export function SummarizeButton({sessionId,scanBlock,inWatchLayout = false,+ fullWidth = false,}: {sessionId: stringscanBlock: ScanBlock | nullinWatchLayout?: boolean+ fullWidth?: boolean}): JSX.Element {const logic = observationsDockLogic({ sessionId })const { summarizePending, defaultSummarizer, summarizerScanners, observations } = useValues(logic)@@ -50,7 +52,7 @@ export function SummarizeButton({: 'Summarize this recording'const label = summarizePending ? 'Summarizing…' : idleLabelconst summarizerTooltip = summarizePending- ? `Watching this recording. The summary appears in the ${inWatchLayout ? 'Scans segment' : 'Observations tab'} when it is ready.`+ ? `Watching this recording. The summary appears in the ${inWatchLayout ? 'Observations section' : 'Observations tab'} when it is ready.`: defaultSummarizer? `Runs your "${defaultSummarizer.name}" scanner on this recording.`: 'Writes a summary using a built-in prompt.'@@ -87,7 +89,9 @@ export function SummarizeButton({const button = (<LemonButtonsize="small"- type={hasSummary ? 'tertiary' : 'secondary'}+ type={inWatchLayout ? (hasSummary ? 'secondary' : 'primary') : hasSummary ? 'tertiary' : 'secondary'}+ fullWidth={fullWidth}+ center={fullWidth}icon={<IconNotebook />}loading={summarizePending}// The endpoint refuses without org AI approval, so ask for it here rather than toasting a 400.diff --git a/products/replay_vision/frontend/logics/observationsDockLogic.ts b/products/replay_vision/frontend/logics/observationsDockLogic.tsindex a7f5ce453290..39c5e33e5b3b 100644--- a/products/replay_vision/frontend/logics/observationsDockLogic.ts+++ b/products/replay_vision/frontend/logics/observationsDockLogic.ts@@ -68,6 +68,11 @@ export interface observationsDockLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface observationsDockLogicActions {+ openWatchPanelSection: (+ section: import('scenes/session-recordings/player/playerSettingsLogic').WatchPanelSection+ ) => {+ section: import('scenes/session-recordings/player/playerSettingsLogic').WatchPanelSection+ } // playerSettingsLogicsetSidebarOpen: (open: boolean) => {open: boolean} // playerSettingsLogic@@ -193,7 +198,7 @@ export const observationsDockLogic = kea<observationsDockLogicType>([playerSidebarLogic,['setTab', 'setAutoTab'],playerSettingsLogic,- ['setSidebarOpen'],+ ['setSidebarOpen', 'openWatchPanelSection'],],})),@@ -374,7 +379,10 @@ export const observationsDockLogic = kea<observationsDockLogicType>([actions.loadObservations)}- const landOnExistingSummary = (): void => {+ const landOnExistingObservations = (): void => {+ if (values.observations.length > 0) {+ actions.openWatchPanelSection('observations')+ }if (values.observations.some((o) => isSummaryObservation(o) && o.status === 'succeeded')) {actions.setAutoTab(SessionRecordingSidebarTab.OBSERVATIONS)}@@ -526,7 +534,7 @@ export const observationsDockLogic = kea<observationsDockLogicType>([}if (!cache.openingLoadDone) {cache.openingLoadDone = true- landOnExistingSummary()+ landOnExistingObservations()}settleSummarizeIfDone()@@ -541,11 +549,11 @@ export const observationsDockLogic = kea<observationsDockLogicType>([},showObservations: ({ inWatchLayout }) => {- // In the watch layout the observations live in the list's Moments segment, which follows the tab change- // itself. Opening the sidebar there would switch the page into Debug mode.- if (!inWatchLayout) {- actions.setSidebarOpen(true)+ if (inWatchLayout) {+ actions.openWatchPanelSection('observations')+ return}+ actions.setSidebarOpen(true)actions.setTab(SessionRecordingSidebarTab.OBSERVATIONS)},diff --git a/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.tsindex 067c855c8da4..271edf6bf51d 100644--- a/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.test.ts@@ -2,7 +2,7 @@ import { router } from 'kea-router'import { expectLogic } from 'kea-test-utils'import posthog from 'posthog-js'-import { replayListColumnLogic } from 'scenes/session-recordings/playlist/replayListColumnLogic'+import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'import { sessionRecordingsPlaylistLogic } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'import { useMocks } from '~/mocks/jest'@@ -174,15 +174,18 @@ describe('highlightPicksLogic', () => {expect(shownEvents()).toEqual([])})- it('opens the Scans segment on every pick', async () => {- const column = replayListColumnLogic({ logicKey: 'test-picks' })- column.mount()+ it('opens the Observations section on every pick', async () => {+ const settings = playerSettingsLogic()+ settings.mount()for (const position of [0, 1]) {- column.actions.setSegment('picks')+ if (settings.values.watchPanelOpenSections.includes('observations')) {+ settings.actions.toggleWatchPanelSection('observations')+ }+ expect(settings.values.watchPanelOpenSections).not.toContain('observations')logic.actions.highlightPick(logic.values.picks![position], position)- expect(column.values.segment).toBe('moments')+ expect(settings.values.watchPanelOpenSections).toContain('observations')}- column.unmount()+ settings.unmount()})it('selects the pick, seeks ahead of its key moment, and marks it viewed for this person', async () => {diff --git a/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.ts b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.tsindex 7450c4464656..475545b372ac 100644--- a/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/highlightPicksLogic.ts@@ -19,7 +19,7 @@ import { z } from 'zod'import posthog from 'lib/posthog-typed'import { localStorageSlot } from 'lib/utils/localStorageSlot'-import { replayListColumnLogic } from 'scenes/session-recordings/playlist/replayListColumnLogic'+import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'import {SessionRecordingPlaylistLogicProps,sessionRecordingsPlaylistLogic,@@ -363,10 +363,7 @@ export const highlightPicksLogic: LogicWrapper<highlightPicksLogicType> = kea<hisessionRecordingsPlaylistLogic(props.playlistLogicProps).actions.setSelectedRecordingId(observation.session_id)- // The URL tab above is skipped when it matches the viewer's last tab.- replayListColumnLogic- .findMounted({ logicKey: props.playlistLogicProps.logicKey ?? 'playlist' })- ?.actions.setSegment('moments', 'observations')+ playerSettingsLogic.findMounted()?.actions.openWatchPanelSection('observations')if (!markViewed) {return}diff --git a/products/replay_vision/frontend/utils/recordingTimeline.test.ts b/products/replay_vision/frontend/utils/recordingTimeline.test.tsindex 64da774dad70..c81f3cb6f747 100644--- a/products/replay_vision/frontend/utils/recordingTimeline.test.ts+++ b/products/replay_vision/frontend/utils/recordingTimeline.test.ts@@ -1,5 +1,5 @@import type { ReplayObservationApi } from '../generated/api.schemas'-import { momentCount, recordingTimeline, surroundingMoments, timelineMoments, timelineRows } from './recordingTimeline'+import { momentCount, recordingTimeline, timelineRows } from './recordingTimeline'function summary(output: Record<string, unknown> | null,@@ -177,31 +177,16 @@ describe('recordingTimeline', () => {})it.each([- { name: 'nothing', observations: [], count: 0, at: 5_000, current: null, next: null },+ { name: 'nothing', observations: [], count: 0 },{- name: 'chapters and a cited moment, interleaved by time',+ name: 'chapters and a cited moment',observations: [summary({ chapters: [chapter(0, 10_000, 'A'), chapter(10_000, 20_000, 'B')] }),monitor('m1', 5_000),],count: 3,- at: 6_000,- current: 'm1: Yes',- next: 'B',},- {- name: 'before the first moment',- observations: [summary({ chapters: [chapter(1_000, 10_000, 'A')] })],- count: 1,- at: 0,- current: null,- next: 'A',- },- ])('counts and surrounds the moments of $name', ({ observations, count, at, current, next }) => {- const timeline = recordingTimeline(observations)- expect(momentCount(timeline)).toBe(count)- const around = surroundingMoments(timelineMoments(timeline), at)- expect(around.current?.label ?? null).toBe(current)- expect(around.next?.label ?? null).toBe(next)+ ])('counts the moments of $name', ({ observations, count }) => {+ expect(momentCount(recordingTimeline(observations))).toBe(count)})})diff --git a/products/replay_vision/frontend/utils/recordingTimeline.ts b/products/replay_vision/frontend/utils/recordingTimeline.tsindex b4bebcd9e2c1..ff21105f81a8 100644--- a/products/replay_vision/frontend/utils/recordingTimeline.ts+++ b/products/replay_vision/frontend/utils/recordingTimeline.ts@@ -240,43 +240,10 @@ export function currentRowIndex(rows: TimelineRow[], playerTimeMs: number): numbreturn current}-/** A chapter start or a cited observation moment, the stops the ticker and the Moments badge count. */-export interface TimelineMoment {- atMs: number- label: string-}--export function timelineMoments(timeline: RecordingTimeline): TimelineMoment[] {- return [- ...timeline.chapters.map((c) => ({ atMs: c.startMs, label: c.title })),- ...timeline.markers.map((m) => ({- atMs: m.timestampMs,- label: m.result ? `${m.scannerName}: ${m.result}` : m.scannerName,- })),- ].sort((a, b) => a.atMs - b.atMs)-}-export function momentCount(timeline: RecordingTimeline): number {return timeline.chapters.length + timeline.markers.length}-/** The moment the player is in and the one after it, for the now/next ticker. */-export function surroundingMoments(- moments: TimelineMoment[],- playerTimeMs: number-): { current: TimelineMoment | null; next: TimelineMoment | null } {- let current: TimelineMoment | null = null- let next: TimelineMoment | null = null- for (const moment of moments) {- if (moment.atMs <= playerTimeMs) {- current = moment- } else if (!next) {- next = moment- }- }- return { current, next }-}-/** The next chapter start after the player's position. */export function nextTimelineStopMs(timeline: RecordingTimeline, playerTimeMs: number): number | null {const later = timeline.chapters.map((c) => c.startMs).filter((ms) => ms > playerTimeMs)