:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(replay_vision): treat oversized recordings as ineligible (#89709)
posthog[bot]7840a6ef4f87
diff --git a/products/replay_vision/backend/error_kinds.py b/products/replay_vision/backend/error_kinds.pyindex ee2986ea30c2..d341e7501005 100644--- a/products/replay_vision/backend/error_kinds.py+++ b/products/replay_vision/backend/error_kinds.py@@ -15,6 +15,9 @@ class IneligibleSessionKind(StrEnum):# Usually a property of the recording, but it can be a timing artifact (snapshots still ingesting, a# backfill landing late), so the retry endpoint accepts ineligible rows and the UI offers a retry here.NO_SNAPSHOTS = "no_snapshots"+ # The recording's snapshot blocks exceed the rasterizer's size cap, so the render is refused before it starts.+ # This is a fixed property of the recording, so no retry can make the scan succeed.+ TOO_LARGE = "too_large"class FailureKind(StrEnum):diff --git a/products/replay_vision/backend/migrations/0085_alter_replayobservation_error_reason.py b/products/replay_vision/backend/migrations/0085_alter_replayobservation_error_reason.pynew file mode 100644index 000000000000..28607f0e33b8--- /dev/null+++ b/products/replay_vision/backend/migrations/0085_alter_replayobservation_error_reason.py@@ -0,0 +1,21 @@+# Generated by Django 5.2.17 on 2026-08-26 21:10++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("replay_vision", "0084_observation_window_index"),+ ]++ operations = [+ migrations.AlterField(+ model_name="replayobservation",+ name="error_reason",+ field=models.TextField(+ blank=True,+ default="",+ help_text="Populated on terminal non-success statuses; formatted as `kind:human-readable message`. For `ineligible`, kind is one of no_recording / too_short / too_inactive / too_long / no_events / no_snapshots / too_large. For `failed`, kind is one of provider_transient / provider_rejected / rasterization_failed / validation_failed / infra_transient / internal_error / orphaned.",+ ),+ ),+ ]diff --git a/products/replay_vision/backend/migrations/max_migration.txt b/products/replay_vision/backend/migrations/max_migration.txtindex 81147e75c315..8d5369be97a0 100644--- a/products/replay_vision/backend/migrations/max_migration.txt+++ b/products/replay_vision/backend/migrations/max_migration.txt@@ -1 +1 @@-0084_observation_window_index+0085_alter_replayobservation_error_reasondiff --git a/products/replay_vision/backend/temporal/workflow.py b/products/replay_vision/backend/temporal/workflow.pyindex a093ea244089..7e8275e7b72a 100644--- a/products/replay_vision/backend/temporal/workflow.py+++ b/products/replay_vision/backend/temporal/workflow.py@@ -168,6 +168,10 @@ _PROVIDER_TIMEOUT_ACTIVITY_TYPES = frozenset(# surfaces here the render attempts are spent and the emptiness is a property of the recording, not of one attempt._RASTERIZER_NO_SNAPSHOTS_TYPE = "NO_SNAPSHOTS"+# The rasterizer refuses a recording whose snapshot blocks exceed its size cap, to keep an oversized render from+# walking the pod into its memory limit. That size is a fixed property of the recording, so no retry helps.+_RASTERIZER_TOO_LARGE_TYPE = "RECORDING_TOO_LARGE"+def _activity_timeout_kind(e: BaseException) -> str | None:"""Map an activity start-to-close/heartbeat timeout onto whichever side ran out of time."""@@ -425,6 +429,14 @@ class ApplyScannerWorkflow(PostHogWorkflow):# "nothing to analyze" as a session with no events, which we already gate as ineligible, so calling# it a failure would point the user at support over a recording that can never produce a video.raise IneligibleSessionError(_root_cause_message(e), kind=IneligibleSessionKind.NO_SNAPSHOTS) from e+ # An in-flight history from before this branch existed already scheduled the failed-mark for an+ # oversized recording. `patched` makes those histories skip this branch and keep the old path, so+ # switching them to the ineligible-mark on replay cannot raise a non-determinism error.+ if _failure_type(e) == _RASTERIZER_TOO_LARGE_TYPE and wf.patched(+ "replay-vision-too-large-ineligible-2026-08"+ ):+ # Gate as ineligible, not failed, so the user reads "too large" instead of a "known issue" retry prompt.+ raise IneligibleSessionError(_root_cause_message(e), kind=IneligibleSessionKind.TOO_LARGE) from e# Direct cause only: a nested activity timeout inside the child already bumped the# counter there, and matching it here would double-count one run.if (diff --git a/products/replay_vision/backend/tests/test_temporal.py b/products/replay_vision/backend/tests/test_temporal.pyindex dddc340cc13c..4b0153f79958 100644--- a/products/replay_vision/backend/tests/test_temporal.py+++ b/products/replay_vision/backend/tests/test_temporal.py@@ -2208,7 +2208,9 @@ class _WorkflowMocks:return None-async def _run_workflow(inputs: ApplyScannerInputs, mocks: _WorkflowMocks, workflow_id: str = "wf-test") -> None:+async def _run_workflow(+ inputs: ApplyScannerInputs, mocks: _WorkflowMocks, workflow_id: str = "wf-test", patched: bool = True+) -> None:workflow_info = MagicMock()workflow_info.workflow_id = workflow_idwith (@@ -2217,6 +2219,9 @@ async def _run_workflow(inputs: ApplyScannerInputs, mocks: _WorkflowMocks, workfpatch("temporalio.workflow.execute_child_workflow", side_effect=mocks.execute_child_workflow),# `wf.logger` requires a real workflow event loop, which this direct-call harness skips.patch("temporalio.workflow.logger"),+ # `wf.patched` also needs that loop; True models a fresh execution, False a history that+ # already ran past this point before the patch existed.+ patch("temporalio.workflow.patched", return_value=patched),):await ApplyScannerWorkflow().run(inputs)@@ -2296,21 +2301,28 @@ async def test_apply_scanner_workflow_marks_failed_when_fetch_raises() -> None:@pytest.mark.asyncio@pytest.mark.parametrize(- "rasterizer_type,expect_ineligible,expected_kind",+ "rasterizer_type,patched,expect_ineligible,expected_kind",[# An unrenderable recording is a gate, so it must not land on the failed path telling the user to retry.- ("NO_SNAPSHOTS", True, "no_snapshots"),- ("CAPTURE_ABORTED", False, "rasterization_failed"),- (None, False, "rasterization_failed"),+ ("NO_SNAPSHOTS", True, True, "no_snapshots"),+ # An oversized recording is a permanent gate too, not a broken render.+ ("RECORDING_TOO_LARGE", True, True, "too_large"),+ # A history that reached this point before the patch keeps the old path, which is the whole+ # point of the guard: the two marks are different activity types, so switching mid-run is+ # non-deterministic.+ ("RECORDING_TOO_LARGE", False, False, "rasterization_failed"),+ ("CAPTURE_ABORTED", True, False, "rasterization_failed"),+ (None, True, False, "rasterization_failed"),],)async def test_apply_scanner_workflow_splits_rasterizer_failures_by_cause(- rasterizer_type: str | None, expect_ineligible: bool, expected_kind: str+ rasterizer_type: str | None, patched: bool, expect_ineligible: bool, expected_kind: str) -> None:new_observation_id = uuid.uuid4()leaf = (- # `non_retryable=False` is the real arrival shape: the rasterizer keeps NO_SNAPSHOTS retryable while blocks may- # still be landing, so it only reaches us once the attempts are spent. Classification keys off the type alone.+ # NO_SNAPSHOTS stays retryable while blocks may still be landing, so it reaches us only once the+ # attempts are spent; RECORDING_TOO_LARGE arrives non-retryable. Classification keys off the type+ # alone, so one shape covers both here.ApplicationError("No snapshots after processing", type=rasterizer_type, non_retryable=False)if rasterizer_typeelse RuntimeError("browser pod vanished")@@ -2329,7 +2341,7 @@ async def test_apply_scanner_workflow_splits_rasterizer_failures_by_cause()with pytest.raises(Exception):- await _run_workflow(_build_inputs(session_id="sess-raster"), mocks)+ await _run_workflow(_build_inputs(session_id="sess-raster"), mocks, patched=patched)called = {fn for fn, _ in mocks.activity_calls}terminal = mark_observation_ineligible_activity if expect_ineligible else mark_observation_failed_activitydiff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.tsindex 1cb0ed867a3d..719fc1c57716 100644--- a/products/replay_vision/frontend/generated/api.schemas.ts+++ b/products/replay_vision/frontend/generated/api.schemas.ts@@ -1018,7 +1018,7 @@ export interface ReplayObservationApi {* * `failed` - Failed* * `ineligible` - Ineligible */readonly status: ObservationStatusEnumApi- /** Populated on terminal non-success statuses; formatted as `kind:human-readable message`. For `ineligible`, kind is one of no_recording / too_short / too_inactive / too_long / no_events / no_snapshots. For `failed`, kind is one of provider_transient / provider_rejected / rasterization_failed / validation_failed / infra_transient / internal_error / orphaned. */+ /** Populated on terminal non-success statuses; formatted as `kind:human-readable message`. For `ineligible`, kind is one of no_recording / too_short / too_inactive / too_long / no_events / no_snapshots / too_large. For `failed`, kind is one of provider_transient / provider_rejected / rasterization_failed / validation_failed / infra_transient / internal_error / orphaned. */readonly error_reason: string/** Temporal workflow id for progress queries and debugging. Empty until the workflow starts. */readonly workflow_id: stringdiff --git a/products/replay_vision/frontend/replay_scanners/types.ts b/products/replay_vision/frontend/replay_scanners/types.tsindex 9d03cb2e94dd..2d84f77c5c93 100644--- a/products/replay_vision/frontend/replay_scanners/types.ts+++ b/products/replay_vision/frontend/replay_scanners/types.ts@@ -55,6 +55,7 @@ export type IneligibleKind =| 'too_short'| 'too_inactive'| 'too_long'+ | 'too_large'| 'no_events'| 'no_ai_consent'@@ -79,6 +80,10 @@ const INELIGIBLE_KINDS: Record<IneligibleKind, IneligibleKindInfo> = {too_short: { label: 'Too short', description: 'The session was too short to analyze.' },too_inactive: { label: 'Too inactive', description: 'The session had too little active interaction to analyze.' },too_long: { label: 'Too long', description: 'The session was too long to analyze.' },+ too_large: {+ label: 'Too large',+ description: 'This recording is too large to render as a video, so there was nothing for the AI to watch.',+ },no_events: { label: 'No events', description: 'The session had no events to analyze.' },no_ai_consent: {label: 'AI analysis not allowed',diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 7532f2aca0d7..37b27abbd33e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -51353,7 +51353,7 @@ export namespace Schemas {* * `failed` - Failed* * `ineligible` - Ineligible */readonly status: ObservationStatusEnum;- /** Populated on terminal non-success statuses; formatted as `kind:human-readable message`. For `ineligible`, kind is one of no_recording / too_short / too_inactive / too_long / no_events / no_snapshots. For `failed`, kind is one of provider_transient / provider_rejected / rasterization_failed / validation_failed / infra_transient / internal_error / orphaned. */+ /** Populated on terminal non-success statuses; formatted as `kind:human-readable message`. For `ineligible`, kind is one of no_recording / too_short / too_inactive / too_long / no_events / no_snapshots / too_large. For `failed`, kind is one of provider_transient / provider_rejected / rasterization_failed / validation_failed / infra_transient / internal_error / orphaned. */readonly error_reason: string;/** Temporal workflow id for progress queries and debugging. Empty until the workflow starts. */readonly workflow_id: string;