Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay-vision): stop one-off scan observations linking to a missing scanner (#89569)

coryslater6cfb40153760
diff --git a/products/replay_vision/backend/api/observations.py b/products/replay_vision/backend/api/observations.py
index 75bcfa4f8d53..132de975bb09 100644
--- a/products/replay_vision/backend/api/observations.py
+++ b/products/replay_vision/backend/api/observations.py
@@ -54,10 +54,11 @@ from products.replay_vision.backend.models.replay_observation import (
ObservationTrigger,
ReplayObservation,
annotate_output_number,
+ hydrate_for_serialization,
jsonb_typeof,
)
from products.replay_vision.backend.models.replay_observation_label import ReplayObservationLabel
-from products.replay_vision.backend.models.replay_scanner import ReplayScanner, ScannerType
+from products.replay_vision.backend.models.replay_scanner import ReplayScanner, ScannerOrigin, ScannerType
from products.replay_vision.backend.scanner_access import (
accessible_observations,
can_read_targeted_experiment,
@@ -149,6 +150,15 @@ class ReplayObservationLabelSerializer(serializers.Serializer):
class ReplayObservationSerializer(serializers.ModelSerializer):
scanner_id = serializers.UUIDField(read_only=True, help_text="The scanner that produced this observation.")
+ scanner_origin = serializers.ChoiceField(
+ choices=ScannerOrigin.choices,
+ read_only=True,
+ help_text=(
+ "Where the producing scanner came from. `configured` scanners are saved, named, and have a detail "
+ "page; `inline` ones are throwaways minted for a one-off scan and are not addressable, so callers "
+ "must not link to them."
+ ),
+ )
session_id = serializers.CharField(read_only=True, help_text="Session recording id this scanner was applied to.")
status = serializers.ChoiceField(
choices=ObservationStatus.choices,
@@ -255,6 +265,7 @@ class ReplayObservationSerializer(serializers.ModelSerializer):
fields = [
"id",
"scanner_id",
+ "scanner_origin",
"session_id",
"status",
"error_reason",
@@ -806,13 +817,11 @@ class ReplayObservationViewSet(
# `_scanner_for_url` gated the scanner's *current* experiment; this gates each row against the
# experiment recorded in its own snapshot, so retargeting can't surface historical rows the
# caller can't access.
- return (
+ return hydrate_for_serialization(
accessible_observations(
self.user_access_control, self.team_id, queryset.filter(team_id=self.team_id, scanner_id=scanner.id)
)
- .select_related("triggered_by_user", "label")
- .order_by("-created_at", "id")
- )
+ ).order_by("-created_at", "id")
def filter_queryset(self, queryset: QuerySet[ReplayObservation]) -> QuerySet[ReplayObservation]:
# List filters scope prev/next neighbors only; the observation itself must always resolve on retrieve.
@@ -1202,15 +1211,13 @@ class SessionReplayObservationViewSet(ReplayObservationViewSet):
# targeting included), then gate each row against the experiment in its own snapshot so a
# retargeted scanner can't surface historical rows the caller can't access.
readable_scanner_ids = readable_observation_scanner_ids(self.user_access_control, self.team_id)
- queryset = (
+ queryset = hydrate_for_serialization(
accessible_observations(
self.user_access_control,
self.team_id,
queryset.filter(team_id=self.team_id, scanner_id__in=readable_scanner_ids),
)
- .select_related("triggered_by_user", "label")
- .order_by("-created_at", "id")
- )
+ ).order_by("-created_at", "id")
# A bare list would scan the whole team's observation history; the replay page always has a session.
if self.action == "list":
session_id = self.request.query_params.get("session_id")
diff --git a/products/replay_vision/backend/models/replay_observation.py b/products/replay_vision/backend/models/replay_observation.py
index c1c5b079674a..bd50b88a8f2f 100644
--- a/products/replay_vision/backend/models/replay_observation.py
+++ b/products/replay_vision/backend/models/replay_observation.py
@@ -1,5 +1,5 @@
from django.db import models
-from django.db.models import Case, CharField, Expression, FloatField, Func, Value, When
+from django.db.models import Case, CharField, Expression, F, FloatField, Func, Value, When
from django.db.models.fields.json import KeyTextTransform, KeyTransform
from django.db.models.functions import Cast
@@ -184,6 +184,15 @@ def jsonb_typeof(expr: Expression) -> Func:
return Func(expr, function="JSONB_TYPEOF", output_field=CharField())
+def hydrate_for_serialization(qs: "models.QuerySet[ReplayObservation]") -> "models.QuerySet[ReplayObservation]":
+ """Load everything `ReplayObservationSerializer` reads, so no queryset feeding it goes one query per row.
+
+ `scanner_origin` is annotated rather than joined through `select_related("scanner")`: the serializer
+ reads one enum, and hydrating the scanner would ship its config and hour-bucket JSON blobs per row.
+ """
+ return qs.select_related("triggered_by_user", "label").annotate(scanner_origin=F("scanner__origin"))
+
+
def annotate_output_number(
qs: "models.QuerySet[ReplayObservation]", key: str, alias: str
) -> "models.QuerySet[ReplayObservation]":
diff --git a/products/replay_vision/backend/search.py b/products/replay_vision/backend/search.py
index e4d924b107c9..f5b27d76b286 100644
--- a/products/replay_vision/backend/search.py
+++ b/products/replay_vision/backend/search.py
@@ -23,7 +23,11 @@ from products.replay_vision.backend.embeddings import (
EMBEDDING_PRODUCT,
OBSERVATION_EMBEDDING_MODEL,
)
-from products.replay_vision.backend.models.replay_observation import ObservationStatus, ReplayObservation
+from products.replay_vision.backend.models.replay_observation import (
+ ObservationStatus,
+ ReplayObservation,
+ hydrate_for_serialization,
+)
from products.replay_vision.backend.scanner_access import accessible_observations
from products.replay_vision.backend.tags import clickhouse_slugify_sql, slugify_tag
@@ -214,6 +218,6 @@ def fetch_ranked_observations(
status=ObservationStatus.SUCCEEDED,
id__in=ordered_ids,
)
- rows = accessible_observations(access, team_id, rows).select_related("triggered_by_user", "label")
+ rows = hydrate_for_serialization(accessible_observations(access, team_id, rows))
observations = {str(obs.id): obs for obs in rows}
return [obs for observation_id in ordered_ids if (obs := observations.get(observation_id)) is not None]
diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.py
index 3cd52aa18af2..b771f2f7d99c 100644
--- a/products/replay_vision/backend/tests/test_api.py
+++ b/products/replay_vision/backend/tests/test_api.py
@@ -2885,14 +2885,25 @@ class TestSessionReplayObservationViewSet(_VisionAPITestCase):
)
def test_list_returns_observations_from_every_scanner_for_the_session(self) -> None:
+ inline_scanner = self._create_scanner(name="one-off", origin=ScannerOrigin.INLINE, inline_key="one-off")
self._create_observation(self.scanner_a, "sess-target")
self._create_observation(self.scanner_b, "sess-target")
+ self._create_observation(inline_scanner, "sess-target")
self._create_observation(self.scanner_a, "sess-other")
resp = self.client.get(f"{self.session_observations_url}?session_id=sess-target")
self.assertEqual(resp.status_code, 200)
results = resp.json()["results"]
- self.assertEqual({r["scanner_id"] for r in results}, {str(self.scanner_a.id), str(self.scanner_b.id)})
+ self.assertEqual(
+ {r["scanner_id"] for r in results},
+ {str(self.scanner_a.id), str(self.scanner_b.id), str(inline_scanner.id)},
+ )
+ # This endpoint feeds the dock, seekbar and sidebar, where a one-off scan used to render a
+ # blank label, so the origin has to survive the trip here and not only on the scanner route.
+ self.assertEqual(
+ {r["scanner_id"]: r["scanner_origin"] for r in results}[str(inline_scanner.id)],
+ "inline",
+ )
def test_list_requires_session_id(self) -> None:
resp = self.client.get(self.session_observations_url)
@@ -3693,6 +3704,22 @@ class TestInlineScanAction(_VisionAPITestCase):
resp = self.client.get(self.observations_url(scan_id))
self.assertEqual(resp.status_code, 200, resp.content)
self.assertEqual([r["session_id"] for r in resp.json()["results"]], ["sess-1"])
+ # Marked inline so a reader knows not to offer a link to the scanner: those endpoints 404 on it.
+ self.assertEqual([r["scanner_origin"] for r in resp.json()["results"]], ["inline"])
+
+ def test_a_configured_scanners_observations_are_marked_configured(
+ self, mock_sync_connect: MagicMock, mock_async_to_sync: MagicMock
+ ) -> None:
+ # The other half of the flag. Without it every observation reads as unlinkable and the scanner
+ # breadcrumb disappears for the configured scanners that do have a page.
+ mock_sync_connect.return_value = MagicMock()
+ mock_async_to_sync.return_value = MagicMock()
+ scanner = self._create_scanner()
+ self._finished_observation(str(scanner.id), "sess-1")
+
+ resp = self.client.get(self.observations_url(str(scanner.id)))
+ self.assertEqual(resp.status_code, 200, resp.content)
+ self.assertEqual([r["scanner_origin"] for r in resp.json()["results"]], ["configured"])
def test_requires_ai_consent(self, mock_sync_connect: MagicMock, mock_async_to_sync: MagicMock) -> None:
# New call site into the LLM path, so it needs its own consent gate rather than inheriting one.
diff --git a/products/replay_vision/backend/tests/test_search.py b/products/replay_vision/backend/tests/test_search.py
index d74918fed37a..ebe628f5093e 100644
--- a/products/replay_vision/backend/tests/test_search.py
+++ b/products/replay_vision/backend/tests/test_search.py
@@ -9,8 +9,12 @@ from parameterized import parameterized
from posthog.clickhouse.client import sync_execute
+from products.access_control.backend.facade.user_access_control import UserAccessControl
from products.replay_vision.backend.embeddings import EMBEDDING_DOCUMENT_TYPE, EMBEDDING_PRODUCT
-from products.replay_vision.backend.search import ObservationSearchFilters, rank_observations
+from products.replay_vision.backend.models.replay_observation import ObservationStatus, ReplayObservation
+from products.replay_vision.backend.models.replay_scanner import ReplayScanner, ScannerModel, ScannerOrigin, ScannerType
+from products.replay_vision.backend.search import ObservationSearchFilters, fetch_ranked_observations, rank_observations
+from products.replay_vision.backend.tests.helpers import snapshot_for
class TestObservationFiltersTagClause:
@@ -141,3 +145,45 @@ class TestRankObservationsQuery(ClickhouseTestMixin, APIBaseTest):
)
self.assertEqual([m.observation_id for m in matches], [kept])
+
+
+class TestFetchRankedObservations(APIBaseTest):
+ def _observation(self, scanner_name: str, origin: ScannerOrigin = ScannerOrigin.CONFIGURED) -> ReplayObservation:
+ scanner = ReplayScanner.objects.create(
+ team=self.team,
+ name=scanner_name,
+ scanner_type=ScannerType.MONITOR,
+ scanner_config={"prompt": "did the user check out?"},
+ model=ScannerModel.GEMINI_3_7_FLASH,
+ origin=origin,
+ # A check constraint pairs the two: an inline scanner owes a key, a configured one owes none.
+ inline_key=scanner_name if origin == ScannerOrigin.INLINE else "",
+ )
+ return ReplayObservation.objects.create(
+ team=self.team,
+ scanner=scanner,
+ session_id=f"sess-{scanner_name}",
+ status=ObservationStatus.SUCCEEDED,
+ # A settled status has to carry a completion time, per the model's check constraint.
+ completed_at=timezone.now(),
+ scanner_snapshot=snapshot_for(scanner),
+ )
+
+ @parameterized.expand([("configured", ScannerOrigin.CONFIGURED), ("inline", ScannerOrigin.INLINE)])
+ def test_hydrated_rows_carry_their_scanner(self, _name: str, origin: ScannerOrigin) -> None:
+ # Both origins, because the default manager serves configured scanners only, so a join that
+ # stopped using the base manager would drop exactly the inline rows this branch fixes.
+ observations = [self._observation("first", origin), self._observation("second", origin)]
+ access = UserAccessControl(user=self.user, team=self.team)
+
+ rows = fetch_ranked_observations(
+ self.team.pk,
+ [str(obs.scanner_id) for obs in observations],
+ [str(obs.id) for obs in observations],
+ access,
+ )
+
+ self.assertEqual(len(rows), 2)
+ with self.assertNumQueries(0):
+ # Annotated by `hydrate_for_serialization`, so it is not on the declared row type.
+ self.assertEqual([row.scanner_origin for row in rows], [origin] * 2) # type: ignore[attr-defined]
diff --git a/products/replay_vision/frontend/components/ObservationCard.tsx b/products/replay_vision/frontend/components/ObservationCard.tsx
index 990afff58d18..c5c4ad2c16e0 100644
--- a/products/replay_vision/frontend/components/ObservationCard.tsx
+++ b/products/replay_vision/frontend/components/ObservationCard.tsx
@@ -19,7 +19,7 @@ import {
scannerTypeLabel,
} from '../replay_scanners/types'
import { citedTextToPlainText, parseCitedSegments } from '../utils/citations'
-import { readReasoning } from '../utils/observation'
+import { readReasoning, scannerLabel } from '../utils/observation'
import { ObservationProgressBar } from './ObservationProgressBar'
import { ObservationRetryButton } from './ObservationRetryButton'
@@ -423,7 +423,7 @@ export function ObservationDockCard({
<div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-2 min-w-0">
<ObservationStatusTag status={observation.status} errorReason={observation.error_reason} />
- <span className="font-semibold text-sm truncate">{snapshot?.name || 'Scanner'}</span>
+ <span className="font-semibold text-sm truncate">{scannerLabel(observation)}</span>
{scannerType && <span className="text-muted text-xs">{scannerTypeLabel(scannerType)}</span>}
</div>
<div className="flex items-center gap-2 shrink-0">
diff --git a/products/replay_vision/frontend/components/ObservationSeekbarMarks.tsx b/products/replay_vision/frontend/components/ObservationSeekbarMarks.tsx
index 8475a3125d99..4c79802e3aa8 100644
--- a/products/replay_vision/frontend/components/ObservationSeekbarMarks.tsx
+++ b/products/replay_vision/frontend/components/ObservationSeekbarMarks.tsx
@@ -50,11 +50,7 @@ function ObservationSeekbarMarksContent({
<span className="font-medium">{timeLabel}</span>
{mark.entries.map((entry, i) => (
<div key={i} className="flex flex-col">
- <span>
- {[entry.scannerName ?? 'Scanner', entry.headline]
- .filter(Boolean)
- .join(' · ')}
- </span>
+ <span>{[entry.scannerName, entry.headline].filter(Boolean).join(' · ')}</span>
{entry.snippet && <span className="text-xs opacity-75">{entry.snippet}</span>}
</div>
))}
diff --git a/products/replay_vision/frontend/components/ObservationsDock.tsx b/products/replay_vision/frontend/components/ObservationsDock.tsx
index 7a002e56de65..07cdd01da638 100644
--- a/products/replay_vision/frontend/components/ObservationsDock.tsx
+++ b/products/replay_vision/frontend/components/ObservationsDock.tsx
@@ -17,7 +17,7 @@ import type { ReplayScannerApi } from '../generated/api.schemas'
import { observationsDockLogic } from '../logics/observationsDockLogic'
import { visionQuotaLogic } from '../logics/visionQuotaLogic'
import { getReplayVisionEditDisabledReason } from '../utils/accessControl'
-import { dockObservations, isUnsuccessfulScan } from '../utils/observation'
+import { BUILT_IN_SUMMARY_LABEL, dockObservations, isUnsuccessfulScan } from '../utils/observation'
import { quotaUx } from '../utils/quotaProjection'
import { VisionDocsLink, visionDocsUrl } from './DocsLink'
import { ObservationDockCard } from './ObservationCard'
@@ -77,7 +77,7 @@ function SummarizeButton({ sessionId }: { sessionId: string }): JSX.Element {
// carries the logomark and says so, rather than reading as a scanner they cannot find.
label: (
<span className="flex items-center justify-between gap-2 w-full">
- <span className="truncate">Quick summary</span>
+ <span className="truncate">{BUILT_IN_SUMMARY_LABEL}</span>
<span className="flex items-center gap-1.5 text-xs shrink-0">
<IconLogomark className="text-base text-primary" />
<span className="text-muted">Built in</span>
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.ts
index a3363cc30888..1cb0ed867a3d 100644
--- a/products/replay_vision/frontend/generated/api.schemas.ts
+++ b/products/replay_vision/frontend/generated/api.schemas.ts
@@ -890,6 +890,17 @@ export interface PaginatedVisionAlertEventListApi {
results: VisionAlertEventApi[]
}
+/**
+ * * `configured` - Configured
+ * * `inline` - Inline
+ */
+export type ScannerOriginEnumApi = (typeof ScannerOriginEnumApi)[keyof typeof ScannerOriginEnumApi]
+
+export const ScannerOriginEnumApi = {
+ Configured: 'configured',
+ Inline: 'inline',
+} as const
+
/**
* * `pending` - Pending
* * `running` - Running
@@ -992,6 +1003,11 @@ export interface ReplayObservationApi {
readonly id: string
/** The scanner that produced this observation. */
readonly scanner_id: string
+ /** Where the producing scanner came from. `configured` scanners are saved, named, and have a detail page; `inline` ones are throwaways minted for a one-off scan and are not addressable, so callers must not link to them.
+ *
+ * * `configured` - Configured
+ * * `inline` - Inline */
+ readonly scanner_origin: ScannerOriginEnumApi
/** Session recording id this scanner was applied to. */
readonly session_id: string
/** Observation status (pending, running, succeeded, failed, ineligible).
diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsx
index 360d9421f763..8b35bf350917 100644
--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx
+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx
@@ -64,6 +64,7 @@ import {
OBSERVATION_TRIGGER_TAG,
type ScannerType,
} from '../replay_scanners/types'
+import { scannerLabel } from '../utils/observation'
import { ObservationLabelControl } from './ObservationLabelControl'
import { neighborFilterParams, observationDetailUrl, replayObservationLogic } from './replayObservationLogic'
import { replayObservationSceneLogic } from './replayObservationSceneLogic'
@@ -141,7 +142,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
<SceneTitleSection name="Observation not found" resourceType={{ type: 'replay_vision' }} />
<p className="text-muted">
This observation either doesn't exist or you don't have access to it.{' '}
- <Link to={urls.replayVision()}>Back to scanners</Link>.
+ <Link to={urls.replayVision()}>Go to Replay vision</Link>.
</p>
</SceneContent>
)
@@ -152,7 +153,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
const reasoning = result && typeof result.reasoning === 'string' ? result.reasoning : null
const reasoningSegments = result?.reasoning_segments
const scannerType = snapshot?.scanner_type
- const scannerName = snapshot?.name || 'Scanner'
+ const scannerName = scannerLabel(observation)
const triggerLabel = OBSERVATION_TRIGGER_TAG[observation.triggered_by].label
const snapshotConfig = configFromSnapshot(snapshot)
const prompt = snapshotConfig?.prompt ?? null
diff --git a/products/replay_vision/frontend/observations/replayObservationLogic.test.ts b/products/replay_vision/frontend/observations/replayObservationLogic.test.ts
index c2e682656dff..ca45cf2648bc 100644
--- a/products/replay_vision/frontend/observations/replayObservationLogic.test.ts
+++ b/products/replay_vision/frontend/observations/replayObservationLogic.test.ts
@@ -9,31 +9,38 @@ import { replayObservationSceneLogic } from './replayObservationSceneLogic'
describe('replayObservationLogic', () => {
let retrySpy: jest.Mock
+ let scannerOrigin: 'configured' | 'inline'
let sceneLogic: ReturnType<typeof replayObservationSceneLogic.build>
beforeEach(() => {
+ scannerOrigin = 'configured'
retrySpy = jest.fn(() => [202, { workflow_id: 'wf-retry' }])
useMocks({
get: {
- '/api/projects/:team/vision/observations/:id/': {
- id: 'obs-1',
- scanner_id: 'scanner-9',
- session_id: 'sess-1',
- status: 'failed',
- error_reason: 'internal_error:boom',
- scanner_snapshot: {
- name: 'My scanner',
- scanner_type: 'monitor',
- scanner_version: 1,
- model: 'm',
- provider: 'p',
- emits_signals: false,
- scanner_config: { prompt: 'q' },
+ '/api/projects/:team/vision/observations/:id/': () => [
+ 200,
+ {
+ id: 'obs-1',
+ scanner_id: 'scanner-9',
+ scanner_origin: scannerOrigin,
+ session_id: 'sess-1',
+ status: 'failed',
+ error_reason: 'internal_error:boom',
+ scanner_snapshot: {
+ // An inline scanner carries no name.
+ name: scannerOrigin === 'configured' ? 'My scanner' : '',
+ scanner_type: 'monitor',
+ scanner_version: 1,
+ model: 'm',
+ provider: 'p',
+ emits_signals: false,
+ scanner_config: { prompt: 'q' },
+ },
+ scanner_result: null,
+ triggered_by: 'schedule',
+ created_at: '2026-07-01T00:00:00Z',
},
- scanner_result: null,
- triggered_by: 'schedule',
- created_at: '2026-07-01T00:00:00Z',
- },
+ ],
},
post: {
'/api/projects/:team/vision/observations/:id/retry/': retrySpy,
@@ -48,18 +55,37 @@ describe('replayObservationLogic', () => {
sceneLogic?.unmount()
})
- it('retry hands off to the scanner page because the retried row is deleted', async () => {
+ // A one-off "Summarize this recording" scan mints an inline scanner the scanner endpoints refuse to
+ // serve, so a back button aimed at it 404s and drops the reader on the vision empty state. Both ways
+ // off this page, going back and retrying, must land on the recording instead.
+ test.each([
+ {
+ origin: 'configured' as const,
+ destination: '/replay-vision/scanner-9',
+ leadsTo: 'the scanner page',
+ },
+ {
+ origin: 'inline' as const,
+ destination: '/replay/sess-1',
+ leadsTo: 'the recording',
+ },
+ ])('$origin scanner observations lead back to $leadsTo', async ({ origin, destination }) => {
+ scannerOrigin = origin
const logic = replayObservationLogic({ id: 'obs-1' })
logic.mount()
try {
await expectLogic(logic).toDispatchActions(['loadObservationSuccess'])
+ // The scene's back button follows the second-to-last crumb, so that's what "back" means here.
+ const { breadcrumbs } = sceneLogic.values
+ expect(breadcrumbs[breadcrumbs.length - 2].path).toBe(destination)
+
await expectLogic(logic, () => logic.actions.retryObservation()).toDispatchActions([
'retryObservationSuccess',
])
expect(retrySpy).toHaveBeenCalledTimes(1)
expect(logic.values.retrying).toBe(false)
// Staying put would poll a deleted id and toast an error per tick.
- expect(router.values.location.pathname).toContain('/replay-vision/scanner-9')
+ expect(router.values.location.pathname).toContain(destination)
} finally {
logic.unmount()
}
diff --git a/products/replay_vision/frontend/observations/replayObservationLogic.ts b/products/replay_vision/frontend/observations/replayObservationLogic.ts
index e9c05dd98db8..745234162588 100644
--- a/products/replay_vision/frontend/observations/replayObservationLogic.ts
+++ b/products/replay_vision/frontend/observations/replayObservationLogic.ts
@@ -5,11 +5,15 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
+import { Breadcrumb } from '~/types'
+
import { visionObservationsRetrieve } from '../generated/api'
import type { ReplayObservationApi, VisionObservationsRetrieveParams } from '../generated/api.schemas'
import { scheduleObservationPoll } from '../logics/observationPolling'
import { requestObservationRetry } from '../logics/observationRetry'
import { OBSERVATION_LIST_FILTER_KEYS } from '../replay_scanners/types'
+import { scannerBreadcrumb } from '../utils/breadcrumbs'
+import { hasScannerPage, scannerLabel } from '../utils/observation'
import { parseNumericParam } from '../utils/urlParams'
import { observationProgressLogic } from './observationProgressLogic'
import { replayObservationSceneLogic } from './replayObservationSceneLogic'
@@ -38,6 +42,31 @@ export function neighborFilterParams(searchParams: Record<string, unknown>): Vis
return params as VisionObservationsRetrieveParams
}
+/**
+ * Where an observation belongs, and so where both ways off its page lead: going back, and retrying.
+ *
+ * A saved scanner owns its observations and lists them. A one-off scan is owned by the recording it
+ * ran from, which is also the safe side of [hasScannerPage] because it always resolves.
+ */
+export function observationParentUrl(observation: ReplayObservationApi): string {
+ return hasScannerPage(observation)
+ ? urls.replayVision(observation.scanner_id)
+ : urls.replaySingle(observation.session_id)
+}
+
+/** The crumb the observation page's back button returns to. */
+export function observationParentBreadcrumb(observation: ReplayObservationApi): Breadcrumb {
+ if (hasScannerPage(observation)) {
+ return scannerBreadcrumb(observation.scanner_id, scannerLabel(observation))
+ }
+ return {
+ key: `recording-${observation.session_id}`,
+ name: 'Recording',
+ path: observationParentUrl(observation),
+ iconType: 'session_replay',
+ }
+}
+
/** Canonical link to an observation's detail page, carrying list filters so prev/next honors them. */
export function observationDetailUrl(id: string, filterParams: Record<string, string | number>): string {
return combineUrl(urls.replayVisionObservation(id), filterParams).url
@@ -151,11 +180,9 @@ export const replayObservationLogic = kea<replayObservationLogicType>([
neighborFilterParams(router.values.searchParams)
)
actions.loadObservationSuccess(response)
- // Link the breadcrumb to the parent scanner so "back" returns to the scanner, not the vision home.
- replayObservationSceneLogic().actions.setScannerContext(
- response.scanner_id,
- response.scanner_snapshot?.name ?? null
- )
+ // Point the breadcrumb at whatever owns this observation, so "back" returns there
+ // instead of the vision home.
+ replayObservationSceneLogic().actions.setParentBreadcrumb(observationParentBreadcrumb(response))
} catch (error: any) {
// Only toast the initial load — background poll retries would otherwise spam one toast per tick.
if (!values.observation) {
@@ -169,20 +196,23 @@ export const replayObservationLogic = kea<replayObservationLogicType>([
loadObservationFailure: reschedulePoll,
retryObservation: async () => {
+ // The retried row is deleted, so this page's id dangles afterwards. Hand off to whatever
+ // owns the observation, which is where the replacement appears.
+ const observation = values.observation
+ const lands = observation && hasScannerPage(observation) ? 'scanner page' : 'recording'
const retried = await requestObservationRetry(
props.id,
- 'Retrying scan — the new observation will appear on the scanner page shortly.'
+ `Retrying scan. The new observation will appear on the ${lands} shortly.`
)
if (!retried) {
actions.retryObservationFailure()
return
}
actions.retryObservationSuccess()
- // The retried row is deleted, so this page's id now dangles — hand off to the scanner.
- const scannerId = values.observation?.scanner_id
- if (scannerId) {
- router.actions.push(urls.replayVision(scannerId))
+ if (!observation) {
+ return
}
+ router.actions.push(observationParentUrl(observation))
},
// When the stream reports the observation has settled, reload once to render the final result.
diff --git a/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts b/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts
index 7730a5866a44..ee4ea99ddebe 100644
--- a/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts
+++ b/products/replay_vision/frontend/observations/replayObservationSceneLogic.ts
@@ -5,14 +5,13 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
+import { VISION_ROOT_BREADCRUMB } from '../utils/breadcrumbs'
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface replayObservationSceneLogicValues {
breadcrumbs: Breadcrumb[]
observationId: string
- scannerContext: {
- scannerId: string | null
- scannerName: string | null
- }
+ parentBreadcrumb: Breadcrumb | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -20,25 +19,15 @@ export interface replayObservationSceneLogicActions {
setObservationId: (observationId: string) => {
observationId: string
}
- setScannerContext: (
- scannerId: string | null,
- scannerName: string | null
- ) => {
- scannerId: string | null
- scannerName: string | null
+ setParentBreadcrumb: (parentBreadcrumb: Breadcrumb | null) => {
+ parentBreadcrumb: Breadcrumb | null
}
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface replayObservationSceneLogicMeta {
__keaTypeGenInternalSelectorTypes: {
- breadcrumbs: (
- observationId: string,
- scannerContext: {
- scannerId: string | null
- scannerName: string | null
- }
- ) => Breadcrumb[]
+ breadcrumbs: (observationId: string, parentBreadcrumb: Breadcrumb | null) => Breadcrumb[]
}
}
@@ -54,8 +43,9 @@ export const replayObservationSceneLogic = kea<replayObservationSceneLogicType>(
actions({
setObservationId: (observationId: string) => ({ observationId }),
- // Pushed by replayObservationLogic once the observation loads, so the breadcrumb can link to its scanner.
- setScannerContext: (scannerId: string | null, scannerName: string | null) => ({ scannerId, scannerName }),
+ // 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 }),
}),
reducers({
@@ -65,45 +55,28 @@ export const replayObservationSceneLogic = kea<replayObservationSceneLogicType>(
setObservationId: (_, { observationId }) => observationId,
},
],
- scannerContext: [
- { scannerId: null, scannerName: null } as { scannerId: string | null; scannerName: string | null },
+ parentBreadcrumb: [
+ null as Breadcrumb | null,
{
- setScannerContext: (_, { scannerId, scannerName }) => ({ scannerId, scannerName }),
- // Clear when navigating to a different observation so we don't briefly show the previous scanner.
- setObservationId: () => ({ scannerId: null, scannerName: null }),
+ setParentBreadcrumb: (_, { parentBreadcrumb }) => parentBreadcrumb,
+ // Clear when navigating to a different observation so we don't briefly show the previous parent.
+ setObservationId: () => null,
},
],
}),
selectors({
breadcrumbs: [
- (s) => [s.observationId, s.scannerContext],
- (
- observationId: string,
- scannerContext: { scannerId: string | null; scannerName: string | null }
- ): Breadcrumb[] => {
- const breadcrumbs: Breadcrumb[] = [
- {
- key: 'replay-vision',
- name: 'Replay vision',
- path: urls.replayVision(),
- iconType: 'replay_vision',
- },
- ]
- if (scannerContext.scannerId) {
- breadcrumbs.push({
- key: `scanner-${scannerContext.scannerId}`,
- name: scannerContext.scannerName || 'Scanner',
- path: urls.replayVision(scannerContext.scannerId),
- })
- }
- breadcrumbs.push({
+ (s) => [s.observationId, s.parentBreadcrumb],
+ (observationId: string, parentBreadcrumb: Breadcrumb | null): Breadcrumb[] => [
+ VISION_ROOT_BREADCRUMB,
+ ...(parentBreadcrumb ? [parentBreadcrumb] : []),
+ {
key: observationId ? `observation-${observationId}` : 'observation',
name: 'Observation',
path: urls.replayVisionObservation(observationId),
- })
- return breadcrumbs
- },
+ },
+ ],
],
}),
diff --git a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
index c09723dd6ffd..6359f7181baf 100644
--- a/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/actionEditorSceneLogic.ts
@@ -24,6 +24,7 @@ import {
VisionAlertMetricEnumApi,
} from '../generated/api.schemas'
import type { VisionActionApi } from '../generated/api.schemas'
+import { VISION_ROOT_BREADCRUMB, scannerBreadcrumb } from '../utils/breadcrumbs'
import { parseRruleToCadence } from './cadence'
import { visionActionRunsLogic } from './visionActionRunsLogic'
import { buildActionBody, NEW_ACTION_FORM, VisionActionForm, visionActionsLogic } from './visionActionsLogic'
@@ -227,21 +228,10 @@ export const actionEditorSceneLogic = kea<actionEditorSceneLogicType>([
loadedAction: VisionActionApi | null,
scannerName: string
): Breadcrumb[] => {
- const crumbs: Breadcrumb[] = [
- {
- key: 'replay-vision',
- name: 'Replay vision',
- path: urls.replayVision(),
- iconType: 'replay_vision',
- },
- ]
+ const crumbs: Breadcrumb[] = [VISION_ROOT_BREADCRUMB]
if (isNew) {
if (effectiveScannerId) {
- crumbs.push({
- key: `scanner-${effectiveScannerId}`,
- name: scannerName || 'Scanner',
- path: `${urls.replayVision(effectiveScannerId)}?tab=actions`,
- })
+ crumbs.push(scannerBreadcrumb(effectiveScannerId, scannerName, 'actions'))
}
crumbs.push({ key: 'new-action', name: 'New' })
return crumbs
diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts
index e07b4a4b61a0..514f254add2d 100644
--- a/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/replayScannerSceneLogic.ts
@@ -8,6 +8,8 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
+import { VISION_ROOT_BREADCRUMB } from '../utils/breadcrumbs'
+
export enum ReplayScannerTab {
Overview = 'overview',
Observations = 'observations',
@@ -93,12 +95,7 @@ export const replayScannerSceneLogic = kea<replayScannerSceneLogicType>([
breadcrumbs: [
(s) => [s.scannerId],
(scannerId: string): Breadcrumb[] => [
- {
- key: 'replay-vision',
- name: 'Replay vision',
- path: urls.replayVision(),
- iconType: 'replay_vision',
- },
+ VISION_ROOT_BREADCRUMB,
{
key: scannerId === 'new' ? 'new-scanner' : `scanner-${scannerId}`,
name: scannerId === 'new' ? 'New scanner' : 'Scanner',
diff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts
index 39a9756df83b..60bdb864b546 100644
--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts
@@ -6,6 +6,8 @@ import { urls } from 'scenes/urls'
import { tagsModel } from '~/models/tagsModel'
import { Breadcrumb } from '~/types'
+import { VISION_ROOT_BREADCRUMB, scannerBreadcrumb } from '../utils/breadcrumbs'
+
export type ScannerEditorStep = 'template' | 'details' | 'configure' | 'triggers' | 'budget'
export const SCANNER_EDITOR_STEPS: readonly ScannerEditorStep[] = [
'template',
@@ -159,14 +161,7 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([
step: ScannerEditorStep,
searchParams: Record<string, any>
): Breadcrumb[] => {
- const crumbs: Breadcrumb[] = [
- {
- key: 'replay-vision',
- name: 'Replay vision',
- path: urls.replayVision(),
- iconType: 'replay_vision',
- },
- ]
+ const crumbs: Breadcrumb[] = [VISION_ROOT_BREADCRUMB]
if (isNew) {
// The back arrow targets the second-to-last crumb, so past the template step the
// 'New scanner' crumb points at the template picker and the current step trails it.
@@ -182,18 +177,11 @@ export const scannerEditorSceneLogic = kea<scannerEditorSceneLogicType>([
}
// Editing an existing scanner: surface the detail page (on its Configuration tab, where the
// Edit button lives) as an intermediate crumb so the back arrow returns there, not to the list.
- crumbs.push(
- {
- key: `scanner-${scannerId}`,
- name: 'Scanner',
- path: `${urls.replayVision(scannerId)}?tab=configuration`,
- },
- {
- key: `scanner-${scannerId}-edit`,
- name: 'Edit',
- path: urls.replayVisionScannerConfigure(scannerId),
- }
- )
+ crumbs.push(scannerBreadcrumb(scannerId, null, 'configuration'), {
+ key: `scanner-${scannerId}-edit`,
+ name: 'Edit',
+ path: urls.replayVisionScannerConfigure(scannerId),
+ })
return crumbs
},
],
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts
index 111ad9c930c1..ab5c9c4d22ac 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionRunSceneLogic.ts
@@ -10,6 +10,7 @@ import { Breadcrumb } from '~/types'
import { visionActionsRetrieve, visionActionsRunsRetrieve } from '../generated/api'
import type { RunObservationApi, VisionActionApi, VisionActionRunApi } from '../generated/api.schemas'
+import { VISION_ROOT_BREADCRUMB, scannerBreadcrumb } from '../utils/breadcrumbs'
/**
* Resolve the `[obs N]` citation markers the synthesizer leaves in a group summary into `[N]` links to
@@ -160,20 +161,9 @@ export const visionActionRunSceneLogic = kea<visionActionRunSceneLogicType>([
action: VisionActionApi | null,
run: VisionActionRunApi | null
): Breadcrumb[] => {
- const breadcrumbs: Breadcrumb[] = [
- {
- key: 'replay-vision',
- name: 'Replay vision',
- path: urls.replayVision(),
- iconType: 'replay_vision',
- },
- ]
+ const breadcrumbs: Breadcrumb[] = [VISION_ROOT_BREADCRUMB]
if (action?.scanner) {
- breadcrumbs.push({
- key: `scanner-${action.scanner}`,
- name: 'Scanner',
- path: `${urls.replayVision(action.scanner)}?tab=actions`,
- })
+ breadcrumbs.push(scannerBreadcrumb(action.scanner, null, 'actions'))
}
breadcrumbs.push({
key: actionId ? `action-${actionId}` : 'action',
diff --git a/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts
index 2c9211c03459..a0d52c754932 100644
--- a/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/visionActionSceneLogic.ts
@@ -5,6 +5,8 @@ import { urls } from 'scenes/urls'
import { Breadcrumb } from '~/types'
+import { VISION_ROOT_BREADCRUMB, scannerBreadcrumb } from '../utils/breadcrumbs'
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface visionActionSceneLogicValues {
actionContext: {
@@ -79,20 +81,9 @@ export const visionActionSceneLogic = kea<visionActionSceneLogicType>([
breadcrumbs: [
(s) => [s.actionId, s.actionContext],
(actionId: string, context: { name: string | null; scannerId: string | null }): Breadcrumb[] => {
- const breadcrumbs: Breadcrumb[] = [
- {
- key: 'replay-vision',
- name: 'Replay vision',
- path: urls.replayVision(),
- iconType: 'replay_vision',
- },
- ]
+ const breadcrumbs: Breadcrumb[] = [VISION_ROOT_BREADCRUMB]
if (context.scannerId) {
- breadcrumbs.push({
- key: `scanner-${context.scannerId}`,
- name: 'Scanner',
- path: `${urls.replayVision(context.scannerId)}?tab=actions`,
- })
+ breadcrumbs.push(scannerBreadcrumb(context.scannerId, null, 'actions'))
}
breadcrumbs.push({
key: actionId ? `action-${actionId}` : 'action',
diff --git a/products/replay_vision/frontend/search/ObservationSearchTab.tsx b/products/replay_vision/frontend/search/ObservationSearchTab.tsx
index d521de43c64f..5a36a252bf22 100644
--- a/products/replay_vision/frontend/search/ObservationSearchTab.tsx
+++ b/products/replay_vision/frontend/search/ObservationSearchTab.tsx
@@ -11,6 +11,7 @@ import { urls } from 'scenes/urls'
import { ObservationResultSummary } from '../components/ObservationCard'
import { ScannerTypeBadge } from '../components/ScannerTypeBadge'
import type { ObservationSearchResultApi } from '../generated/api.schemas'
+import { scannerLabel } from '../utils/observation'
import { observationSearchLogic } from './observationSearchLogic'
import { snippetSegments } from './snippetSegments'
@@ -43,10 +44,12 @@ function SearchResultCard({
data-attr="vision-search-result"
>
<div className="flex items-center gap-2 min-w-0">
- {showScanner && snapshot && (
+ {showScanner && (
<>
- <span className="font-semibold text-sm truncate">{snapshot.name || 'Scanner'}</span>
- <ScannerTypeBadge scannerType={snapshot.scanner_type} size="small" variant="muted" />
+ <span className="font-semibold text-sm truncate">{scannerLabel(observation)}</span>
+ {snapshot && (
+ <ScannerTypeBadge scannerType={snapshot.scanner_type} size="small" variant="muted" />
+ )}
</>
)}
<span className="font-mono text-xs text-muted truncate">{observation.session_id}</span>
diff --git a/products/replay_vision/frontend/utils/breadcrumbs.ts b/products/replay_vision/frontend/utils/breadcrumbs.ts
new file mode 100644
index 000000000000..d95282f965dc
--- /dev/null
+++ b/products/replay_vision/frontend/utils/breadcrumbs.ts
@@ -0,0 +1,21 @@
+import { urls } from 'scenes/urls'
+
+import { Breadcrumb } from '~/types'
+
+/** Every Replay vision scene hangs off this crumb, so it lives in one place rather than six. */
+export const VISION_ROOT_BREADCRUMB: Breadcrumb = {
+ key: 'replay-vision',
+ name: 'Replay vision',
+ path: urls.replayVision(),
+ iconType: 'replay_vision',
+}
+
+/** A crumb pointing at a saved scanner's page, optionally deep-linked to one of its tabs. */
+export function scannerBreadcrumb(scannerId: string, name?: string | null, tab?: string): Breadcrumb {
+ const path = urls.replayVision(scannerId)
+ return {
+ key: `scanner-${scannerId}`,
+ name: name || 'Scanner',
+ path: tab ? `${path}?tab=${tab}` : path,
+ }
+}
diff --git a/products/replay_vision/frontend/utils/observation.test.ts b/products/replay_vision/frontend/utils/observation.test.ts
index 3173759b6caa..eaf3bd0d0697 100644
--- a/products/replay_vision/frontend/utils/observation.test.ts
+++ b/products/replay_vision/frontend/utils/observation.test.ts
@@ -4,6 +4,7 @@ import {
dockObservations,
observationClipboardText,
observationSeekbarMarks,
+ scannerLabel,
} from './observation'
const summarizerEntry = { scannerName: 'Session summarizer', headline: null, snippet: 'Rage clicked pay' }
@@ -134,6 +135,31 @@ describe('observation utils', () => {
},
],
},
+ {
+ // A one-off summarize is the scan most likely to cite a timestamp, and its scanner has
+ // no name. Passing the raw name through leaves the tooltip line blank, because a
+ // summarizer has no headline to fall back on either.
+ name: 'a quick summary labels its mark rather than leaving it blank',
+ observations: [
+ {
+ ...makeObservation('summarizer', {
+ summary: 'Rage clicked pay',
+ summary_segments: [
+ { kind: 'text', value: 'Rage clicked pay' },
+ { kind: 'chip', timestamp_ms: 42_000 },
+ ],
+ }),
+ scanner_origin: 'inline',
+ scanner_snapshot: { scanner_type: 'summarizer', name: '' },
+ } as unknown as ReplayObservationApi,
+ ],
+ expected: [
+ {
+ timestampMs: 42_000,
+ entries: [{ scannerName: 'Quick summary', headline: null, snippet: 'Rage clicked pay' }],
+ },
+ ],
+ },
{
name: 'output without citations yields no marks',
observations: [makeObservation('monitor', { verdict: 'yes', reasoning: 'Error toast shown.' })],
@@ -182,4 +208,24 @@ describe('observation utils', () => {
expect(dockObservations(observations).map((o) => o.id)).toEqual(expectedIds)
})
})
+
+ describe('scannerLabel', () => {
+ // A one-off scan's scanner is unnamed, so falling back to the snapshot name renders a blank
+ // label in the player dock, the sidebar, and search, which are the surfaces that flow is made of.
+ // The name it gets instead has to be the dock's own word for the thing the person clicked.
+ const scanned = (scannerOrigin: string, scannerType: string, scannerName: string): ReplayObservationApi =>
+ ({
+ ...makeObservation(scannerType, null, 'succeeded', scannerName),
+ scanner_origin: scannerOrigin,
+ }) as unknown as ReplayObservationApi
+
+ it.each<[string, string, string, string, string]>([
+ ['a saved scanner uses its name', 'configured', 'monitor', 'Ghost bugs', 'Ghost bugs'],
+ ['the dock summarize button answers to its own label', 'inline', 'summarizer', '', 'Quick summary'],
+ ['a one-off scan that is not a summary stays generic', 'inline', 'monitor', '', 'One-off scan'],
+ ['an unnamed saved scanner still reads as a scanner', 'configured', 'monitor', '', 'Scanner'],
+ ])('%s', (_, scannerOrigin, scannerType, scannerName, expected) => {
+ expect(scannerLabel(scanned(scannerOrigin, scannerType, scannerName))).toBe(expected)
+ })
+ })
})
diff --git a/products/replay_vision/frontend/utils/observation.ts b/products/replay_vision/frontend/utils/observation.ts
index d8ba9df1d78c..c2c667c66683 100644
--- a/products/replay_vision/frontend/utils/observation.ts
+++ b/products/replay_vision/frontend/utils/observation.ts
@@ -1,8 +1,27 @@
import { dayjs } from 'lib/dayjs'
-import type { ReplayObservationApi } from '../generated/api.schemas'
+import { type ReplayObservationApi, ScannerOriginEnumApi, ScannerTypeEnumApi } from '../generated/api.schemas'
import { citedTextToPlainText, parseCitedSegments } from './citations'
+/** The dock's built-in prompt and the observations it produces have to answer to one name. */
+export const BUILT_IN_SUMMARY_LABEL = 'Quick summary'
+
+/** Only a confirmed saved scanner has a page, so an origin a later release adds fails safe to no link. */
+export function hasScannerPage(obs: Pick<ReplayObservationApi, 'scanner_origin'>): boolean {
+ return obs.scanner_origin === ScannerOriginEnumApi.Configured
+}
+
+/** What to call the scan behind an observation, anywhere one is named next to its result. */
+export function scannerLabel(obs: Pick<ReplayObservationApi, 'scanner_origin' | 'scanner_snapshot'>): string {
+ if (obs.scanner_origin !== ScannerOriginEnumApi.Inline) {
+ return obs.scanner_snapshot?.name || 'Scanner'
+ }
+ // A one-off scan has no name to borrow, so its result answers to whatever the dock called the prompt.
+ return obs.scanner_snapshot?.scanner_type === ScannerTypeEnumApi.Summarizer
+ ? BUILT_IN_SUMMARY_LABEL
+ : 'One-off scan'
+}
+
export function readModelOutput(obs: ReplayObservationApi): Record<string, unknown> | null {
const out = obs.scanner_result?.model_output
return out && typeof out === 'object' ? (out as Record<string, unknown>) : null
@@ -99,7 +118,7 @@ export function readTags(obs: ReplayObservationApi): string[] {
}
export interface ObservationSeekbarMarkEntry {
- scannerName: string | null
+ scannerName: string
headline: string | null
snippet: string | null
}
@@ -180,7 +199,7 @@ function observationHeadline(obs: ReplayObservationApi): string | null {
export function observationSeekbarMarks(observations: ReplayObservationApi[]): ObservationSeekbarMark[] {
const entriesByTimestamp = new Map<number, Map<string, ObservationSeekbarMarkEntry>>()
for (const obs of observations) {
- const scannerName = obs.scanner_snapshot?.name ?? null
+ const scannerName = scannerLabel(obs)
const headline = observationHeadline(obs)
for (const { timestampMs, snippet } of readCitations(obs)) {
const entries = entriesByTimestamp.get(timestampMs) ?? new Map<string, ObservationSeekbarMarkEntry>()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index e8b3d8ce864d..f8bb076f1203 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -51104,6 +51104,18 @@ export namespace Schemas {
version_markers: ObservationVersionMarker[];
}
+ /**
+ * * `configured` - Configured
+ * * `inline` - Inline
+ */
+ export type ScannerOriginEnum = typeof ScannerOriginEnum[keyof typeof ScannerOriginEnum];
+
+
+ export const ScannerOriginEnum = {
+ Configured: 'configured',
+ Inline: 'inline',
+ } as const;
+
/**
* * `pending` - Pending
* * `running` - Running
@@ -51193,6 +51205,11 @@ export namespace Schemas {
readonly id: string;
/** The scanner that produced this observation. */
readonly scanner_id: string;
+ /** Where the producing scanner came from. `configured` scanners are saved, named, and have a detail page; `inline` ones are throwaways minted for a one-off scan and are not addressable, so callers must not link to them.
+ *
+ * * `configured` - Configured
+ * * `inline` - Inline */
+ readonly scanner_origin: ScannerOriginEnum;
/** Session recording id this scanner was applied to. */
readonly session_id: string;
/** Observation status (pending, running, succeeded, failed, ineligible).