:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): stamp a key moment on each observation and open the watch feed at it (#109513)
Kim Svatos Dugan29788eaddd7a
diff --git a/products/replay_vision/backend/temporal/activities/call_scanner_provider.py b/products/replay_vision/backend/temporal/activities/call_scanner_provider.pyindex dc46f7cbd295..2a72308a970b 100644--- a/products/replay_vision/backend/temporal/activities/call_scanner_provider.py+++ b/products/replay_vision/backend/temporal/activities/call_scanner_provider.py@@ -144,6 +144,7 @@ class _MissionOutcome:signals: list[SignalFinding]verification: VerificationRecord | None = Nonethumbnail_video_s: int | None = None+ key_moment_video_s: int | None = None@activity.defn@@ -322,6 +323,9 @@ async def run_scan()duration_ms = int(llm_inputs.metadata.duration_seconds * 1000)finalized = _resolve_citations(outcome.finalized, scanner, duration_ms, video_clock)+ finalized = finalized.model_copy(+ update={"key_moment_ms": _key_moment_session_ms(outcome.key_moment_video_s, duration_ms, video_clock)}+ )signals = [_signal_on_session_clock(signal, video_clock) for signal in outcome.signals]return ScannerCallOutput(model_output=finalized,@@ -363,6 +367,17 @@ def _resolve_citations(return finalized+def _key_moment_session_ms(video_s: int | None, duration_ms: int, clock: VideoClock) -> int | None:+ """Move the model's key moment onto the session clock, or None when it skipped the pick or named a time past+ the video. Same bound as a citation, because the clock would clamp an invented time onto the recording's end."""+ if video_s is None:+ return None+ longest_citable_s = duration_ms / 1000 if clock.is_identity else clock.video_duration_s+ if longest_citable_s is not None and video_s > longest_citable_s:+ return None+ return min(clock.video_s_to_session_ms(video_s), duration_ms)++def _extract_segments(text: str, duration_ms: int, clock: VideoClock) -> tuple[str, list[Segment]]:"""Walk `(t <sec>)` markers in `text`; drop times past the recording; return (plain text, render-ready text/chip segments).@@ -643,6 +658,7 @@ async def _run_mission(signals=signals,verification=verification,thumbnail_video_s=getattr(step_outputs.get(STEP_CORE), "thumbnail_t", None),+ key_moment_video_s=getattr(step_outputs.get(STEP_CORE), "key_moment_t", None),)diff --git a/products/replay_vision/backend/temporal/scanners/base.py b/products/replay_vision/backend/temporal/scanners/base.pyindex a148a9cf5df2..520e54d3f402 100644--- a/products/replay_vision/backend/temporal/scanners/base.py+++ b/products/replay_vision/backend/temporal/scanners/base.py@@ -197,6 +197,21 @@ def thumbnail_field() -> Any:return Field(default=None, ge=0, description=_THUMBNAIL_DESCRIPTION)+_KEY_MOMENT_DESCRIPTION = (+ "The single moment your answer rests on most, in whole seconds of video time counted from the start of "+ "the video file, the same scale you cite moments in, not the footer's `REC_T`."+)+++def key_moment_field() -> Any:+ """`key_moment_t` field for LLM-response schemas, declared after the answer so the pick never precedes it.++ Optional for the same reason as `thumbnail_t`: a skipped pick must not fail a paid-for scan. Readers open the+ recording from its start when absent.+ """+ return Field(default=None, ge=0, description=_KEY_MOMENT_DESCRIPTION)++def notability_field() -> Any:"""`notability` field for LLM-response schemas.@@ -224,6 +239,9 @@ class BaseScannerOutput(BaseModel, frozen=True):# shared field so direct construction is bound to 0-1, not just the LLM-response step schemas.notability: float | None = notability_field()notability_reason: str | None = notability_reason_field()+ # Session-clock offset of `key_moment_t`, stamped after the scan. None when the model skipped the pick or+ # named a time past the video, and on observations scanned before key moments shipped.+ key_moment_ms: int | None = Field(default=None, ge=0)def to_event_properties(self) -> dict[str, Any]:"""Flatten with `scanner_output_*` keys for the event; `scanner_type` is excluded (already a top-level property via the snapshot)."""diff --git a/products/replay_vision/backend/temporal/scanners/classifier.py b/products/replay_vision/backend/temporal/scanners/classifier.pyindex ee08c6d24fb4..7169b660f8d9 100644--- a/products/replay_vision/backend/temporal/scanners/classifier.py+++ b/products/replay_vision/backend/temporal/scanners/classifier.py@@ -13,6 +13,7 @@ from products.replay_vision.backend.temporal.scanners.base import (BaseScannerOutput,Segment,confidence_field,+ key_moment_field,notability_field,notability_reason_field,thumbnail_field,@@ -93,6 +94,7 @@ class ClassifierScanner(BaseScanner, frozen=True):fields["notability_reason"] = (str | None, notability_reason_field())fields["notability"] = (float | None, notability_field())fields["confidence"] = (float, confidence_field())+ fields["key_moment_t"] = (int | None, key_moment_field())fields["thumbnail_t"] = (int | None, thumbnail_field())return create_model("ClassifierLlmResponse", **fields)diff --git a/products/replay_vision/backend/temporal/scanners/monitor.py b/products/replay_vision/backend/temporal/scanners/monitor.pyindex ad1284a073de..6adf7baeec7f 100644--- a/products/replay_vision/backend/temporal/scanners/monitor.py+++ b/products/replay_vision/backend/temporal/scanners/monitor.py@@ -10,6 +10,7 @@ from products.replay_vision.backend.temporal.scanners.base import (BaseScannerOutput,Segment,confidence_field,+ key_moment_field,notability_field,notability_reason_field,thumbnail_field,@@ -33,6 +34,7 @@ class MonitorLlmResponse(BaseModel, frozen=True):notability_reason: str | None = notability_reason_field()notability: float | None = notability_field()confidence: float = confidence_field()+ key_moment_t: int | None = key_moment_field()thumbnail_t: int | None = thumbnail_field()diff --git a/products/replay_vision/backend/temporal/scanners/prompts/_macros.jinja b/products/replay_vision/backend/temporal/scanners/prompts/_macros.jinjaindex 54734a3e4108..845856ac2d35 100644--- a/products/replay_vision/backend/temporal/scanners/prompts/_macros.jinja+++ b/products/replay_vision/backend/temporal/scanners/prompts/_macros.jinja@@ -13,6 +13,11 @@ Cite key moments inside `{{ field_name }}` as `(t <seconds>)`, following the CitSeparately from your answer above, judge the session itself: in `notability_reason` name the single moment a product team would most want to see (or say plainly that nothing stands out), then set `notability` per the notability calibration rules. Judge what happened to the person, not whether it matches your answer above — a session can be worth watching even when your answer is a non-event, and a routine session stays low even when your answer is a hit. Weigh the area this scanner watches: the team chose it, so difficulty there matters more to them than the same difficulty elsewhere in the session, and repeated or severe trouble in that area is worth watching even when your answer already covers it.{%- endmacro -%}+{# The moment the feed opens the recording at, asked in the core turn next to the poster frame. Call as `{{ mark_key_moment() }}`. #}+{%- macro mark_key_moment() -%}+Give the single moment your answer above rests on most in `key_moment_t`, in whole seconds of video time, the same scale you cite moments in, not the footer's `REC_T`. Pick the evidence itself: the error, the click that failed, the step the user gave up on, the screen your answer rests on. A person opens the recording at this moment to check your answer, so pick where the deciding thing happens, not where the page loads before it.+{%- endmacro -%}+{# The poster frame, asked in the core turn: a turn of its own costs a full conversation re-send per scan. Call as `{{ pick_media() }}`. #}{%- macro pick_media() -%}Last, pick the single frame that best illustrates what you found, so a person scanning a list of recordings can tell at a glance what this one is about, and give it in `thumbnail_t` in whole seconds of video time, the same scale you cite moments in, not the footer's `REC_T`. Pick a frame where the screen shows the thing itself: the error, the broken layout, the step the user was stuck on, the page your answer is about. Avoid a blank page, a full-page spinner, a modal backdrop mid-fade, and the first and last seconds of the recording, which usually show the page loading or unloading. When nothing stands out, pick a moment where the user was clearly doing something rather than the start of the video.diff --git a/products/replay_vision/backend/temporal/scanners/prompts/classifier_step.jinja b/products/replay_vision/backend/temporal/scanners/prompts/classifier_step.jinjaindex 485d56e0426e..58780c63dc76 100644--- a/products/replay_vision/backend/temporal/scanners/prompts/classifier_step.jinja+++ b/products/replay_vision/backend/temporal/scanners/prompts/classifier_step.jinja@@ -1,4 +1,4 @@-{% from "_macros.jinja" import cite_in, pick_media, rate_notability %}Categorize this session according to: {{ user_prompt }}+{% from "_macros.jinja" import cite_in, mark_key_moment, pick_media, rate_notability %}Categorize this session according to: {{ user_prompt }}In `reasoning`, work through what the session shows that bears on this; then choose tags from this fixed vocabulary: [{{ vocabulary }}]. {% if multi_label %}Pick every tag that applies.{% else %}Pick exactly one tag.{% endif %} A tag is required even when the session never shows what the criterion describes, so in that case pick the least wrong one and follow the relevance rules: lead the `reasoning` with the fact that the session doesn't show it, and keep `confidence` low.{% if allow_freeform_tags %}@@ -10,4 +10,6 @@ Freeform tags this scanner has already used on other sessions: [{{ known_freefor{{ rate_notability() }}+{{ mark_key_moment() }}+{{ pick_media() }}diff --git a/products/replay_vision/backend/temporal/scanners/prompts/monitor_step.jinja b/products/replay_vision/backend/temporal/scanners/prompts/monitor_step.jinjaindex e3ae0add7574..fe93e2914ee3 100644--- a/products/replay_vision/backend/temporal/scanners/prompts/monitor_step.jinja+++ b/products/replay_vision/backend/temporal/scanners/prompts/monitor_step.jinja@@ -1,4 +1,4 @@-{% from "_macros.jinja" import cite_in, pick_media, rate_notability %}Decide whether the following condition occurred during the session: {{ user_prompt }}+{% from "_macros.jinja" import cite_in, mark_key_moment, pick_media, rate_notability %}Decide whether the following condition occurred during the session: {{ user_prompt }}Before deciding, verify each moment that bears on this condition with `get_events_around`: the video alone is easy to misread, and what the events record at a moment outranks a visual impression of it.@@ -8,4 +8,6 @@ In `reasoning`, weigh the evidence for and against, noting what the events confi{{ rate_notability() }}+{{ mark_key_moment() }}+{{ pick_media() }}diff --git a/products/replay_vision/backend/temporal/scanners/prompts/scorer_step.jinja b/products/replay_vision/backend/temporal/scanners/prompts/scorer_step.jinjaindex e716b9fc97ba..d86b26e0a336 100644--- a/products/replay_vision/backend/temporal/scanners/prompts/scorer_step.jinja+++ b/products/replay_vision/backend/temporal/scanners/prompts/scorer_step.jinja@@ -1,4 +1,4 @@-{% from "_macros.jinja" import cite_in, pick_media, rate_notability %}Rate this session against the following criterion: {{ user_prompt }}+{% from "_macros.jinja" import cite_in, mark_key_moment, pick_media, rate_notability %}Rate this session against the following criterion: {{ user_prompt }}Before scoring, verify the moments that drive your score with `get_events_around`: what the events record at a moment outranks a visual impression of it, and a score toward either end of the scale needs event-checked moments behind it, not just how the session looks.@@ -8,4 +8,6 @@ In `reasoning`, work through what you observed in the session that bears on this{{ rate_notability() }}+{{ mark_key_moment() }}+{{ pick_media() }}diff --git a/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja b/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinjaindex 1c54df4e7145..cc93c9493c13 100644--- a/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja+++ b/products/replay_vision/backend/temporal/scanners/prompts/summarizer_summary_step.jinja@@ -1,4 +1,4 @@-{% from "_macros.jinja" import cite_in, pick_media, rate_notability %}Summarize this session.{% if user_prompt %}+{% from "_macros.jinja" import cite_in, mark_key_moment, pick_media, rate_notability %}Summarize this session.{% if user_prompt %}Additional context from the team operating the product being recorded:{{ user_prompt }}{% endif %}@@ -9,4 +9,6 @@ Additional context from the team operating the product being recorded:{{ rate_notability() }}+{{ mark_key_moment() }}+{{ pick_media() }}diff --git a/products/replay_vision/backend/temporal/scanners/scorer.py b/products/replay_vision/backend/temporal/scanners/scorer.pyindex 5523a93e5fd8..e35a5f5254a2 100644--- a/products/replay_vision/backend/temporal/scanners/scorer.py+++ b/products/replay_vision/backend/temporal/scanners/scorer.py@@ -10,6 +10,7 @@ from products.replay_vision.backend.temporal.scanners.base import (BaseScannerOutput,Segment,confidence_field,+ key_moment_field,notability_field,notability_reason_field,thumbnail_field,@@ -62,6 +63,7 @@ class ScorerScanner(BaseScanner, frozen=True):notability_reason=(str | None, notability_reason_field()),notability=(float | None, notability_field()),confidence=(float, confidence_field()),+ key_moment_t=(int | None, key_moment_field()),thumbnail_t=(int | None, thumbnail_field()),)diff --git a/products/replay_vision/backend/temporal/scanners/summarizer.py b/products/replay_vision/backend/temporal/scanners/summarizer.pyindex e6db5aad0579..854f56664c1f 100644--- a/products/replay_vision/backend/temporal/scanners/summarizer.py+++ b/products/replay_vision/backend/temporal/scanners/summarizer.py@@ -11,6 +11,7 @@ from products.replay_vision.backend.temporal.scanners.base import (EmbeddingDocument,Segment,confidence_field,+ key_moment_field,notability_field,notability_reason_field,thumbnail_field,@@ -39,6 +40,7 @@ class SummarizerSummaryResponse(BaseModel, frozen=True):notability_reason: str | None = notability_reason_field()notability: float | None = notability_field()confidence: float = confidence_field()+ key_moment_t: int | None = key_moment_field()thumbnail_t: int | None = thumbnail_field()diff --git a/products/replay_vision/backend/tests/test_call_scanner_provider.py b/products/replay_vision/backend/tests/test_call_scanner_provider.pyindex 661a6bfa10aa..b85a7e19d850 100644--- a/products/replay_vision/backend/tests/test_call_scanner_provider.py+++ b/products/replay_vision/backend/tests/test_call_scanner_provider.py@@ -19,6 +19,7 @@ from posthog.dataclasses import frozenfrom products.replay_vision.backend.models.replay_scanner import ScannerTypefrom products.replay_vision.backend.temporal.activities.call_scanner_provider import (+ _key_moment_session_ms,_maybe_create_video_cache,_MissionOutcome,_remaining_verify_budget_seconds,@@ -39,7 +40,7 @@ from products.replay_vision.backend.temporal.scanners.base import ()from products.replay_vision.backend.temporal.scanners.monitor import MonitorLlmResponse, MonitorOutput, MonitorScannerfrom products.replay_vision.backend.temporal.types import ScannerSnapshot, VerificationRecord-from products.replay_vision.backend.temporal.video_clock import VideoClock+from products.replay_vision.backend.temporal.video_clock import ActiveSpan, VideoClock_LABELS = {"provider": "gemini", "model": "gemini-3-flash-preview", "scanner_type": "monitor"}# The driver treats the video part opaquely (just appended to the conversation), so a sentinel is fine.@@ -405,7 +406,9 @@ async def test_signal_timestamps_use_recording_duration(description="A blank dialog covers the editor and prevents input.",confidence=0.9,)- core = MonitorLlmResponse(verdict="yes", reasoning="The dialog blocked input.", confidence=0.9, thumbnail_t=7)+ core = MonitorLlmResponse(+ verdict="yes", reasoning="The dialog blocked input.", confidence=0.9, thumbnail_t=7, key_moment_t=5+ )client = _FakeClient([_Resp(text=core.model_dump_json())]+ [@@ -438,9 +441,36 @@ async def test_signal_timestamps_use_recording_duration(assert outcome.signals == ([] if expected_end is None else [signal.model_copy(update={"end_time": expected_end})])# The pick rides the core answer, so no turn of its own is spent on it.assert outcome.thumbnail_video_s == 7+ assert outcome.key_moment_video_s == 5assert len(client.models.calls) == 1 + len(end_times)+# The render cut 10s-40s of the session, so video second 15 shows session second 45.+_CUT_CLOCK = VideoClock(+ spans=(+ ActiveSpan(session_from_s=0, session_to_s=10, video_from_s=0, video_to_s=10),+ ActiveSpan(session_from_s=40, session_to_s=60, video_from_s=10, video_to_s=30),+ )+)+++ "video_s, duration_ms, clock, expected",+ [+ pytest.param(None, 20_000, _IDENTITY_CLOCK, None, id="skipped pick stays unset"),+ pytest.param(12, 20_000, _IDENTITY_CLOCK, 12_000, id="uncut render keeps the same second"),+ pytest.param(20, 20_000, _IDENTITY_CLOCK, 20_000, id="the final second is still a moment"),+ pytest.param(21, 20_000, _IDENTITY_CLOCK, None, id="a time past the recording is dropped"),+ pytest.param(15, 60_000, _CUT_CLOCK, 45_000, id="a cut render maps onto the session clock"),+ pytest.param(31, 60_000, _CUT_CLOCK, None, id="a time past the video is dropped, not clamped"),+ ],+)+def test_key_moment_moves_onto_the_session_clock(+ video_s: int | None, duration_ms: int, clock: VideoClock, expected: int | None+) -> None:+ assert _key_moment_session_ms(video_s, duration_ms, clock) == expected++@pytest.mark.asyncioasync def test_a_provider_error_on_a_non_required_step_leaves_the_scan_standing() -> None:# A provider blip on the last, optional turn used to fail the whole paid-for scan.diff --git a/products/replay_vision/backend/tests/test_scanners.py b/products/replay_vision/backend/tests/test_scanners.pyindex 70a4b003e059..b6f0c81ccbe4 100644--- a/products/replay_vision/backend/tests/test_scanners.py+++ b/products/replay_vision/backend/tests/test_scanners.py@@ -808,13 +808,14 @@ class TestSummaryEmbeddingText:class TestToEventProperties:def test_flattens_with_scanner_output_prefix(self) -> None:- # Notability rides onto the event too, so it is queryable in insights alongside the verdict.+ # Notability and the key moment ride onto the event too, so they are queryable in insights alongside the verdict.out = MonitorOutput(verdict="yes",reasoning="found it",confidence=0.9,notability=0.8,notability_reason="the export failed twice",+ key_moment_ms=42_000,)props = out.to_event_properties()assert props == {@@ -824,6 +825,7 @@ class TestToEventProperties:"scanner_output_confidence": 0.9,"scanner_output_notability": 0.8,"scanner_output_notability_reason": "the export failed twice",+ "scanner_output_key_moment_ms": 42_000,}def test_unjudged_notability_flattens_as_null_not_zero(self) -> None:diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsxindex c26b43abc4b6..21756ba3fe67 100644--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx@@ -759,7 +759,7 @@ 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).+ // One card per reason kind. Only the first carries a key moment, so the rest show no time on the tile.'/api/projects/:team_id/vision/scanners/watch_feed/': {results: [{@@ -788,6 +788,7 @@ const meta: Meta = {{ kind: 'text', value: ' Retried the payment form twice ' },{ kind: 'chip', timestamp_ms: 154000 },],+ key_moment_ms: 154000,},signals_count: 2,verification: null,diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.tsindex ed81c62d0ebb..62628217b115 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts@@ -1,5 +1,5 @@import type { ReplayObservationApi, WatchFeedReasonApi } from '../../generated/api.schemas'-import { watchCardHeadline, watchReasonCopy } from './WatchFeedCard'+import { observationKeyMomentMs, watchCardHeadline, watchReasonCopy, watchStartSeconds } from './WatchFeedCard'describe('WatchFeedCard helpers', () => {describe('watchReasonCopy', () => {@@ -133,6 +133,28 @@ describe('WatchFeedCard helpers', () => {scanner_result: { model_output: output },}) as unknown as ReplayObservationApi+ describe('observationKeyMomentMs', () => {+ it.each<{ name: string; output: Record<string, unknown>; expected: number | null }>([+ { name: 'reads the key moment', output: { key_moment_ms: 42_000 }, expected: 42_000 },+ { name: 'keeps a key moment at the very start', output: { key_moment_ms: 0 }, expected: 0 },+ { name: 'is null on a scan from before key moments', output: {}, expected: null },+ { name: 'is null when the scan skipped the pick', output: { key_moment_ms: null }, expected: null },+ { name: 'ignores a value that is not a number', output: { key_moment_ms: '42' }, expected: null },+ ])('$name', ({ output, expected }) => {+ expect(observationKeyMomentMs(observation('monitor', output))).toBe(expected)+ })+ })++ describe('watchStartSeconds', () => {+ it.each<{ name: string; keyMomentMs: number | null; expected: number }>([+ { name: 'starts from the beginning without a key moment', keyMomentMs: null, expected: 0 },+ { name: 'starts a few seconds before the key moment', keyMomentMs: 42_900, expected: 39 },+ { name: 'never starts before the recording', keyMomentMs: 1_000, expected: 0 },+ ])('$name', ({ keyMomentMs, expected }) => {+ expect(watchStartSeconds(keyMomentMs)).toBe(expected)+ })+ })+describe('watchCardHeadline', () => {it.each<{name: stringdiff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsxindex eb6cfdd257a7..bf481bfa8e87 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx@@ -6,6 +6,7 @@ import { LemonButton, 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'@@ -137,6 +138,20 @@ export function watchReasonCopy(reason: WatchFeedReasonApi): string {}}+/** Seconds of lead-in before the key moment, so the viewer sees what led up to it. */+const KEY_MOMENT_LEAD_IN_S = 3++/** The session offset of the moment the scan's answer rests on most, or null on scans that did not pick one. */+export function observationKeyMomentMs(observation: ReplayObservationApi): number | null {+ const keyMomentMs = readResult(observation)?.key_moment_ms+ return typeof keyMomentMs === 'number' && Number.isFinite(keyMomentMs) && keyMomentMs >= 0 ? keyMomentMs : null+}++/** Where the player starts: a short lead-in before the key moment, or the recording's start without one. */+export function watchStartSeconds(keyMomentMs: number | null): number {+ return keyMomentMs === null ? 0 : Math.max(0, Math.floor(keyMomentMs / 1000) - KEY_MOMENT_LEAD_IN_S)+}+/*** The card's bold headline, plus the prose that follows it. A summarizer authored a title, so its* summary rides along whole (with citation chips). Otherwise the first sentence of the prose the@@ -199,10 +214,12 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Elemeconst scannerName = (observation.scanner_snapshot?.name as string | undefined) || '(untitled scanner)'const person = observation.recording_subject_email || observation.distinct_idconst headline = watchCardHeadline(observation)- // t=0 so the observation page opens with the player expanded. `from` marks the feed as the origin,- // so the observation's back button returns here rather than the scanner.+ const keyMomentMs = observationKeyMomentMs(observation)+ const startSeconds = watchStartSeconds(keyMomentMs)+ // t is always set, so the observation page opens with the player expanded. `from` marks the feed as the+ // origin, so the observation's back button returns here rather than the scanner.const observationUrl = combineUrl(urls.replayVisionObservation(observation.id), {- t: 0,+ t: startSeconds,[OBSERVATION_ORIGIN_PARAM]: WATCH_FEED_ORIGIN,}).urlconst capture = (target: 'clip_modal' | 'observation'): void => {@@ -212,15 +229,22 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Elemeobservation_id: observation.id,position,reason_kind: reason.kind,+ has_key_moment: keyMomentMs !== null,target,})}const watchClipInModal = (): void => {capture('clip_modal')- // The player reads `?t=<seconds>` as an offset on first load and the modal preserves existing- // search params, so clear any stale `t` to start the clip from the beginning.+ // The modal's own `initialTimestamp` is an absolute unix-ms time, but the key moment 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 `t` before opening. Without a key moment, clear any stale+ // `t` so the clip starts from the beginning.const { location, searchParams, hashParams } = router.values- router.actions.replace(location.pathname, { ...searchParams, t: undefined }, hashParams)+ router.actions.replace(+ location.pathname,+ { ...searchParams, t: keyMomentMs === null ? undefined : startSeconds },+ hashParams+ )openSessionPlayer({ id: observation.session_id })}@@ -231,7 +255,7 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Eleme>{!observation.viewed && <span className="absolute inset-y-0 left-0 w-1 rounded-l bg-accent" aria-hidden />}{/* The thumbnail is the watch affordance, so the whole poster opens the clip modal.- The New tag sits outside the poster, which clips its own overflow. */}+ The New tag and the key moment sit outside the poster, which clips its own overflow. */}<div className="relative hidden @md:block w-64 shrink-0 self-start"><buttontype="button"@@ -246,6 +270,13 @@ export function WatchFeedCard({ item, position }: WatchFeedCardProps): JSX.ElemeWatch clip</span></ObservationThumbnail>+ {keyMomentMs !== null && (+ <Tooltip title="Key moment: where the scan's answer rests most. The clip starts just before it.">+ <span className="absolute bottom-1 right-1 text-xs tabular-nums bg-bg-light border rounded px-1">+ {colonDelimitedDuration(Math.floor(keyMomentMs / 1000), null)}+ </span>+ </Tooltip>+ )}</button>{/* Sits above the button, so it lets clicks through to open the clip. */}{!observation.viewed && (diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.tsindex e7ebe356a360..8838d0d18e1b 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts@@ -327,7 +327,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([...(items.length === 0 ? { empty_reason: values.emptyReason ?? 'unresolved' } : {}),})},- // The player reads `?t=<seconds>` as its start offset; clear it on close so a+ // A card writes `?t=<seconds>` so the player opens at the key 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