Relationships
#2918 A cancelled workflow exits before its steps stop, leaving their method-run records at running
Opened by hammz · 10/1/2026· Shipped 10/1/2026
Description
Split out of swamp-club#2915. The other half of #2915 (workflow-step method runs recorded as failed instead of cancelled when the run is aborted) is fixed with swamp-club#2910; this issue is the part that fix does not cover.
When the process that owns a workflow run gets SIGTERM, it exits about 0.6 s later, without waiting for its in-flight shell steps to finish their 3 s SIGTERM-to-SIGKILL grace (KILL_GRACE_MS, src/infrastructure/process/process_executor.ts). A step still stopping when the process exits never reaches the step executor's catch block, so its method-run output record is never written past running and stays at running indefinitely, with no completedAt. The tracker row is completed only by whoever ran the cancel.
Reproduced on 20261001.174510.0-sha.265caa01 while triaging #2910; the owner exited with code 1, not 130 or 137, so it is a normal exit that does not wait for the steps.
Steps to reproduce
- Two command/shell models whose execute method traps TERM, writes to a file and sleeps: trap 'echo got >> trap.txt; sleep 5; exit 0' TERM; sleep 60 & wait
- A workflow with one step per model and no dependsOn.
- swamp workflow run in one shell.
- After a few seconds, from a second shell: swamp model cancel --all (swamp workflow cancel should show the same).
- swamp model method history search --json
Expected
The owning process waits for its in-flight steps to stop (bounded by the kill grace) and saves each step's method-run record as cancelled before it exits.
Actual
The owner exits about 0.6 s after SIGTERM. Both method-run records stay at running indefinitely.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.