Skip to content

Automate browser based workflows with AI

SKY-15561 follow-up: a failed arm read logs unknown, not never-resolved (#8427)

pedrohsdb083979203b70
diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py
index 6656917c6..7010ea99c 100644
--- a/skyvern/forge/sdk/workflow/service.py
+++ b/skyvern/forge/sdk/workflow/service.py
@@ -960,15 +960,9 @@ def _as_utc(dt: datetime) -> datetime:
def _task_v3_ab_arm_for_duration_log(workflow_run_id: str) -> str | None:
- """Best-effort read of the workflow-block engine A/B arm pinned on this run's context.
-
- Three-way: "treatment"/"control" when this run's own context resolved an arm in-band,
- None when this run's own context never resolved one, "unknown" when finalization runs
- out-of-band (API cancel, the stuck-run sweep, copilot cooperative cancel) so no context
- for this run is current -- attribution is lost, not "never entered the A/B".
-
- Telemetry only: a lookup failure must never break run finalization, so any exception is
- swallowed and logged as a warning rather than propagated (SKY-15561, mirrors SKY-15499).
+ """Failure-safe wrapper around ``resolved_workflow_block_engine_arm_label`` (which owns the
+ three-way contract): telemetry only, so a lookup failure must never break run finalization —
+ it logs a warning and returns "unknown" (attribution lost) rather than propagating.
"""
try:
return resolved_workflow_block_engine_arm_label(workflow_run_id)
@@ -978,7 +972,9 @@ def _task_v3_ab_arm_for_duration_log(workflow_run_id: str) -> str | None:
workflow_run_id=workflow_run_id,
exc_info=True,
)
- return None
+ # A failed read is attribution-loss, not "never entered the A/B" — same bucket as the
+ # out-of-band finalizers.
+ return "unknown"
def _get_workflow_run_max_elapsed_timeout_seconds(workflow_run: WorkflowRun) -> float:
diff --git a/tests/unit/test_workflow_run_minutes_gate.py b/tests/unit/test_workflow_run_minutes_gate.py
index ce1cf6547..6aec90ca5 100644
--- a/tests/unit/test_workflow_run_minutes_gate.py
+++ b/tests/unit/test_workflow_run_minutes_gate.py
@@ -600,5 +600,5 @@ async def test_duration_log_survives_a_failed_arm_lookup(
duration_logs = [e for e in logs if e.get("event") == "Workflow run duration metrics"]
assert len(duration_logs) == 1
- assert duration_logs[0]["task_v3_ab_arm"] is None
+ assert duration_logs[0]["task_v3_ab_arm"] == "unknown"
assert record_run_duration.await_count == 1