Relationships
#3252 S3-backed serve: graceful shutdown saves interrupted workflow status without a remote flush
Opened by vcjdeboer · 10/11/2026· Shipped 10/11/2026
Summary
On an S3-backed swamp serve, a graceful shutdown can save a workflow's
interrupted status locally without flushing it to the authoritative remote
datastore. After restart, the workflow can therefore reappear as running.
Affected version: 20261007.155916.0-sha.577deb87, source commit
577deb87. This concerns Swamp itself,
not an extension.
Reported behaviour and evidence limits
A restart during an active workflow drained normally. Completed stage outputs
remained intact, but after restart the workflow was still reported as
running and required administrator cancellation.
That runtime observation was reported separately. The exact affected source revision was independently inspected for this report; raw runtime evidence was not independently reviewed. The isolated reproduction below has not yet been executed. Intact completed outputs do not establish that unfinished workflow stages resumed or completed.
Expected behaviour
When shutdown marks a workflow interrupted, that state should survive a
fresh-cache restart against the remote datastore. Shutdown should await the
required persistence boundary or explicitly report a persistence failure.
Source findings
- Shutdown interruption saves run inside
runInRootUnitOfWorkwithflush: undefined; the source comment states that this path does not push. - Drain and abort sequencing returns the remaining active runs for interruption marking.
- Root unit of work attaches and awaits the supplied flush callback; an undefined callback cannot push these changes.
- Legacy adapter awaits dirty marks and the optional flush. Marking files dirty does not itself establish remote durability.
These findings support the missing-flush diagnosis. The version that first introduced it has not been established.
Proposed isolated reproduction
- Configure a throwaway S3-backed serve repository and a workflow that remains active beyond the shutdown drain interval.
- Start the workflow and confirm its remote run record is
running. - Deliver SIGTERM; capture the drain, abort and interruption sequence.
- Compare the authoritative remote run record with the locally saved record before any unrelated operation can push pending changes.
- Restart with an empty cache against the same datastore. The workflow should
retain
interruptedafter successful persistence.
A filesystem-only rehearsal does not establish remote durability.
Fix scope and regression checks
Investigate flushing shutdown interruption writes through the existing sync mechanism, with the correct namespace and synchronization gate, before persistence services are destroyed. Check interaction with draining requests, their final pushes and runtime polling; merely adding a callback may be insufficient.
Regression checks should establish that interruption survives a fresh-cache restart, workflows completed during drain remain completed, push failures are observable, and filesystem-backed shutdown still works correctly.
Latest release source check
The latest available release checked before submission was
20261011.154850.0-sha.d650cb70. Its shutdown interruption path also uses
runInRootUnitOfWork with flush: undefined, so the identified missing flush
remains in that source. Runtime behaviour on this newer release has not been
reproduced.
Shipped
Click a lifecycle step above to view its details.
stack72 commented 10/11/2026, 5:52:17 PM
@vcjdeboer thank you for this report. Your source analysis was spot on, and the reproduction outline made the fix quick to confirm.
When a swamp serve on a remote datastore shuts down gracefully, it now pushes the interrupted status of the runs it aborted to the datastore before it stops. A restart, even with an empty cache, shows those runs as interrupted instead of still running or cancelled.
We checked this against an S3 emulator. On the current release, a SIGTERM during a long-running step left the bucket at cancelled. With the fix, the bucket and a fresh-cache restart both show interrupted (reason server_shutdown).
The push gets at most 5 seconds. If the datastore can't be reached, shutdown logs a warning naming the affected runs and carries on, so it never hangs. A filesystem-backed serve behaves exactly as before.
The fix will be in the next release (swamp-club/swamp#2993).
Sign in to post a ripple.