Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublic
AssigneesNone

Relationships

#4868 Step-lease and pending-dispatch methods run from a workflow step in serve bypass the dispatch tail's per-record ordering

Opened by zack · 11/18/2026

Found while triaging #4864 (the same gap for swamp/enrollment-token).

design/enablers/remote-execution.md makes the orchestrator the sole writer of swamp/step-lease and swamp/pending-dispatch records, and the dispatch service orders each record's transitions on its TransitionTail (src/serve/dispatch_service.ts). StepLeaseLedger (src/serve/step_lease_ledger.ts) reads a lease and writes the next version, and relies on the caller to order transitions of one lease, since the datastore has no compare-and-swap.

The behaviors' methods (step-lease: acquire, mark_writes, complete, fail, expire; pending-dispatch: enqueue, mark_dispatched, timeout, cancel, orphan) are ordinary methods. A workflow step or a model method run in serve that calls one of them on a live record goes through the generic method execution path and writes outside the dispatch tail. Two interleavings this allows:

  • Resurrected lease: the dispatch service's mark_writes reads an active lease, a step's expire writes expired, then mark_writes writes active with hasWrites back over it.
  • Wrong terminal state: a step's expire reads active, the dispatch service's complete writes completed, then the step writes expired over it, breaking the rule that an ended lease is never rewritten.

Not reproduced; found by reading the code. Downstream effects of a resurrected or re-ended lease (boot reconciliation, retry decisions on hasWrites) were not traced.

Expected: in-serve runs of these orchestrator-owned methods are refused (no operator has a reason to drive them by hand), or ordered on the dispatch tail.

02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED

Open

11/18/2026, 3:12:34 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.