Skip to content

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

feat(replay-vision): observation page and navigation UX improvements (#69930)

Tue Haulund7b71a36ebdbd
diff --git a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
index c313263e3ec9..aeca261bff6a 100644
--- a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
+++ b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
@@ -25,6 +25,7 @@ export { createPlaybackSpeedKey } from './PurePlayer'
export interface SessionRecordingPlayerProps extends SessionRecordingPlayerLogicProps {
noMeta?: boolean
noBorder?: boolean
+ noDock?: boolean
withSidebar?: boolean
matchingEventsMatchType?: MatchingEventsMatchType
accessToken?: string
@@ -38,6 +39,7 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX.
noMeta = false,
matchingEventsMatchType,
noBorder = false,
+ noDock = false,
withSidebar = true,
autoPlay = true,
mode = SessionRecordingPlayerMode.Standard,
@@ -71,6 +73,7 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX.
<SessionRecordingPlayerInternal
noMeta={noMeta}
noBorder={noBorder}
+ noDock={noDock}
withSidebar={withSidebar}
playerRef={playerRef}
/>
@@ -81,11 +84,13 @@ export function SessionRecordingPlayer(props: SessionRecordingPlayerProps): JSX.
function SessionRecordingPlayerInternal({
noMeta,
noBorder,
+ noDock,
withSidebar,
playerRef,
}: {
noMeta: boolean
noBorder: boolean
+ noDock: boolean
withSidebar: boolean
playerRef: React.RefObject<HTMLDivElement>
}): JSX.Element {
@@ -93,7 +98,9 @@ function SessionRecordingPlayerInternal({
const { logicProps } = useValues(sessionRecordingPlayerLogic)
const { featureFlags } = useValues(featureFlagLogic)
const showSummaryDock =
- !noMeta && (logicProps.mode ?? SessionRecordingPlayerMode.Standard) === SessionRecordingPlayerMode.Standard
+ !noMeta &&
+ !noDock &&
+ (logicProps.mode ?? SessionRecordingPlayerMode.Standard) === SessionRecordingPlayerMode.Standard
const showVisionDock = showSummaryDock && !!featureFlags[FEATURE_FLAGS.REPLAY_VISION]
return (
diff --git a/products/replay_vision/backend/api/observations.py b/products/replay_vision/backend/api/observations.py
index 79174a27d6a3..db54c4971f4e 100644
--- a/products/replay_vision/backend/api/observations.py
+++ b/products/replay_vision/backend/api/observations.py
@@ -154,7 +154,7 @@ class ReplayObservationSerializer(serializers.ModelSerializer):
triggered_by = serializers.ChoiceField(
choices=ObservationTrigger.choices,
read_only=True,
- help_text="Whether this observation came from the schedule or an on-demand request.",
+ help_text="Whether this observation came from the schedule, an on-demand request, or a retry of a failed observation.",
)
triggered_by_user = UserBasicSerializer(
read_only=True,
@@ -175,10 +175,16 @@ class ReplayObservationSerializer(serializers.ModelSerializer):
),
)
previous_observation_id = serializers.SerializerMethodField(
- help_text="Id of the newer sibling observation for the same scanner (prev/next nav); only set on retrieve, null at the start.",
+ help_text=(
+ "Id of the preceding sibling observation for the same scanner (prev/next nav), honoring any list "
+ "filters and ordering passed to retrieve; only set on retrieve, null at the start of the set."
+ ),
)
next_observation_id = serializers.SerializerMethodField(
- help_text="Id of the older sibling observation for the same scanner (prev/next nav); only set on retrieve, null at the end.",
+ help_text=(
+ "Id of the following sibling observation for the same scanner (prev/next nav), honoring any list "
+ "filters and ordering passed to retrieve; only set on retrieve, null at the end of the set."
+ ),
)
@extend_schema_field(serializers.UUIDField(allow_null=True))
@@ -444,7 +450,7 @@ class ReplayObservationFilter(django_filters.FilterSet):
triggered_by = MultiChoiceFilter(
field_name="triggered_by",
valid_choices=frozenset(v for v, _ in ObservationTrigger.choices),
- help_text="Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.",
+ help_text="Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.",
)
verdict = MultiChoiceFilter(
field_name="scanner_result__model_output__verdict",
@@ -522,25 +528,32 @@ class ReplayObservationFilter(django_filters.FilterSet):
return queryset.filter(q)
+# OrderingFilter renders as an array by default, which the MCP client serializes as a JSON-bracketed
+# string the filter rejects. Declare it as a single-value string enum so it serializes as ?order_by=field.
+_ORDER_BY_PARAMETER = OpenApiParameter(
+ "order_by",
+ str,
+ OpenApiParameter.QUERY,
+ required=False,
+ enum=ordering_enum(_ALL_ORDER_KEYS),
+ description=(
+ "Sort observations. Plain keys: created_at, started_at, completed_at, status, "
+ "recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), "
+ "scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way."
+ ),
+)
+
+
@extend_schema_view(
- list=extend_schema(
- parameters=[
- # OrderingFilter renders as an array by default, which the MCP client serializes as a JSON-bracketed
- # string the filter rejects. Declare it as a single-value string enum so it serializes as ?order_by=field.
- OpenApiParameter(
- "order_by",
- str,
- OpenApiParameter.QUERY,
- required=False,
- enum=ordering_enum(_ALL_ORDER_KEYS),
- description=(
- "Sort observations. Plain keys: created_at, started_at, completed_at, status, "
- "recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), "
- "scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way."
- ),
- )
- ]
- )
+ list=extend_schema(parameters=[_ORDER_BY_PARAMETER]),
+ retrieve=extend_schema(
+ parameters=[*ReplayObservationFilter.schema_parameters(), _ORDER_BY_PARAMETER],
+ description=(
+ "Retrieve one observation. Any list filters passed along (status, tags, order_by, …) scope the "
+ "`previous_observation_id`/`next_observation_id` navigation to the matching, identically-ordered "
+ "set — so prev/next from a filtered table stays within that filtered list."
+ ),
+ ),
)
class ReplayObservationViewSet(
TeamAndOrgViewSetMixin,
@@ -550,6 +563,9 @@ class ReplayObservationViewSet(
):
"""Read-only access to observations produced by a scanner."""
+ # Upper bound on ids materialized for filtered prev/next computation (see `_observation_neighbors`).
+ NEIGHBOR_SCAN_LIMIT = 5000
+
scope_object = "replay_scanner"
required_scopes = ["replay_scanner:read", "session_recording:read"]
permission_classes = [ReplayVisionEnabledPermission]
@@ -585,6 +601,61 @@ class ReplayObservationViewSet(
.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.
+ if self.action == "retrieve":
+ return queryset
+ return super().filter_queryset(queryset)
+
+ def retrieve(self, request: Request, *args: Any, **kwargs: Any) -> Response:
+ observation = self.get_object()
+ context = {**self.get_serializer_context(), "neighbors": self._observation_neighbors(observation)}
+ return Response(self.get_serializer(observation, context=context).data)
+
+ def _observation_neighbors(self, observation: ReplayObservation) -> dict[str, uuid.UUID | None]:
+ # Neighbors honor the same filters and ordering as the scanner's list endpoint, so prev/next
+ # navigation started from a filtered table stays within the filtered set.
+ siblings = ReplayObservation.objects.filter(
+ team_id=observation.team_id, scanner_id=observation.scanner_id
+ ).order_by("-created_at", "id")
+ # Empty values (`?status=`) are no-ops in the filterset, so they must not opt out of the fast path.
+ if not any(self.request.query_params.get(key) for key in ReplayObservationFilter.base_filters):
+ return self._unfiltered_neighbors(observation, siblings)
+ filterset = ReplayObservationFilter(self.request.query_params, queryset=siblings, request=self.request)
+ if not filterset.is_valid():
+ # Same 400 the list endpoint gives for the identical bad query string.
+ raise ValidationError(filterset.errors)
+ # Hard bound on the id scan; past it, degrade to no neighbors rather than unbounded memory.
+ ids: list[uuid.UUID] = list(filterset.qs.values_list("id", flat=True)[: self.NEIGHBOR_SCAN_LIMIT])
+ try:
+ index = ids.index(observation.id)
+ except ValueError:
+ # Outside the filtered set (stale deep link) or beyond the scan bound — no neighbors.
+ return {"previous": None, "next": None}
+ return {
+ "previous": ids[index - 1] if index > 0 else None,
+ "next": ids[index + 1] if index < len(ids) - 1 else None,
+ }
+
+ @staticmethod
+ def _unfiltered_neighbors(
+ observation: ReplayObservation, siblings: QuerySet[ReplayObservation]
+ ) -> dict[str, uuid.UUID | None]:
+ # Two indexed lookups instead of materializing every sibling id; mirrors the (-created_at, id) order.
+ ids = siblings.values_list("id", flat=True)
+ return {
+ "previous": ids.filter(
+ Q(created_at__gt=observation.created_at) | Q(created_at=observation.created_at, id__lt=observation.id)
+ )
+ .order_by("created_at", "-id")
+ .first(),
+ "next": ids.filter(
+ Q(created_at__lt=observation.created_at) | Q(created_at=observation.created_at, id__gt=observation.id)
+ )
+ .order_by("-created_at", "id")
+ .first(),
+ }
+
@extend_schema(
parameters=[
*ReplayObservationFilter.schema_parameters(),
@@ -632,22 +703,33 @@ class ReplayObservationViewSet(
check_team_in_flight_capacity(self.team.id)
session_id = observation.session_id
# Free the UNIQUE(scanner, session_id) slot; the usage ledger is immutable, so the failed attempt stays counted.
+ original_pk = observation.pk
+ original_created_at = observation.created_at
observation.delete()
workflow_id, outcome = start_apply_scanner_workflow(
- scanner, session_id, triggered_by_user_id=cast(User, request.user).id
+ scanner,
+ session_id,
+ triggered_by_user_id=cast(User, request.user).id,
+ trigger=ObservationTrigger.RETRY,
)
+ if outcome is not WorkflowStartOutcome.STARTED:
+ # The replacement run never started, so restore the failed row (its shared label, if any, is lost
+ # to the cascade) instead of leaving the recording looking unscanned.
+ observation.pk = original_pk
+ observation.save(force_insert=True)
+ ReplayObservation.objects.filter(pk=original_pk, team_id=observation.team_id).update(
+ created_at=original_created_at
+ )
if outcome is WorkflowStartOutcome.ALREADY_RUNNING:
# The prior run is still closing, so its deterministic id blocks the restart and no new row will appear.
return Response(
- {"detail": "The previous run is still finishing. Scan the recording again in a moment."},
+ {"detail": "The previous run is still finishing. Retry again in a moment."},
status=status.HTTP_409_CONFLICT,
)
if outcome is WorkflowStartOutcome.FAILED:
# `detail` (not `error`) so ApiError carries the message into the frontend toast.
return Response(
- {
- "detail": "Failed to start the retry. The recording now shows as not scanned and can be scanned again."
- },
+ {"detail": "Failed to start the retry. The failed observation was kept; retry again in a moment."},
status=status.HTTP_503_SERVICE_UNAVAILABLE,
)
return Response(RetryResponseSerializer({"workflow_id": workflow_id}).data, status=status.HTTP_202_ACCEPTED)
@@ -713,7 +795,7 @@ class ReplayObservationViewSet(
description="Session recording id to return observations for.",
)
]
- )
+ ),
)
class SessionReplayObservationViewSet(ReplayObservationViewSet):
"""Read-only access to a session's observations across every scanner the caller can read, for the replay-page dock."""
@@ -746,31 +828,6 @@ class SessionReplayObservationViewSet(ReplayObservationViewSet):
queryset = queryset.filter(session_id=session_id)
return queryset
- def retrieve(self, request: Request, *args: Any, **kwargs: Any) -> Response:
- observation = self.get_object()
- context = {**self.get_serializer_context(), "neighbors": self._observation_neighbors(observation)}
- return Response(self.get_serializer(observation, context=context).data)
-
- @staticmethod
- def _observation_neighbors(observation: ReplayObservation) -> dict[str, uuid.UUID | None]:
- # Newest-first list order, so the newer sibling is "previous" and the older one is "next".
- siblings = ReplayObservation.objects.filter(
- team_id=observation.team_id, scanner_id=observation.scanner_id
- ).values_list("id", flat=True)
- # Tie-break on id to mirror the list's (-created_at, id) order, so same-timestamp siblings aren't skipped.
- return {
- "previous": siblings.filter(
- Q(created_at__gt=observation.created_at) | Q(created_at=observation.created_at, id__lt=observation.id)
- )
- .order_by("created_at", "-id")
- .first(),
- "next": siblings.filter(
- Q(created_at__lt=observation.created_at) | Q(created_at=observation.created_at, id__gt=observation.id)
- )
- .order_by("-created_at", "id")
- .first(),
- }
-
# Hide `stats/` on the session-scoped viewset — it has no `parent_lookup_scanner_id` to dispatch on.
def stats(self, request: Request, **kwargs: Any) -> Response: # type: ignore[override]
raise NotFound()
diff --git a/products/replay_vision/backend/api/scanners.py b/products/replay_vision/backend/api/scanners.py
index 29e38f6db1d2..e8cda2792915 100644
--- a/products/replay_vision/backend/api/scanners.py
+++ b/products/replay_vision/backend/api/scanners.py
@@ -38,6 +38,7 @@ from products.replay_vision.backend.api.trigger import (
from products.replay_vision.backend.billing import observation_credits_for_model
from products.replay_vision.backend.digest import provision_scanner_digest
from products.replay_vision.backend.feature_flag import ReplayVisionEnabledPermission, is_replay_vision_actions_enabled
+from products.replay_vision.backend.models.replay_observation import ObservationTrigger
from products.replay_vision.backend.models.replay_scanner import (
ReplayScanner,
SamplingMode,
@@ -775,7 +776,9 @@ class ReplayScannerViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):
session_id: str = body.validated_data["session_id"]
user = cast(User, request.user)
- workflow_id, outcome = start_apply_scanner_workflow(scanner, session_id, triggered_by_user_id=user.id)
+ workflow_id, outcome = start_apply_scanner_workflow(
+ scanner, session_id, triggered_by_user_id=user.id, trigger=ObservationTrigger.ON_DEMAND
+ )
if outcome is WorkflowStartOutcome.FAILED:
return Response(
{"error": "Failed to start observation workflow"},
diff --git a/products/replay_vision/backend/api/trigger.py b/products/replay_vision/backend/api/trigger.py
index ccff8eca0fe1..ea9ea3c0ec6e 100644
--- a/products/replay_vision/backend/api/trigger.py
+++ b/products/replay_vision/backend/api/trigger.py
@@ -63,7 +63,11 @@ def check_observation_quota(organization_id: UUID, observation_credits: int) ->
def start_apply_scanner_workflow(
- scanner: ReplayScanner, session_id: str, *, triggered_by_user_id: int
+ scanner: ReplayScanner,
+ session_id: str,
+ *,
+ triggered_by_user_id: int,
+ trigger: ObservationTrigger,
) -> tuple[str, WorkflowStartOutcome]:
"""Start the deterministic apply-scanner workflow for one (scanner, session); never raises."""
workflow_id = build_apply_scanner_workflow_id(scanner.id, session_id)
@@ -75,7 +79,7 @@ def start_apply_scanner_workflow(
scanner_id=scanner.id,
session_id=session_id,
team_id=scanner.team_id,
- triggered_by=ObservationTrigger.ON_DEMAND,
+ triggered_by=trigger,
triggered_by_user_id=triggered_by_user_id,
),
id=workflow_id,
diff --git a/products/replay_vision/backend/migrations/0042_alter_replayobservation_triggered_by_and_more.py b/products/replay_vision/backend/migrations/0042_alter_replayobservation_triggered_by_and_more.py
new file mode 100644
index 000000000000..375eebe06816
--- /dev/null
+++ b/products/replay_vision/backend/migrations/0042_alter_replayobservation_triggered_by_and_more.py
@@ -0,0 +1,40 @@
+# Generated by Django 5.2.14 on 2026-07-10 09:52
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("replay_vision", "0041_strip_summarizer_emits_embeddings"),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="replayobservation",
+ name="triggered_by",
+ field=models.CharField(
+ choices=[
+ ("schedule", "Schedule"),
+ ("on_demand", "On demand"),
+ ("retry", "Retry"),
+ ],
+ help_text="What started this observation: a per-scanner schedule fire, an explicit /observe/ call, or a retry of a failed observation.",
+ max_length=16,
+ ),
+ ),
+ migrations.AlterField(
+ model_name="replayobservation",
+ name="triggered_by_user",
+ field=models.ForeignKey(
+ blank=True,
+ help_text="Populated for on-demand and retry triggers; null for schedule-driven observations.",
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ]
diff --git a/products/replay_vision/backend/migrations/max_migration.txt b/products/replay_vision/backend/migrations/max_migration.txt
index 6eba70dd3626..c741b926d9fc 100644
--- a/products/replay_vision/backend/migrations/max_migration.txt
+++ b/products/replay_vision/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0041_strip_summarizer_emits_embeddings
+0042_alter_replayobservation_triggered_by_and_more
diff --git a/products/replay_vision/backend/models/replay_observation.py b/products/replay_vision/backend/models/replay_observation.py
index e759b61adbf9..63428ed70e71 100644
--- a/products/replay_vision/backend/models/replay_observation.py
+++ b/products/replay_vision/backend/models/replay_observation.py
@@ -22,6 +22,7 @@ IN_FLIGHT_STATUSES = (ObservationStatus.PENDING, ObservationStatus.RUNNING)
class ObservationTrigger(models.TextChoices):
SCHEDULE = "schedule", "Schedule"
ON_DEMAND = "on_demand", "On demand"
+ RETRY = "retry", "Retry"
class ReplayObservation(UUIDModel):
@@ -68,7 +69,7 @@ class ReplayObservation(UUIDModel):
triggered_by = models.CharField(
max_length=16,
choices=ObservationTrigger.choices,
- help_text="What started this observation: a per-scanner schedule fire or an explicit /observe/ call.",
+ help_text="What started this observation: a per-scanner schedule fire, an explicit /observe/ call, or a retry of a failed observation.",
)
triggered_by_user = models.ForeignKey(
"posthog.User",
@@ -76,7 +77,7 @@ class ReplayObservation(UUIDModel):
null=True,
blank=True,
related_name="+",
- help_text="Populated for on-demand triggers; null for schedule-driven observations.",
+ help_text="Populated for on-demand and retry triggers; null for schedule-driven observations.",
)
started_at = models.DateTimeField(null=True, blank=True)
diff --git a/products/replay_vision/backend/temporal/activities/emit_observation_event.py b/products/replay_vision/backend/temporal/activities/emit_observation_event.py
index 4a91f251f39e..e6314a21b185 100644
--- a/products/replay_vision/backend/temporal/activities/emit_observation_event.py
+++ b/products/replay_vision/backend/temporal/activities/emit_observation_event.py
@@ -69,7 +69,8 @@ def _emit_event(inputs: EmitObservationEventInputs) -> None:
}
distinct_id = (
str(observation.triggered_by_user_id)
- if observation.triggered_by_user_id is not None and observation.triggered_by == ObservationTrigger.ON_DEMAND
+ if observation.triggered_by_user_id is not None
+ and observation.triggered_by in (ObservationTrigger.ON_DEMAND, ObservationTrigger.RETRY)
else replay_vision_distinct_id(observation.team_id)
)
diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.py
index c66f3095f00e..99096ae9fd6d 100644
--- a/products/replay_vision/backend/tests/test_api.py
+++ b/products/replay_vision/backend/tests/test_api.py
@@ -839,6 +839,18 @@ class TestReplayObservationViewSet(_VisionAPITestCase):
defaults.update(overrides)
return ReplayObservation.objects.create(**defaults)
+ def test_retrieve_with_filters_resolves_object_and_scopes_neighbors_only(self) -> None:
+ observation = self._create_observation(session_id="s-pending")
+ self._create_observation(session_id="s-other")
+
+ url = f"{self.observations_url(str(self.scanner.id))}{observation.id}/?status=succeeded"
+ resp = self.client.get(url)
+ self.assertEqual(resp.status_code, 200, resp.json())
+ body = resp.json()
+ self.assertEqual(body["id"], str(observation.id))
+ self.assertIsNone(body["previous_observation_id"])
+ self.assertIsNone(body["next_observation_id"])
+
def test_list_observations_for_scanner(self) -> None:
self._create_observation(session_id="s1")
self._create_observation(session_id="s2")
@@ -1565,7 +1577,7 @@ class TestRetryActions(_VisionAPITestCase):
args, kwargs = start_workflow.call_args
self.assertEqual(kwargs["id"], expected_workflow_id)
inputs = args[1]
- self.assertEqual(inputs.triggered_by, ObservationTrigger.ON_DEMAND)
+ self.assertEqual(inputs.triggered_by, ObservationTrigger.RETRY)
self.assertEqual(inputs.triggered_by_user_id, self.user.id)
def test_retry_rejects_non_failed_statuses(
@@ -1610,19 +1622,23 @@ class TestRetryActions(_VisionAPITestCase):
self.assertTrue(ReplayObservation.objects.filter(id=observation.id).exists())
start_workflow.assert_not_called()
- def test_retry_dispatch_failure_returns_503_with_row_deleted(
+ def test_retry_dispatch_failure_returns_503_with_row_restored(
self, mock_sync_connect: MagicMock, mock_async_to_sync: MagicMock
) -> None:
- # Documented contract: the slot is freed even when the start fails, so the session can be re-scanned.
+ # The replacement run never started, so the failed row must come back instead of leaving the
+ # recording looking unscanned while the usage ledger still counts the failed attempt.
mock_sync_connect.return_value = MagicMock()
mock_async_to_sync.return_value = MagicMock(side_effect=RuntimeError("temporal unavailable"))
observation = self._create_failed("sess-broken")
+ original_created_at = observation.created_at
resp = self.client.post(self.retry_url(str(observation.id)))
self.assertEqual(resp.status_code, 503)
# `detail` is what the frontend toast surfaces; `error` would be silently dropped.
- self.assertIn("can be scanned again", resp.json()["detail"])
- self.assertFalse(ReplayObservation.objects.filter(id=observation.id).exists())
+ self.assertIn("was kept", resp.json()["detail"])
+ restored = ReplayObservation.objects.get(id=observation.id)
+ self.assertEqual(restored.status, ObservationStatus.FAILED)
+ self.assertEqual(restored.created_at, original_created_at)
def _personal_api_key(self, scopes: list[str]) -> str:
value = generate_random_token_personal()
@@ -1680,8 +1696,8 @@ class TestRetryActions(_VisionAPITestCase):
resp = self.client.post(self.retry_url(str(observation.id)))
self.assertEqual(resp.status_code, 409, resp.json())
- # Documented contract: the slot is already freed; the recording can be scanned again shortly.
- self.assertFalse(ReplayObservation.objects.filter(id=observation.id).exists())
+ # The restart was blocked, so the failed row is restored and the retry can be attempted again.
+ self.assertTrue(ReplayObservation.objects.filter(id=observation.id).exists())
def test_retry_works_on_session_scoped_route(
self, mock_sync_connect: MagicMock, mock_async_to_sync: MagicMock
@@ -1791,6 +1807,53 @@ class TestSessionReplayObservationViewSet(_VisionAPITestCase):
self.assertEqual(body["previous_observation_id"], str(lo.id))
self.assertEqual(body["next_observation_id"], str(hi.id))
+ def test_retrieve_neighbors_honor_list_filters(self) -> None:
+ now = timezone.now()
+ old = self._create_observation(self.scanner_a, "s-old")
+ failed = self._create_observation(self.scanner_a, "s-failed")
+ new = self._create_observation(self.scanner_a, "s-new")
+ ReplayObservation.objects.filter(pk=old.id).update(
+ created_at=now - timedelta(minutes=2), status=ObservationStatus.SUCCEEDED, completed_at=now
+ )
+ ReplayObservation.objects.filter(pk=failed.id).update(
+ created_at=now - timedelta(minutes=1),
+ status=ObservationStatus.FAILED,
+ completed_at=now,
+ error_reason="boom",
+ )
+ ReplayObservation.objects.filter(pk=new.id).update(
+ created_at=now, status=ObservationStatus.SUCCEEDED, completed_at=now
+ )
+
+ unfiltered = self.client.get(f"{self.session_observations_url}{new.id}/").json()
+ self.assertEqual(unfiltered["next_observation_id"], str(failed.id))
+
+ filtered = self.client.get(f"{self.session_observations_url}{new.id}/?status=succeeded").json()
+ self.assertEqual(filtered["next_observation_id"], str(old.id))
+ self.assertIsNone(filtered["previous_observation_id"])
+
+ def test_retrieve_neighbors_honor_order_by(self) -> None:
+ now = timezone.now()
+ old = self._create_observation(self.scanner_a, "s-old")
+ mid = self._create_observation(self.scanner_a, "s-mid")
+ new = self._create_observation(self.scanner_a, "s-new")
+ ReplayObservation.objects.filter(pk=old.id).update(created_at=now - timedelta(minutes=2))
+ ReplayObservation.objects.filter(pk=mid.id).update(created_at=now - timedelta(minutes=1))
+ ReplayObservation.objects.filter(pk=new.id).update(created_at=now)
+
+ # Ascending created_at reverses the list, so prev/next flip relative to the default ordering.
+ body = self.client.get(f"{self.session_observations_url}{mid.id}/?order_by=created_at").json()
+ self.assertEqual(body["previous_observation_id"], str(old.id))
+ self.assertEqual(body["next_observation_id"], str(new.id))
+
+ def test_retrieve_neighbors_empty_when_observation_outside_filtered_set(self) -> None:
+ observation = self._create_observation(self.scanner_a, "s-pending")
+ self._create_observation(self.scanner_a, "s-sibling")
+
+ body = self.client.get(f"{self.session_observations_url}{observation.id}/?status=succeeded").json()
+ self.assertIsNone(body["previous_observation_id"])
+ self.assertIsNone(body["next_observation_id"])
+
class TestReplayScannerEstimateAction(ClickhouseTestMixin, _VisionAPITestCase):
@property
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.ts
index d5de608c92c4..cb8e121f8679 100644
--- a/products/replay_vision/frontend/generated/api.schemas.ts
+++ b/products/replay_vision/frontend/generated/api.schemas.ts
@@ -453,12 +453,14 @@ export interface ScannerResultApi {
/**
* * `schedule` - Schedule
* * `on_demand` - On demand
+ * * `retry` - Retry
*/
export type ObservationTriggerEnumApi = (typeof ObservationTriggerEnumApi)[keyof typeof ObservationTriggerEnumApi]
export const ObservationTriggerEnumApi = {
Schedule: 'schedule',
OnDemand: 'on_demand',
+ Retry: 'retry',
} as const
/**
@@ -496,10 +498,11 @@ export interface ReplayObservationApi {
readonly scanner_snapshot: ScannerSnapshotApi | null
/** Result data persisted on success; null until the observation succeeds. */
readonly scanner_result: ScannerResultApi | null
- /** Whether this observation came from the schedule or an on-demand request.
+ /** Whether this observation came from the schedule, an on-demand request, or a retry of a failed observation.
*
* * `schedule` - Schedule
- * * `on_demand` - On demand */
+ * * `on_demand` - On demand
+ * * `retry` - Retry */
readonly triggered_by: ObservationTriggerEnumApi
/** User who triggered an on-demand observation; null for scheduled observations. */
readonly triggered_by_user: UserBasicApi | null
@@ -514,12 +517,12 @@ export interface ReplayObservationApi {
*/
readonly recording_subject_email: string | null
/**
- * Id of the newer sibling observation for the same scanner (prev/next nav); only set on retrieve, null at the start.
+ * Id of the preceding sibling observation for the same scanner (prev/next nav), honoring any list filters and ordering passed to retrieve; only set on retrieve, null at the start of the set.
* @nullable
*/
readonly previous_observation_id: string | null
/**
- * Id of the older sibling observation for the same scanner (prev/next nav); only set on retrieve, null at the end.
+ * Id of the following sibling observation for the same scanner (prev/next nav), honoring any list filters and ordering passed to retrieve; only set on retrieve, null at the end of the set.
* @nullable
*/
readonly next_observation_id: string | null
@@ -1178,6 +1181,41 @@ export type VisionObservationsListParams = {
session_id: string
}
+export type VisionObservationsRetrieveParams = {
+ /**
+ * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.
+ */
+ labeled?: string
+ /**
+ * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.
+ */
+ order_by?: string
+ /**
+ * Filter to observations whose recording subject email contains this value (case-insensitive).
+ */
+ recording_subject?: string
+ /**
+ * Filter to observations of one or more session recordings. Accepts a comma-separated list.
+ */
+ session_id?: string
+ /**
+ * Filter by observation status. Accepts a comma-separated list.
+ */
+ status?: string
+ /**
+ * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.
+ */
+ tags?: string
+ /**
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
+ */
+ triggered_by?: string
+ /**
+ * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).
+ */
+ verdict?: string
+}
+
export type VisionScannersListParams = {
/**
* Filter to scanners created by the given user IDs (comma-separated).
@@ -1247,7 +1285,42 @@ export type VisionScannersObservationsListParams = {
*/
tags?: string
/**
- * Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
+ */
+ triggered_by?: string
+ /**
+ * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).
+ */
+ verdict?: string
+}
+
+export type VisionScannersObservationsRetrieveParams = {
+ /**
+ * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.
+ */
+ labeled?: string
+ /**
+ * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.
+ */
+ order_by?: string
+ /**
+ * Filter to observations whose recording subject email contains this value (case-insensitive).
+ */
+ recording_subject?: string
+ /**
+ * Filter to observations of one or more session recordings. Accepts a comma-separated list.
+ */
+ session_id?: string
+ /**
+ * Filter by observation status. Accepts a comma-separated list.
+ */
+ status?: string
+ /**
+ * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.
+ */
+ tags?: string
+ /**
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
*/
triggered_by?: string
/**
@@ -1282,7 +1355,7 @@ export type VisionScannersObservationsStatsRetrieveParams = {
*/
tags?: string
/**
- * Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
*/
triggered_by?: string
/**
diff --git a/products/replay_vision/frontend/generated/api.ts b/products/replay_vision/frontend/generated/api.ts
index 5d5afce9e114..166a39558587 100644
--- a/products/replay_vision/frontend/generated/api.ts
+++ b/products/replay_vision/frontend/generated/api.ts
@@ -36,9 +36,11 @@ import type {
VisionActionsListParams,
VisionActionsRunsListParams,
VisionObservationsListParams,
+ VisionObservationsRetrieveParams,
VisionQuotaApi,
VisionScannersListParams,
VisionScannersObservationsListParams,
+ VisionScannersObservationsRetrieveParams,
VisionScannersObservationsStatsRetrieveParams,
VisionScannersPromptSuggestionsListParams,
} from './api.schemas'
@@ -250,19 +252,36 @@ export const visionObservationsList = async (
})
}
-export const getVisionObservationsRetrieveUrl = (projectId: string, id: string) => {
- return `/api/projects/${projectId}/vision/observations/${id}/`
+export const getVisionObservationsRetrieveUrl = (
+ projectId: string,
+ id: string,
+ params?: VisionObservationsRetrieveParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/vision/observations/${id}/?${stringifiedParams}`
+ : `/api/projects/${projectId}/vision/observations/${id}/`
}
/**
- * Read-only access to a session's observations across every scanner the caller can read, for the replay-page dock.
+ * Retrieve one observation. Any list filters passed along (status, tags, order_by, …) scope the `previous_observation_id`/`next_observation_id` navigation to the matching, identically-ordered set — so prev/next from a filtered table stays within that filtered list.
*/
export const visionObservationsRetrieve = async (
projectId: string,
id: string,
+ params?: VisionObservationsRetrieveParams,
options?: RequestInit
): Promise<ReplayObservationApi> => {
- return apiMutator<ReplayObservationApi>(getVisionObservationsRetrieveUrl(projectId, id), {
+ return apiMutator<ReplayObservationApi>(getVisionObservationsRetrieveUrl(projectId, id, params), {
...options,
method: 'GET',
})
@@ -501,23 +520,44 @@ export const visionScannersObservationsList = async (
)
}
-export const getVisionScannersObservationsRetrieveUrl = (projectId: string, scannerId: string, id: string) => {
- return `/api/projects/${projectId}/vision/scanners/${scannerId}/observations/${id}/`
+export const getVisionScannersObservationsRetrieveUrl = (
+ projectId: string,
+ scannerId: string,
+ id: string,
+ params?: VisionScannersObservationsRetrieveParams
+) => {
+ const normalizedParams = new URLSearchParams()
+
+ Object.entries(params || {}).forEach(([key, value]) => {
+ if (value !== undefined) {
+ normalizedParams.append(key, value === null ? 'null' : String(value))
+ }
+ })
+
+ const stringifiedParams = normalizedParams.toString()
+
+ return stringifiedParams.length > 0
+ ? `/api/projects/${projectId}/vision/scanners/${scannerId}/observations/${id}/?${stringifiedParams}`
+ : `/api/projects/${projectId}/vision/scanners/${scannerId}/observations/${id}/`
}
/**
- * Read-only access to observations produced by a scanner.
+ * Retrieve one observation. Any list filters passed along (status, tags, order_by, …) scope the `previous_observation_id`/`next_observation_id` navigation to the matching, identically-ordered set — so prev/next from a filtered table stays within that filtered list.
*/
export const visionScannersObservationsRetrieve = async (
projectId: string,
scannerId: string,
id: string,
+ params?: VisionScannersObservationsRetrieveParams,
options?: RequestInit
): Promise<ReplayObservationApi> => {
- return apiMutator<ReplayObservationApi>(getVisionScannersObservationsRetrieveUrl(projectId, scannerId, id), {
- ...options,
- method: 'GET',
- })
+ return apiMutator<ReplayObservationApi>(
+ getVisionScannersObservationsRetrieveUrl(projectId, scannerId, id, params),
+ {
+ ...options,
+ method: 'GET',
+ }
+ )
}
export const getVisionScannersObservationsLabelCreateUrl = (projectId: string, scannerId: string, id: string) => {
diff --git a/products/replay_vision/frontend/observations/ReplayObservation.tsx b/products/replay_vision/frontend/observations/ReplayObservation.tsx
index 75e2b5f6b69e..ea90cced8316 100644
--- a/products/replay_vision/frontend/observations/ReplayObservation.tsx
+++ b/products/replay_vision/frontend/observations/ReplayObservation.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
import { useEffect, useRef, useState } from 'react'
import {
@@ -62,11 +63,12 @@ import {
modelLabel,
parseFailureReason,
parseIneligibleReason,
+ OBSERVATION_TRIGGER_TAG,
type ScannerType,
} from '../replay_scanners/types'
import { ImproveScannerPromptButton, describeObservationOutcome } from './ImproveScannerPromptButton'
import { ObservationLabelControl } from './ObservationLabelControl'
-import { replayObservationLogic } from './replayObservationLogic'
+import { neighborFilterParams, observationDetailUrl, replayObservationLogic } from './replayObservationLogic'
import { replayObservationSceneLogic } from './replayObservationSceneLogic'
export const scene: SceneExport = {
@@ -111,9 +113,10 @@ function AutoSeekToTime({
export function ReplayObservationSceneComponent(): JSX.Element {
const { observationId } = useValues(replayObservationSceneLogic)
+ const { searchParams } = useValues(router)
const { featureFlags } = useValues(featureFlagLogic)
const qualityEnabled = !!featureFlags[FEATURE_FLAGS.REPLAY_VISION_QUALITY]
- const [recordingExpanded, setRecordingExpanded] = useState(true)
+ const [recordingExpanded, setRecordingExpanded] = useState(false)
const [pendingSeek, setPendingSeek] = useState<{ ms: number; trigger: number } | null>(null)
// A citation seek belongs to one observation — never replay it on a sibling after prev/next navigation.
@@ -157,7 +160,7 @@ export function ReplayObservationSceneComponent(): JSX.Element {
const reasoningSegments = result?.reasoning_segments
const scannerType = snapshot?.scanner_type
const scannerName = snapshot?.name || 'Scanner'
- const triggerLabel = observation.triggered_by === 'on_demand' ? 'On demand' : 'Schedule'
+ const triggerLabel = OBSERVATION_TRIGGER_TAG[observation.triggered_by].label
const snapshotConfig = configFromSnapshot(snapshot)
const prompt = snapshotConfig?.prompt ?? null
const summarizerConfig = scannerType === 'summarizer' ? (snapshotConfig as SummarizerScannerConfig | null) : null
@@ -193,6 +196,12 @@ export function ReplayObservationSceneComponent(): JSX.Element {
: humanFriendlyDuration(durationMs / 1000)
: null
+ // Filters carried over from the scanner's observations table; preserved on prev/next so
+ // navigation (and the server-computed neighbor ids) stay within the filtered list.
+ const neighborParams = neighborFilterParams(searchParams)
+ const neighborsFiltered = Object.keys(neighborParams).some((key) => key !== 'order_by')
+ const observationUrl = (id: string): string => observationDetailUrl(id, neighborParams)
+
const seekEmbeddedPlayer = (ms: number): void => {
if (!recordingExpanded) {
setRecordingExpanded(true)
@@ -222,11 +231,21 @@ export function ReplayObservationSceneComponent(): JSX.Element {
size="small"
to={
observation.previous_observation_id
- ? urls.replayVisionObservation(observation.previous_observation_id)
+ ? observationUrl(observation.previous_observation_id)
: undefined
}
- disabledReason={observation.previous_observation_id ? undefined : 'No newer observation'}
- tooltip="Previous (newer) observation for this scanner"
+ disabledReason={
+ observation.previous_observation_id
+ ? undefined
+ : neighborsFiltered
+ ? 'No previous observation matching your filters'
+ : 'No newer observation'
+ }
+ tooltip={
+ neighborsFiltered
+ ? 'Previous observation matching your filters'
+ : 'Previous (newer) observation for this scanner'
+ }
data-attr="vision-observation-prev"
>
Previous
@@ -237,11 +256,21 @@ export function ReplayObservationSceneComponent(): JSX.Element {
size="small"
to={
observation.next_observation_id
- ? urls.replayVisionObservation(observation.next_observation_id)
+ ? observationUrl(observation.next_observation_id)
: undefined
}
- disabledReason={observation.next_observation_id ? undefined : 'No older observation'}
- tooltip="Next (older) observation for this scanner"
+ disabledReason={
+ observation.next_observation_id
+ ? undefined
+ : neighborsFiltered
+ ? 'No next observation matching your filters'
+ : 'No older observation'
+ }
+ tooltip={
+ neighborsFiltered
+ ? 'Next observation matching your filters'
+ : 'Next (older) observation for this scanner'
+ }
data-attr="vision-observation-next"
>
Next
@@ -251,141 +280,46 @@ export function ReplayObservationSceneComponent(): JSX.Element {
}
/>
- <div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
- <LemonCard className="p-4" hoverEffect={false}>
- <CardHeader icon={<IconInfo />} title="Observation details" />
- <div className="flex flex-col gap-3 text-sm">
- <LabeledRow label="Status">
- <ObservationStatusTag status={observation.status} />
- </LabeledRow>
- {result && typeof result.confidence === 'number' && (
- <LabeledRow label="Confidence">
- <ObservationConfidence result={result} />
- </LabeledRow>
- )}
- <LabeledRow label="Triggered by">
- {observation.triggered_by === 'on_demand' && observation.triggered_by_user ? (
- <ProfilePicture
- user={{
- first_name: observation.triggered_by_user.first_name,
- last_name: observation.triggered_by_user.last_name,
- email: observation.triggered_by_user.email,
- }}
- size="sm"
- showName
- />
- ) : (
- <span>{triggerLabel}</span>
- )}
- </LabeledRow>
- <LabeledRow label="Session">
- <Link
- to={urls.sessionProfile(observation.session_id)}
- data-attr="vision-observation-session-link"
- >
- {observation.session_id}
- </Link>
- </LabeledRow>
- <LabeledRow label="Recording subject">
- {observation.distinct_id ? (
- <Link to={urls.personByDistinctId(observation.distinct_id)}>
- {observation.recording_subject_email ?? observation.distinct_id}
- </Link>
- ) : observation.recording_subject_email ? (
- <span>{observation.recording_subject_email}</span>
- ) : (
- <span className="text-muted">—</span>
- )}
- </LabeledRow>
- </div>
- </LemonCard>
-
- <LemonCard className="p-4" hoverEffect={false}>
- <CardHeader icon={<IconClock />} title="Lifecycle" />
- <div className="flex flex-col gap-3 text-sm">
- <LabeledRow label="Created at">
- <TZLabel time={observation.created_at} />
- </LabeledRow>
- {observation.started_at && (
- <LabeledRow label="Started at">
- <TZLabel time={observation.started_at} />
- </LabeledRow>
- )}
- {observation.completed_at && (
- <LabeledRow label="Completed at">
- <TZLabel time={observation.completed_at} />
- </LabeledRow>
- )}
- {durationLabel && (
- <LabeledRow label="Duration">
- <span>{durationLabel}</span>
- </LabeledRow>
- )}
- </div>
- </LemonCard>
-
- <LemonCard className="p-4" hoverEffect={false}>
- <CardHeader icon={<IconGear />} title="Configuration" />
- <div className="flex flex-col gap-3 text-sm">
- {snapshot?.model && (
- <LabeledRow label="Model">
- <span>{modelLabel(snapshot.model)}</span>
- </LabeledRow>
- )}
- {summarizerLength && (
- <LabeledRow label="Summary length">
- <span className="capitalize">{summarizerLength}</span>
- </LabeledRow>
- )}
- {classifierVocab && classifierVocab.length > 0 && (
- <LabeledRow label="Vocabulary">
- <div className="flex flex-wrap gap-1">
- {classifierVocab.map((tag) => (
- <LemonTag key={tag} type="default" size="small">
- {tag}
- </LemonTag>
- ))}
- </div>
- </LabeledRow>
- )}
- {monitorAllowInconclusive !== null && (
- <LabeledRow label="Allow inconclusive verdicts">
- <BooleanTag value={monitorAllowInconclusive} />
- </LabeledRow>
- )}
- {classifierMultiLabel !== null && (
- <LabeledRow label="Multi-label">
- <BooleanTag value={classifierMultiLabel} />
- </LabeledRow>
- )}
- {classifierAllowFreeform !== null && (
- <LabeledRow label="Freeform tags">
- <BooleanTag value={classifierAllowFreeform} />
- </LabeledRow>
- )}
- {scorerMin !== null && (
- <LabeledRow label="Scale minimum">
- <span>{scorerMin}</span>
- </LabeledRow>
- )}
- {scorerMax !== null && (
- <LabeledRow label="Scale maximum">
- <span>{scorerMax}</span>
- </LabeledRow>
- )}
- {scorerLabel && (
- <LabeledRow label="Score label">
- <span>{scorerLabel}</span>
- </LabeledRow>
- )}
- {snapshot?.emits_signals && (
- <LabeledRow label="Signals">
- <span>Emitted ({observation.scanner_result?.signals_count ?? 0})</span>
- </LabeledRow>
+ <LemonCard className="overflow-hidden p-0" hoverEffect={false}>
+ <div
+ className="flex items-center gap-2 bg-surface-primary p-3 cursor-pointer hover:bg-surface-secondary"
+ onClick={toggleRecordingExpanded}
+ >
+ <LemonButton
+ icon={recordingExpanded ? <IconCollapse /> : <IconExpand />}
+ size="small"
+ tooltip={recordingExpanded ? 'Collapse recording' : 'Expand recording'}
+ onClick={(e) => {
+ e.stopPropagation()
+ toggleRecordingExpanded()
+ }}
+ data-attr="vision-observation-recording-toggle"
+ />
+ <IconVideoCamera className="text-muted-alt" />
+ <h3 className="text-lg font-semibold m-0">Recording</h3>
+ </div>
+ {recordingExpanded && (
+ <div className="border-t border-border h-[calc(100vh-16rem)] min-h-[480px]">
+ <SessionRecordingPlayer
+ sessionRecordingId={observation.session_id}
+ playerKey={`vision-observation-${observation.id}`}
+ mode={SessionRecordingPlayerMode.Standard}
+ autoPlay={false}
+ noBorder
+ noDock
+ withSidebar
+ />
+ {pendingSeek && (
+ <AutoSeekToTime
+ playerKey={`vision-observation-${observation.id}`}
+ sessionRecordingId={observation.session_id}
+ ms={pendingSeek.ms}
+ trigger={pendingSeek.trigger}
+ />
)}
</div>
- </LemonCard>
- </div>
+ )}
+ </LemonCard>
<div className={scannerType === 'summarizer' ? '' : 'grid grid-cols-1 lg:grid-cols-2 gap-4'}>
<section className="border rounded p-4 bg-surface-primary space-y-3">
@@ -530,46 +464,141 @@ export function ReplayObservationSceneComponent(): JSX.Element {
)}
</div>
- <LemonCard className="overflow-hidden p-0" hoverEffect={false}>
- <div
- className="flex items-center gap-2 bg-surface-primary p-3 cursor-pointer hover:bg-surface-secondary"
- onClick={toggleRecordingExpanded}
- >
- <LemonButton
- icon={recordingExpanded ? <IconCollapse /> : <IconExpand />}
- size="small"
- tooltip={recordingExpanded ? 'Collapse recording' : 'Expand recording'}
- onClick={(e) => {
- e.stopPropagation()
- toggleRecordingExpanded()
- }}
- data-attr="vision-observation-recording-toggle"
- />
- <IconVideoCamera className="text-muted-alt" />
- <h3 className="text-lg font-semibold m-0">Recording</h3>
- </div>
- {recordingExpanded && (
- <div className="border-t border-border h-[480px]">
- <SessionRecordingPlayer
- sessionRecordingId={observation.session_id}
- playerKey={`vision-observation-${observation.id}`}
- mode={SessionRecordingPlayerMode.Standard}
- autoPlay={false}
- noMeta
- noBorder
- withSidebar
- />
- {pendingSeek && (
- <AutoSeekToTime
- playerKey={`vision-observation-${observation.id}`}
- sessionRecordingId={observation.session_id}
- ms={pendingSeek.ms}
- trigger={pendingSeek.trigger}
- />
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
+ <LemonCard className="p-4" hoverEffect={false}>
+ <CardHeader icon={<IconInfo />} title="Observation details" />
+ <div className="flex flex-col gap-3 text-sm">
+ <LabeledRow label="Status">
+ <ObservationStatusTag status={observation.status} />
+ </LabeledRow>
+ {result && typeof result.confidence === 'number' && (
+ <LabeledRow label="Confidence">
+ <ObservationConfidence result={result} />
+ </LabeledRow>
)}
+ <LabeledRow label="Triggered by">
+ {observation.triggered_by !== 'schedule' && observation.triggered_by_user ? (
+ <ProfilePicture
+ user={{
+ first_name: observation.triggered_by_user.first_name,
+ last_name: observation.triggered_by_user.last_name,
+ email: observation.triggered_by_user.email,
+ }}
+ size="sm"
+ showName
+ />
+ ) : (
+ <span>{triggerLabel}</span>
+ )}
+ </LabeledRow>
+ <LabeledRow label="Session">
+ <Link
+ to={urls.sessionProfile(observation.session_id)}
+ data-attr="vision-observation-session-link"
+ >
+ {observation.session_id}
+ </Link>
+ </LabeledRow>
+ <LabeledRow label="Recording subject">
+ {observation.distinct_id ? (
+ <Link to={urls.personByDistinctId(observation.distinct_id)}>
+ {observation.recording_subject_email ?? observation.distinct_id}
+ </Link>
+ ) : observation.recording_subject_email ? (
+ <span>{observation.recording_subject_email}</span>
+ ) : (
+ <span className="text-muted">—</span>
+ )}
+ </LabeledRow>
</div>
- )}
- </LemonCard>
+ </LemonCard>
+
+ <LemonCard className="p-4" hoverEffect={false}>
+ <CardHeader icon={<IconClock />} title="Lifecycle" />
+ <div className="flex flex-col gap-3 text-sm">
+ <LabeledRow label="Created at">
+ <TZLabel time={observation.created_at} />
+ </LabeledRow>
+ {observation.started_at && (
+ <LabeledRow label="Started at">
+ <TZLabel time={observation.started_at} />
+ </LabeledRow>
+ )}
+ {observation.completed_at && (
+ <LabeledRow label="Completed at">
+ <TZLabel time={observation.completed_at} />
+ </LabeledRow>
+ )}
+ {durationLabel && (
+ <LabeledRow label="Duration">
+ <span>{durationLabel}</span>
+ </LabeledRow>
+ )}
+ </div>
+ </LemonCard>
+
+ <LemonCard className="p-4" hoverEffect={false}>
+ <CardHeader icon={<IconGear />} title="Configuration" />
+ <div className="flex flex-col gap-3 text-sm">
+ {snapshot?.model && (
+ <LabeledRow label="Model">
+ <span>{modelLabel(snapshot.model)}</span>
+ </LabeledRow>
+ )}
+ {summarizerLength && (
+ <LabeledRow label="Summary length">
+ <span className="capitalize">{summarizerLength}</span>
+ </LabeledRow>
+ )}
+ {classifierVocab && classifierVocab.length > 0 && (
+ <LabeledRow label="Vocabulary">
+ <div className="flex flex-wrap gap-1">
+ {classifierVocab.map((tag) => (
+ <LemonTag key={tag} type="default" size="small">
+ {tag}
+ </LemonTag>
+ ))}
+ </div>
+ </LabeledRow>
+ )}
+ {monitorAllowInconclusive !== null && (
+ <LabeledRow label="Allow inconclusive verdicts">
+ <BooleanTag value={monitorAllowInconclusive} />
+ </LabeledRow>
+ )}
+ {classifierMultiLabel !== null && (
+ <LabeledRow label="Multi-label">
+ <BooleanTag value={classifierMultiLabel} />
+ </LabeledRow>
+ )}
+ {classifierAllowFreeform !== null && (
+ <LabeledRow label="Freeform tags">
+ <BooleanTag value={classifierAllowFreeform} />
+ </LabeledRow>
+ )}
+ {scorerMin !== null && (
+ <LabeledRow label="Scale minimum">
+ <span>{scorerMin}</span>
+ </LabeledRow>
+ )}
+ {scorerMax !== null && (
+ <LabeledRow label="Scale maximum">
+ <span>{scorerMax}</span>
+ </LabeledRow>
+ )}
+ {scorerLabel && (
+ <LabeledRow label="Score label">
+ <span>{scorerLabel}</span>
+ </LabeledRow>
+ )}
+ {snapshot?.emits_signals && (
+ <LabeledRow label="Signals">
+ <span>Emitted ({observation.scanner_result?.signals_count ?? 0})</span>
+ </LabeledRow>
+ )}
+ </div>
+ </LemonCard>
+ </div>
</SceneContent>
)
}
diff --git a/products/replay_vision/frontend/observations/replayObservationLogic.ts b/products/replay_vision/frontend/observations/replayObservationLogic.ts
index 2842da0c2330..4cebd56db04e 100644
--- a/products/replay_vision/frontend/observations/replayObservationLogic.ts
+++ b/products/replay_vision/frontend/observations/replayObservationLogic.ts
@@ -1,14 +1,15 @@
import { actions, afterMount, connect, kea, key, listeners, path, props, reducers } from 'kea'
-import { router } from 'kea-router'
+import { combineUrl, router } from 'kea-router'
import { lemonToast } from 'lib/lemon-ui/LemonToast'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { visionObservationsRetrieve } from '../generated/api'
-import type { ReplayObservationApi } from '../generated/api.schemas'
+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 { observationProgressLogic } from './observationProgressLogic'
import type { replayObservationLogicType } from './replayObservationLogicType'
import { replayObservationSceneLogic } from './replayObservationSceneLogic'
@@ -17,6 +18,23 @@ export interface ReplayObservationLogicProps {
id: string
}
+/** List filters carried in the observation URL; passed to retrieve so prev/next stay within the filtered set. */
+export function neighborFilterParams(searchParams: Record<string, unknown>): VisionObservationsRetrieveParams {
+ const params: Record<string, string> = {}
+ for (const key of OBSERVATION_LIST_FILTER_KEYS) {
+ const value = searchParams[key]
+ if (typeof value === 'string' && value) {
+ params[key] = value
+ }
+ }
+ return params
+}
+
+/** 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>): string {
+ return combineUrl(urls.replayVisionObservation(id), filterParams).url
+}
+
export const replayObservationLogic = kea<replayObservationLogicType>([
path(['products', 'replay_vision', 'frontend', 'observations', 'replayObservationLogic']),
props({} as ReplayObservationLogicProps),
@@ -74,7 +92,11 @@ export const replayObservationLogic = kea<replayObservationLogicType>([
return
}
try {
- const response = await visionObservationsRetrieve(String(teamId), props.id)
+ const response = await visionObservationsRetrieve(
+ String(teamId),
+ props.id,
+ 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(
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
index 0e71bc13e86a..26d43e137072 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerObservationsTable.tsx
@@ -1,6 +1,6 @@
import { useActions, useValues } from 'kea'
-import { IconPlay, IconRefresh, IconRewindPlay } from '@posthog/icons'
+import { IconEye, IconPlay, IconRefresh } from '@posthog/icons'
import { LemonButton, LemonInput, LemonTable, LemonTag, LemonTagType, Link, Tooltip } from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
@@ -13,6 +13,7 @@ import { AccessControlLevel, AccessControlResourceType } from '~/types'
import { FilterPill } from '../../components/FilterPill'
import { ObservationResultSummary, ObservationStatusTag } from '../../components/ObservationCard'
import type { ReplayObservationApi } from '../../generated/api.schemas'
+import { observationDetailUrl } from '../../observations/replayObservationLogic'
import {
OBSERVATIONS_PAGE_SIZE,
ObservationStatusValue,
@@ -20,6 +21,7 @@ import {
ObservationVerdictValue,
replayScannerLogic,
} from '../replayScannerLogic'
+import { OBSERVATION_TRIGGER_TAG } from '../types'
const STATUS_OPTIONS: { value: ObservationStatusValue; label: string }[] = [
{ value: 'succeeded', label: 'Succeeded' },
@@ -29,10 +31,10 @@ const STATUS_OPTIONS: { value: ObservationStatusValue; label: string }[] = [
{ value: 'pending', label: 'Pending' },
]
-const TRIGGERED_BY_OPTIONS: { value: ObservationTriggeredByValue; label: string }[] = [
- { value: 'on_demand', label: 'On demand' },
- { value: 'schedule', label: 'Schedule' },
-]
+const TRIGGERED_BY_OPTIONS = Object.entries(OBSERVATION_TRIGGER_TAG).map(([value, { label }]) => ({
+ value: value as ObservationTriggeredByValue,
+ label,
+}))
const VERDICT_OPTIONS: { value: ObservationVerdictValue; label: string }[] = [
{ value: 'yes', label: 'Yes' },
@@ -93,6 +95,7 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
observationTagFilter,
observationSubjectFilter,
hasActiveObservationFilters,
+ observationDetailLinkParams,
availableTags,
observationStats,
scanner,
@@ -121,7 +124,7 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
width: 300,
render: (_, obs) => (
<Link
- to={urls.replayVisionObservation(obs.id)}
+ to={observationDetailUrl(obs.id, observationDetailLinkParams)}
className="font-mono text-xs text-primary truncate block"
>
{obs.session_id}
@@ -146,13 +149,33 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
{
title: 'Status',
key: 'status',
- render: (_, obs) => <ObservationStatusTag status={obs.status} errorReason={obs.error_reason} />,
+ render: (_, obs) => (
+ <div className="flex items-center gap-1">
+ <ObservationStatusTag status={obs.status} errorReason={obs.error_reason} />
+ {obs.status === 'failed' && (
+ <AccessControlAction
+ resourceType={AccessControlResourceType.SessionRecording}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonButton
+ size="xsmall"
+ type="secondary"
+ icon={<IconRefresh />}
+ onClick={() => retryObservation(obs.id)}
+ loading={retryingObservationIds.includes(obs.id)}
+ tooltip="Retry scan"
+ data-attr="vision-observation-retry"
+ />
+ </AccessControlAction>
+ )}
+ </div>
+ ),
},
{
title: 'Result',
key: 'result',
render: (_, obs) => (
- <Link to={urls.replayVisionObservation(obs.id)} className="block">
+ <Link to={observationDetailUrl(obs.id, observationDetailLinkParams)} className="block">
<div className="min-w-[18rem] max-w-xl">
<ObservationResultSummary observation={obs} />
</div>
@@ -182,8 +205,8 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
title: 'Triggered by',
key: 'triggered_by',
render: (_, obs) => (
- <LemonTag type={obs.triggered_by === 'on_demand' ? 'highlight' : 'default'}>
- {obs.triggered_by === 'on_demand' ? 'On demand' : 'Schedule'}
+ <LemonTag type={OBSERVATION_TRIGGER_TAG[obs.triggered_by].type}>
+ {OBSERVATION_TRIGGER_TAG[obs.triggered_by].label}
</LemonTag>
),
},
@@ -198,36 +221,16 @@ export function ScannerObservationsTable({ scannerId }: { scannerId: string }):
key: 'actions',
width: 1,
render: (_, obs) => (
- <div className="flex gap-1">
- {obs.status === 'failed' && (
- <AccessControlAction
- resourceType={AccessControlResourceType.SessionRecording}
- minAccessLevel={AccessControlLevel.Editor}
- >
- <LemonButton
- size="small"
- type="secondary"
- icon={<IconRefresh />}
- onClick={() => retryObservation(obs.id)}
- loading={retryingObservationIds.includes(obs.id)}
- className="whitespace-nowrap"
- data-attr="vision-observation-retry"
- >
- Retry
- </LemonButton>
- </AccessControlAction>
- )}
- <LemonButton
- size="small"
- type="secondary"
- icon={<IconRewindPlay />}
- to={urls.replaySingle(obs.session_id)}
- className="whitespace-nowrap"
- data-attr="vision-observation-view-recording"
- >
- View recording
- </LemonButton>
- </div>
+ <LemonButton
+ size="small"
+ type="secondary"
+ icon={<IconEye />}
+ to={observationDetailUrl(obs.id, observationDetailLinkParams)}
+ className="whitespace-nowrap"
+ data-attr="vision-observation-view-details"
+ >
+ View details
+ </LemonButton>
),
},
]
diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts
index 196f671410a5..361fa2b5127d 100644
--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts
@@ -597,6 +597,36 @@ export const replayScannerLogic = kea<replayScannerLogicType>([
tagFilter.length > 0 ||
subjectFilter.trim().length > 0,
],
+ // Carried into observation detail links so server-computed prev/next neighbors honor the table's filters + sort.
+ observationDetailLinkParams: [
+ (s) => [
+ s.observationStatusFilter,
+ s.observationTriggeredByFilter,
+ s.observationVerdictFilter,
+ s.observationTagFilter,
+ s.observationSubjectFilter,
+ s.observationsSort,
+ s.scanner,
+ ],
+ (
+ observationStatusFilter: ObservationStatusValue[],
+ observationTriggeredByFilter: ObservationTriggeredByValue[],
+ observationVerdictFilter: ObservationVerdictValue[],
+ observationTagFilter: string[],
+ observationSubjectFilter: string,
+ observationsSort: ObservationsSorting | null,
+ scanner: ReplayScanner | null
+ ): Record<string, string> =>
+ buildObservationListParams({
+ observationStatusFilter,
+ observationTriggeredByFilter,
+ observationVerdictFilter,
+ observationTagFilter,
+ observationSubjectFilter,
+ observationsSort,
+ scanner,
+ }) as Record<string, string>,
+ ],
availableTags: [
(s) => [s.observationStatsApi],
(stats: ObservationStatsApi | null): string[] => stats?.available_tags ?? [],
diff --git a/products/replay_vision/frontend/replay_scanners/types.ts b/products/replay_vision/frontend/replay_scanners/types.ts
index 91095ca471fe..4852048ec6cd 100644
--- a/products/replay_vision/frontend/replay_scanners/types.ts
+++ b/products/replay_vision/frontend/replay_scanners/types.ts
@@ -5,9 +5,11 @@ import { RecordingsQuery } from '~/queries/schema/schema-general'
import { ScannerModelEnumApi } from '../generated/api.schemas'
import type {
PatchedReplayScannerApi,
+ ReplayObservationApi,
ReplayScannerApi,
ScannerTypeEnumApi,
UserBasicApi,
+ VisionObservationsRetrieveParams,
} from '../generated/api.schemas'
import { formatCredits } from '../utils/credits'
@@ -20,6 +22,27 @@ export const SCANNER_TYPE_TAG_TYPE: Record<ScannerType, LemonTagType> = {
summarizer: 'success',
}
+export const OBSERVATION_TRIGGER_TAG: Record<
+ ReplayObservationApi['triggered_by'],
+ { label: string; type: LemonTagType }
+> = {
+ schedule: { label: 'Schedule', type: 'default' },
+ on_demand: { label: 'On demand', type: 'highlight' },
+ retry: { label: 'Retry', type: 'completion' },
+}
+
+// Typed against the generated retrieve params so a renamed or dropped backend filter fails the build.
+export const OBSERVATION_LIST_FILTER_KEYS: readonly (keyof VisionObservationsRetrieveParams)[] = [
+ 'status',
+ 'triggered_by',
+ 'verdict',
+ 'tags',
+ 'session_id',
+ 'recording_subject',
+ 'labeled',
+ 'order_by',
+]
+
export type EnabledFilter = 'enabled' | 'disabled'
export type IneligibleKind = 'no_recording' | 'too_short' | 'too_inactive' | 'too_long' | 'no_events'
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 3ca6129f8ee5..b48ce09d3fbe 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -32686,6 +32686,7 @@ export namespace Schemas {
/**
* * `schedule` - Schedule
* * `on_demand` - On demand
+ * * `retry` - Retry
*/
export type ObservationTriggerEnum = typeof ObservationTriggerEnum[keyof typeof ObservationTriggerEnum];
@@ -32693,6 +32694,7 @@ export namespace Schemas {
export const ObservationTriggerEnum = {
Schedule: 'schedule',
OnDemand: 'on_demand',
+ Retry: 'retry',
} as const;
/**
@@ -35055,10 +35057,11 @@ export namespace Schemas {
readonly scanner_snapshot: ScannerSnapshot | null;
/** Result data persisted on success; null until the observation succeeds. */
readonly scanner_result: ScannerResult | null;
- /** Whether this observation came from the schedule or an on-demand request.
+ /** Whether this observation came from the schedule, an on-demand request, or a retry of a failed observation.
*
* * `schedule` - Schedule
- * * `on_demand` - On demand */
+ * * `on_demand` - On demand
+ * * `retry` - Retry */
readonly triggered_by: ObservationTriggerEnum;
/** User who triggered an on-demand observation; null for scheduled observations. */
readonly triggered_by_user: UserBasic | null;
@@ -35073,12 +35076,12 @@ export namespace Schemas {
*/
readonly recording_subject_email: string | null;
/**
- * Id of the newer sibling observation for the same scanner (prev/next nav); only set on retrieve, null at the start.
+ * Id of the preceding sibling observation for the same scanner (prev/next nav), honoring any list filters and ordering passed to retrieve; only set on retrieve, null at the start of the set.
* @nullable
*/
readonly previous_observation_id: string | null;
/**
- * Id of the older sibling observation for the same scanner (prev/next nav); only set on retrieve, null at the end.
+ * Id of the following sibling observation for the same scanner (prev/next nav), honoring any list filters and ordering passed to retrieve; only set on retrieve, null at the end of the set.
* @nullable
*/
readonly next_observation_id: string | null;
@@ -64155,6 +64158,41 @@ export namespace Schemas {
session_id: string;
};
+ export type EnvironmentsVisionObservationsRetrieveParams = {
+ /**
+ * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.
+ */
+ labeled?: string;
+ /**
+ * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.
+ */
+ order_by?: string;
+ /**
+ * Filter to observations whose recording subject email contains this value (case-insensitive).
+ */
+ recording_subject?: string;
+ /**
+ * Filter to observations of one or more session recordings. Accepts a comma-separated list.
+ */
+ session_id?: string;
+ /**
+ * Filter by observation status. Accepts a comma-separated list.
+ */
+ status?: string;
+ /**
+ * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.
+ */
+ tags?: string;
+ /**
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
+ */
+ triggered_by?: string;
+ /**
+ * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).
+ */
+ verdict?: string;
+ };
+
export type EnvironmentsVisionScannersListParams = {
/**
* Filter to scanners created by the given user IDs (comma-separated).
@@ -64224,7 +64262,42 @@ export namespace Schemas {
*/
tags?: string;
/**
- * Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
+ */
+ triggered_by?: string;
+ /**
+ * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).
+ */
+ verdict?: string;
+ };
+
+ export type EnvironmentsVisionScannersObservationsRetrieveParams = {
+ /**
+ * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.
+ */
+ labeled?: string;
+ /**
+ * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.
+ */
+ order_by?: string;
+ /**
+ * Filter to observations whose recording subject email contains this value (case-insensitive).
+ */
+ recording_subject?: string;
+ /**
+ * Filter to observations of one or more session recordings. Accepts a comma-separated list.
+ */
+ session_id?: string;
+ /**
+ * Filter by observation status. Accepts a comma-separated list.
+ */
+ status?: string;
+ /**
+ * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.
+ */
+ tags?: string;
+ /**
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
*/
triggered_by?: string;
/**
@@ -64259,7 +64332,7 @@ export namespace Schemas {
*/
tags?: string;
/**
- * Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
*/
triggered_by?: string;
/**
@@ -72418,6 +72491,41 @@ export namespace Schemas {
session_id: string;
};
+ export type VisionObservationsRetrieveParams = {
+ /**
+ * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.
+ */
+ labeled?: string;
+ /**
+ * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.
+ */
+ order_by?: string;
+ /**
+ * Filter to observations whose recording subject email contains this value (case-insensitive).
+ */
+ recording_subject?: string;
+ /**
+ * Filter to observations of one or more session recordings. Accepts a comma-separated list.
+ */
+ session_id?: string;
+ /**
+ * Filter by observation status. Accepts a comma-separated list.
+ */
+ status?: string;
+ /**
+ * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.
+ */
+ tags?: string;
+ /**
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
+ */
+ triggered_by?: string;
+ /**
+ * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).
+ */
+ verdict?: string;
+ };
+
export type VisionScannersListParams = {
/**
* Filter to scanners created by the given user IDs (comma-separated).
@@ -72487,7 +72595,42 @@ export namespace Schemas {
*/
tags?: string;
/**
- * Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
+ */
+ triggered_by?: string;
+ /**
+ * Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).
+ */
+ verdict?: string;
+ };
+
+ export type VisionScannersObservationsRetrieveParams = {
+ /**
+ * When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.
+ */
+ labeled?: string;
+ /**
+ * Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.
+ */
+ order_by?: string;
+ /**
+ * Filter to observations whose recording subject email contains this value (case-insensitive).
+ */
+ recording_subject?: string;
+ /**
+ * Filter to observations of one or more session recordings. Accepts a comma-separated list.
+ */
+ session_id?: string;
+ /**
+ * Filter by observation status. Accepts a comma-separated list.
+ */
+ status?: string;
+ /**
+ * Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.
+ */
+ tags?: string;
+ /**
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
*/
triggered_by?: string;
/**
@@ -72522,7 +72665,7 @@ export namespace Schemas {
*/
tags?: string;
/**
- * Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.
+ * Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.
*/
triggered_by?: string;
/**
diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.ts
index 7f1fad0656b2..450e90ce12a5 100644
--- a/services/mcp/src/generated/replay_vision/api.ts
+++ b/services/mcp/src/generated/replay_vision/api.ts
@@ -32,7 +32,7 @@ export const VisionObservationsListQueryParams = /* @__PURE__ */ zod.object({
})
/**
- * Read-only access to a session's observations across every scanner the caller can read, for the replay-page dock.
+ * Retrieve one observation. Any list filters passed along (status, tags, order_by, …) scope the `previous_observation_id`/`next_observation_id` navigation to the matching, identically-ordered set — so prev/next from a filtered table stays within that filtered list.
*/
export const VisionObservationsRetrieveParams = /* @__PURE__ */ zod.object({
id: zod.string().describe('A UUID string identifying this replay observation.'),
@@ -43,6 +43,44 @@ export const VisionObservationsRetrieveParams = /* @__PURE__ */ zod.object({
),
})
+export const VisionObservationsRetrieveQueryParams = /* @__PURE__ */ zod.object({
+ labeled: zod
+ .string()
+ .optional()
+ .describe(
+ 'When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.'
+ ),
+ order_by: zod
+ .string()
+ .optional()
+ .describe(
+ 'Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.'
+ ),
+ recording_subject: zod
+ .string()
+ .optional()
+ .describe('Filter to observations whose recording subject email contains this value (case-insensitive).'),
+ session_id: zod
+ .string()
+ .optional()
+ .describe('Filter to observations of one or more session recordings. Accepts a comma-separated list.'),
+ status: zod.string().optional().describe('Filter by observation status. Accepts a comma-separated list.'),
+ tags: zod
+ .string()
+ .optional()
+ .describe(
+ 'Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.'
+ ),
+ triggered_by: zod
+ .string()
+ .optional()
+ .describe('Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.'),
+ verdict: zod
+ .string()
+ .optional()
+ .describe('Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).'),
+})
+
/**
* Set or update the observation's shared label: whether the scanner scored the session correctly, plus optional feedback on what it got wrong. One label per observation, shared across the team; these labels feed prompt improvement. Requires session recording edit access.
*/
@@ -398,7 +436,7 @@ export const VisionScannersObservationsListQueryParams = /* @__PURE__ */ zod.obj
triggered_by: zod
.string()
.optional()
- .describe('Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.'),
+ .describe('Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.'),
verdict: zod
.string()
.optional()
@@ -406,7 +444,7 @@ export const VisionScannersObservationsListQueryParams = /* @__PURE__ */ zod.obj
})
/**
- * Read-only access to observations produced by a scanner.
+ * Retrieve one observation. Any list filters passed along (status, tags, order_by, …) scope the `previous_observation_id`/`next_observation_id` navigation to the matching, identically-ordered set — so prev/next from a filtered table stays within that filtered list.
*/
export const VisionScannersObservationsRetrieveParams = /* @__PURE__ */ zod.object({
id: zod.string().describe('A UUID string identifying this replay observation.'),
@@ -418,6 +456,44 @@ export const VisionScannersObservationsRetrieveParams = /* @__PURE__ */ zod.obje
scanner_id: zod.string(),
})
+export const VisionScannersObservationsRetrieveQueryParams = /* @__PURE__ */ zod.object({
+ labeled: zod
+ .string()
+ .optional()
+ .describe(
+ 'When true, return only observations that have a shared label (thumbs up or down); when false, only unlabeled observations.'
+ ),
+ order_by: zod
+ .string()
+ .optional()
+ .describe(
+ 'Sort observations. Plain keys: created_at, started_at, completed_at, status, recording_subject_email. JSONB keys: result_score (scorer), result_verdict (monitor), scanner_version. Prefix with `-` for descending; nullable keys sort nulls last either way.'
+ ),
+ recording_subject: zod
+ .string()
+ .optional()
+ .describe('Filter to observations whose recording subject email contains this value (case-insensitive).'),
+ session_id: zod
+ .string()
+ .optional()
+ .describe('Filter to observations of one or more session recordings. Accepts a comma-separated list.'),
+ status: zod.string().optional().describe('Filter by observation status. Accepts a comma-separated list.'),
+ tags: zod
+ .string()
+ .optional()
+ .describe(
+ 'Filter classifier observations whose fixed or freeform tags include any of the given values (comma-separated). Matches if the tag appears in either `tags` or `tags_freeform`.'
+ ),
+ triggered_by: zod
+ .string()
+ .optional()
+ .describe('Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.'),
+ verdict: zod
+ .string()
+ .optional()
+ .describe('Filter monitor observations by verdict. Accepts a comma-separated list (e.g. `yes,inconclusive`).'),
+})
+
/**
* Aggregate counts and per-scanner-type distributions over the filtered observation set. Same filters as the list endpoint apply.
*/
@@ -461,7 +537,7 @@ export const VisionScannersObservationsStatsRetrieveQueryParams = /* @__PURE__ *
triggered_by: zod
.string()
.optional()
- .describe('Filter by trigger source (schedule or on_demand). Accepts a comma-separated list.'),
+ .describe('Filter by trigger source (schedule, on_demand, or retry). Accepts a comma-separated list.'),
verdict: zod
.string()
.optional()
diff --git a/services/mcp/src/tools/generated/replay_vision.ts b/services/mcp/src/tools/generated/replay_vision.ts
index 294e8fae9b8a..36a3a85cb9d6 100644
--- a/services/mcp/src/tools/generated/replay_vision.ts
+++ b/services/mcp/src/tools/generated/replay_vision.ts
@@ -8,6 +8,7 @@ import {
VisionObservationsLabelDestroyParams,
VisionObservationsListQueryParams,
VisionObservationsRetrieveParams,
+ VisionObservationsRetrieveQueryParams,
VisionScannersCreateBody,
VisionScannersDestroyParams,
VisionScannersEstimateCreateBody,
@@ -15,6 +16,7 @@ import {
VisionScannersObservationsListParams,
VisionScannersObservationsListQueryParams,
VisionScannersObservationsRetrieveParams,
+ VisionScannersObservationsRetrieveQueryParams,
VisionScannersObservationsStatsRetrieveParams,
VisionScannersObservationsStatsRetrieveQueryParams,
VisionScannersObserveCreateBody,
@@ -97,7 +99,9 @@ const visionObservationsList = (): ToolBase<
},
})
-const VisionObservationsRetrieveSchema = VisionObservationsRetrieveParams.omit({ project_id: true })
+const VisionObservationsRetrieveSchema = VisionObservationsRetrieveParams.omit({ project_id: true }).extend(
+ VisionObservationsRetrieveQueryParams.shape
+)
const visionObservationsRetrieve = (): ToolBase<
typeof VisionObservationsRetrieveSchema,
@@ -110,6 +114,16 @@ const visionObservationsRetrieve = (): ToolBase<
const result = await context.api.request<Schemas.ReplayObservation>({
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/observations/${encodeURIComponent(String(params.id))}/`,
+ query: {
+ labeled: params.labeled,
+ order_by: params.order_by,
+ recording_subject: params.recording_subject,
+ session_id: params.session_id,
+ status: params.status,
+ tags: params.tags,
+ triggered_by: params.triggered_by,
+ verdict: params.verdict,
+ },
})
return result
},
@@ -274,7 +288,9 @@ const visionScannersList = (): ToolBase<
},
})
-const VisionScannersObservationsGetSchema = VisionScannersObservationsRetrieveParams.omit({ project_id: true })
+const VisionScannersObservationsGetSchema = VisionScannersObservationsRetrieveParams.omit({ project_id: true }).extend(
+ VisionScannersObservationsRetrieveQueryParams.shape
+)
const visionScannersObservationsGet = (): ToolBase<
typeof VisionScannersObservationsGetSchema,
@@ -287,6 +303,16 @@ const visionScannersObservationsGet = (): ToolBase<
const result = await context.api.request<Schemas.ReplayObservation>({
method: 'GET',
path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/scanners/${encodeURIComponent(String(params.scanner_id))}/observations/${encodeURIComponent(String(params.id))}/`,
+ query: {
+ labeled: params.labeled,
+ order_by: params.order_by,
+ recording_subject: params.recording_subject,
+ session_id: params.session_id,
+ status: params.status,
+ tags: params.tags,
+ triggered_by: params.triggered_by,
+ verdict: params.verdict,
+ },
})
return result
},