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

Relationships

#3157 A cancelled shell step can fail with a lock timeout instead of reporting as cancelled

Opened by zack · 10/7/2026· Shipped 10/7/2026

Follow-up to swamp-club#3111 (PR 2910), from the adversarial review of that change. Traced by reading the code; not reproduced.

What happens

Since swamp-club#3111 a shell step ends its lock hand-off after its command returns and before it writes: it re-keys the locks held for the run and waits for a structural command (for example swamp data gc) that is still working under the old nonce, up to SWAMP_LOCK_TIMEOUT_MS.

When the step is cancelled, executeProcess throws, the catch in src/domain/models/command/shell/shell_model.ts turns that into exit code -1, and the method still awaits lockHandOff.end(). If a structural command the step started is still working, that wait can run to the lock timeout and throw LockTimeoutError. The step then fails with a lock timeout instead of ending as cancelled, and the cancel takes up to the lock timeout (60 seconds by default) longer.

Nothing is written in this case, so it is safe. It is slower and mislabelled.

Why it is inconsistent

The dispatch path already has this exception. In DispatchService dispatchOnce (src/serve/dispatch_service.ts) an attempt that failed on a cancelled step logs the reclaim failure and rethrows the original AbortError, so the step stays cancelled. The local shell path has no such rule, so the two disagree.

Possible directions

  • Mirror the dispatch rule in the shell model: when context.signal is aborted and the hand-off end rejects, log it and keep the cancellation outcome. The shell model must then write nothing, since the locks were not taken back.
  • Pass the abort signal into the reclaim wait so a cancel ends the wait early in both paths. A cancelled run writes nothing to the model, so it has no need to wait out the structural command.
  • At least document the difference in design/enablers/datastores.md, Hand-offs and re-keying.
  • A reclaim failure after a lost worker is logged with the cancelled-step wording.
  • A drain whose skipped set never settles ends in a LockTimeoutError that says it waited on held locks when none were held.
02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 13 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

10/7/2026, 9:54:12 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack10/7/2026, 8:45:50 PM

Sign in to post a ripple.