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.

chore(replay-vision): retire the vision action temporal patches (#93992)

Tue Haulund874bfa89af78
diff --git a/products/replay_vision/backend/temporal/reconciler.py b/products/replay_vision/backend/temporal/reconciler.py
index 5d4ab3d33cd1..3762c9a0f9b1 100644
--- a/products/replay_vision/backend/temporal/reconciler.py
+++ b/products/replay_vision/backend/temporal/reconciler.py
@@ -86,15 +86,9 @@ class ReconcileScannerSchedulesWorkflow(PostHogWorkflow):
except Exception:
workflow.logger.exception("replay_vision.reap_orphaned_observations_failed")
- # The stuck-run reaper is removed with vision actions; pre-patch in-flight executions
- # recorded its schedule and must replay it, so it stays behind the patch by name.
- if workflow.patched("reap-stuck-vision-action-runs-2026-07") and not workflow.patched(
- "drop-stuck-vision-action-run-reaper-2026-09"
- ):
- try:
- await self._run_reaper("reap_stuck_vision_action_runs_activity")
- except Exception:
- workflow.logger.exception("replay_vision.reap_stuck_vision_action_runs_failed")
+ # Declared until no history carrying either marker can replay.
+ workflow.deprecate_patch("reap-stuck-vision-action-runs-2026-07")
+ workflow.deprecate_patch("drop-stuck-vision-action-run-reaper-2026-09")
if workflow.patched("reap-childless-inline-scanners-2026-08"):
try:
@@ -185,7 +179,7 @@ class ReconcileScannerSchedulesWorkflow(PostHogWorkflow):
async def _run_reaper(
self,
- reaper_activity: Callable[[], Any] | str,
+ reaper_activity: Callable[[], Any],
*,
heartbeat_timeout: dt.timedelta | None = None,
start_to_close_timeout: dt.timedelta = REAPER_OP_TIMEOUT,
diff --git a/products/replay_vision/backend/temporal/sweep_workflow.py b/products/replay_vision/backend/temporal/sweep_workflow.py
index bd1b5c75e5fd..ea859e8a7715 100644
--- a/products/replay_vision/backend/temporal/sweep_workflow.py
+++ b/products/replay_vision/backend/temporal/sweep_workflow.py
@@ -61,10 +61,8 @@ class SweepScannerWorkflow(PostHogWorkflow):
@wf.run
async def run(self, inputs: SweepScannerInputs) -> None:
- # Vision actions are removed; pre-patch in-flight sweeps recorded this dispatch and must
- # replay the same commands, so the legacy path stays behind the patch until they drain.
- if not wf.patched("drop-vision-action-dispatch-2026-09"):
- await self._dispatch_due_vision_actions_legacy(inputs)
+ # Declared until no history carrying the marker can replay.
+ wf.deprecate_patch("drop-vision-action-dispatch-2026-09")
# Same heartbeat keeps the prompt recommendation fresh. The activity self-gates to at most one
# regeneration per day and only when ratings changed, so the 5-minute sweep cadence is fine.
@@ -217,33 +215,6 @@ class SweepScannerWorkflow(PostHogWorkflow):
retry_policy=common.RetryPolicy(maximum_attempts=3),
)
- async def _dispatch_due_vision_actions_legacy(self, inputs: SweepScannerInputs) -> None:
- """Replay-only: schedules the removed vision-action commands by name so old histories match."""
- try:
- due = await wf.execute_activity(
- "evaluate_due_vision_actions_activity",
- {"scanner_id": str(inputs.scanner_id), "team_id": inputs.team_id},
- start_to_close_timeout=dt.timedelta(seconds=30),
- # No worker registers this activity any more, so retrying only stalls the tick.
- retry_policy=common.RetryPolicy(maximum_attempts=1),
- )
- for d in due or []:
- try:
- await wf.start_child_workflow(
- "process-vision-action",
- d,
- id=f"process-vision-action-{d['vision_action_id']}",
- task_queue=settings.REPLAY_VISION_TASK_QUEUE,
- parent_close_policy=wf.ParentClosePolicy.ABANDON,
- execution_timeout=dt.timedelta(hours=1),
- )
- except WorkflowAlreadyStartedError:
- pass
- except Exception:
- wf.logger.exception("replay_vision.vision_action_claim_dispatch_failed")
- except Exception:
- wf.logger.exception("replay_vision.vision_action_dispatch_failed")
-
async def _start_child(self, inputs: SweepScannerInputs, candidate: CandidateSessionPayload) -> None:
try:
await wf.start_child_workflow(
diff --git a/products/replay_vision/backend/tests/test_reconciler.py b/products/replay_vision/backend/tests/test_reconciler.py
index 0d2b9ba6e70e..2e0feb52a708 100644
--- a/products/replay_vision/backend/tests/test_reconciler.py
+++ b/products/replay_vision/backend/tests/test_reconciler.py
@@ -269,6 +269,7 @@ async def _run_reconcile(mocks: _ReconcileMocks, patched: bool = True):
patch("temporalio.workflow.execute_activity", side_effect=mocks.execute_activity),
patch("temporalio.workflow.logger", fake_logger),
patch("temporalio.workflow.patched", return_value=patched),
+ patch("temporalio.workflow.deprecate_patch"),
):
return await ReconcileScannerSchedulesWorkflow().run(ReconcileScannerSchedulesInputs())
diff --git a/products/replay_vision/backend/tests/test_sweep.py b/products/replay_vision/backend/tests/test_sweep.py
index e16ca0607fd9..df7b229c0f8c 100644
--- a/products/replay_vision/backend/tests/test_sweep.py
+++ b/products/replay_vision/backend/tests/test_sweep.py
@@ -1370,6 +1370,7 @@ async def _run_sweep(mocks: _SweepMocks, inputs: SweepScannerInputs | None = Non
patch("temporalio.workflow.logger", fake_logger),
# `workflow.patched` also needs the runtime; new executions take the patched branch.
patch("temporalio.workflow.patched", return_value=patched),
+ patch("temporalio.workflow.deprecate_patch"),
patch("temporalio.workflow.unsafe.is_replaying", return_value=False),
):
await SweepScannerWorkflow().run(inputs or _sweep_inputs())