Relationships
#4561 serve: a run that reads suspended is refused as busy by approve/reject, and the busy reply hides ambiguous_gate on POST /api/v1/action
Opened by zack · 11/9/2026· Shipped 11/9/2026
What happens
A run that serve already reports as suspended can still be refused by workflow.approve / workflow.reject with 409 busy ("Another operation on this run is in progress; try again"). On the bearer-only HTTP route (POST /api/v1/action, strict gate mode), the busy also hides the refusal the request should get: a request that can never succeed, such as an ambiguous_gate one, comes back as busy and only gets its real answer on a retry.
An integration that does the obvious thing (wait for the run to report suspended, then send the decision) can have its first decision refused.
Seen in UAT
UAT run for swamp 20261109.195046.0-sha.7bc23455 (swamp-uat GitHub Actions run 42687938462, job "Serve: Token Auth"):
tests/cli/serve/token/action_repeats_test.ts:191: "swamp serve POST /api/v1/action refuses a step name in two jobs until the job is named, and a repeat decides neither job's gate again"
error: AssertionError: Values are not equal: {"code":"busy","message":"Another operation on this run is in progress; try again","requestId":"b6f7d117-08f2-4c0a-a383-6887e1f09f3b"}
- busy
+ ambiguous_gate
at ActionCaller.refused (src/cli/helpers/serve_action.ts:123:5)
at tests/cli/serve/token/action_repeats_test.ts:206:7The test starts a two-job workflow with the same gate step name in both jobs, waits for the run status to read suspended, then sends workflow.approve with no jobName. Expected 409 ambiguous_gate; got 409 busy. The same test passed on the three runs before, so the cause is timing.
Cause (traced on main c9a6be0fb)
- A serve-started run is registered in
ActiveRunRegistrywhen it starts (src/serve/handlers/workflow_handlers.ts~675) and deregistered only afterexecuteWorkflowWithLocksreturns. - The executor saves the run as
suspendedbefore that return. In between, a reader seessuspended, but the run is still registered. handleWorkflowApprove/ reject callreserveSuspendedRun(workflow_handlers.ts~2558) →registry.reserve(run.id), which returns null while#runs.has(runId)(src/serve/active_run_registry.ts), so the request is refused withSUSPENDED_RUN_BUSY_MESSAGE.- With
strictGate, the refusal goes throughbusyGateState(workflow_handlers.ts~1866), which classifies the gate and then throws the result away unless it isdecided. Soambiguous,absent,nestedandnot_reached(refusals a retry cannot change) are all reported asbusy.
Expected
- Once a run reads
suspended, decisions on it are accepted, not refused as busy. Either deregister (or hand off) the run before the suspended state can be read, or letreserveaccept a run that has been saved as suspended and whose executor is only winding down. - A refusal that retrying can't change shouldn't come back as
busy.busyGateStateshould pass through at leastambiguous, and likelyabsent/nested/not_reached, not onlydecided.
Impact
Integrations on POST /api/v1/action (Slackwater, #4474 / #4555) can see the first button press after a gate opens refused, and a malformed decision tells them to retry when it should tell them the request is wrong. swamp workflow approve --server has the same window through reserveSuspendedRun.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.