You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
spawn status --check-complete returns exit 0 when /tmp/SPAWN_COMPLETE does not exist #26
spawn status <instance-id> --check-complete returns exit code 0 (complete) even when /tmp/SPAWN_COMPLETE does not exist on the instance and the workload is still running.
Steps to reproduce
Launch an instance with a long-running user-data script that touches /tmp/SPAWN_COMPLETE at the end
Immediately after SSH is ready (before the script finishes), run:
spawn status <instance-id> --check-complete
echo$?# prints 0 — but the file doesn't exist yet
SSH to the instance and confirm: ls /tmp/SPAWN_COMPLETE → No such file
Expected exit codes
Per the documented contract:
0 = complete (/tmp/SPAWN_COMPLETE found)
1 = failed
2 = still running (file not yet present)
3 = error
When the file doesn't exist and the instance is running, exit code should be 2, not 0.
Observed
Exit 0 returned immediately after instance boot, before the user-data script has had any chance to create the file. Instance CPU was at 100% (script actively running).
--check-complete with its standardized exit codes (0/1/2/3) is only implemented for the sweep path (runSweepStatus in cmd/status.go), never for single instances.
In runStatus, the instance path (cmd/status.go:77-95) just SSHes in, runs sudo /usr/local/bin/spored status, prints the output, and return nil — so the process exits 0 whenever SSH succeeds, regardless of whether /tmp/SPAWN_COMPLETE exists. The statusCheckComplete flag is read at line 49 only to forward to runSweepStatus; the instance branch ignores it entirely.
Fix sketch
The instance branch needs to honor --check-complete and map to the documented codes:
0 complete — /tmp/SPAWN_COMPLETE (or the configured --completion-file) present
1 failed — a failure marker present, or spored reports failure
2 running — file absent, instance running
3 error — SSH/instance unreachable, or instance not running
spored already knows the completion file (completion-file config key, default /tmp/SPAWN_COMPLETE). Cleanest approach: add a spored status --check-complete mode that exits with these codes based on the file, and have spawn status --check-complete <instance> propagate spored's exit code (instead of always returning nil). Must use the instance's configured completion-file, not a hardcoded path.
Note
This is independent of the launch-time default — even an instance launched without --on-complete should report 2 (running) not 0 while the file is absent.
Fixed in #28 (merged to main): spawn status --check-complete now forwards to spored's new --check-complete mode and propagates exit codes 0/1/2/3 for single instances. Ships in the next release.
Activity
Fix cloud-init race + spawn#26 polling workaround
scttfrdmn commentedon May 31, 2026
Root cause confirmed
--check-completewith its standardized exit codes (0/1/2/3) is only implemented for the sweep path (runSweepStatusincmd/status.go), never for single instances.In
runStatus, the instance path (cmd/status.go:77-95) just SSHes in, runssudo /usr/local/bin/spored status, prints the output, andreturn nil— so the process exits 0 whenever SSH succeeds, regardless of whether/tmp/SPAWN_COMPLETEexists. ThestatusCheckCompleteflag is read at line 49 only to forward torunSweepStatus; the instance branch ignores it entirely.Fix sketch
The instance branch needs to honor
--check-completeand map to the documented codes:0complete —/tmp/SPAWN_COMPLETE(or the configured--completion-file) present1failed — a failure marker present, or spored reports failure2running — file absent, instance running3error — SSH/instance unreachable, or instance not runningspored already knows the completion file (
completion-fileconfig key, default/tmp/SPAWN_COMPLETE). Cleanest approach: add aspored status --check-completemode that exits with these codes based on the file, and havespawn status --check-complete <instance>propagate spored's exit code (instead of always returning nil). Must use the instance's configured completion-file, not a hardcoded path.Note
This is independent of the launch-time default — even an instance launched without
--on-completeshould report2(running) not0while the file is absent.fix: spored install race (#27) and single-instance --check-complete (#26
scttfrdmn commentedon May 31, 2026
Fixed in #28 (merged to main):
spawn status --check-completenow forwards to spored's new--check-completemode and propagates exit codes 0/1/2/3 for single instances. Ships in the next release.Fix cloud-init race + spawn#26 polling workaround