Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneeszack

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:7

The 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)

  1. A serve-started run is registered in ActiveRunRegistry when it starts (src/serve/handlers/workflow_handlers.ts ~675) and deregistered only after executeWorkflowWithLocks returns.
  2. The executor saves the run as suspended before that return. In between, a reader sees suspended, but the run is still registered.
  3. handleWorkflowApprove / reject call reserveSuspendedRun (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 with SUSPENDED_RUN_BUSY_MESSAGE.
  4. With strictGate, the refusal goes through busyGateState (workflow_handlers.ts ~1866), which classifies the gate and then throws the result away unless it is decided. So ambiguous, absent, nested and not_reached (refusals a retry cannot change) are all reported as busy.

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 let reserve accept 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. busyGateState should pass through at least ambiguous, and likely absent / nested / not_reached, not only decided.

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.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 8 MOREREVIEW+ 8 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

11/9/2026, 9:12:31 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/9/2026, 8:35:44 PM

Sign in to post a ripple.