Repository navigation
fix: exit non-zero when doctor, stop --all or snapshot delete fail - #22
Merged
Asdivyansh merged 2 commits intoNov 16, 2026
Merged
Conversation
These commands reported failure but still exited 0, so a script or CI job couldn't tell that anything went wrong: - doctor printed "N critical issue(s) found" and exited 0. - stop --all carried on past a container it couldn't remove (and a proxy it couldn't stop), then printed "Sandbox shut down cleanly." and exited 0. - snapshot delete printed "not found or could not be deleted" and exited 0. Each now sets process.exitCode = 1 on failure, so output still flushes and the rest of stop's shutdown still runs. stop names what it couldn't stop instead of claiming a clean shutdown. doctor warnings alone still exit 0. CLI tests run the real entry point with a fake docker on PATH and a temp HOME; the three failure cases fail on main and pass here. Fixes SilosLabs#21
On Linux, conf keeps its config under $XDG_CONFIG_HOME when that is set, regardless of HOME, and CI runners set it. Every CLI test therefore read and wrote the runner's real config directory: the config written for the snapshot/stop tests leaked into the doctor test's HOME, failed to decrypt (its key is derived from a different HOME) and doctor aborted with "Unsupported state or unable to authenticate data". macOS ignores XDG_CONFIG_HOME, so this only showed up in CI. Point XDG_CONFIG_HOME inside each temp HOME for every spawned CLI.
Member
Author
|
The first CI run failed only on the new c8d412d pins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #21
Problem
doctor,stop --allandsnapshot deletereported failure but exited 0. A script or CI step running them couldn't tell anything had gone wrong, andstop --alleven printed "Sandbox shut down cleanly." after a container failed to stop.Change
doctor: a newreportResults()prints as before, then setsprocess.exitCode = 1if any check failed. That covers both the "not configured" early return and the full run. Warnings alone still exit 0.stop --all:stopAllAgents()now returns which containers failed.runStopcollects those, plus a proxy that couldn't be stopped.Could not stop: …instead of "shut down cleanly" and exits 1. The rest of the shutdown (config, network cleanup) still runs.docker psis now reported instead of being treated as "no containers".snapshot delete: exits 1 whendocker rmifails.docs/cli-reference.mdnotes the exit behaviour for all three.All three use
process.exitCoderather thanprocess.exit(), so output flushes and cleanup still runs.Tests
The new cases in
tests/cli.test.tsrun the real CLI (node --import tsx src/cli.ts) with a temp HOME, a real config written throughwriteConfig, and a fakedockeron PATH. The fake fails on demand: everything,rmi, orrmof one container.maindoctor, Docker down, not configuredstop --all,silo-bcan't be removedsnapshot delete missingstop --all, everything stopssnapshot delete presentThe three failure cases fail on
mainand pass here.npm run typecheck,npm test(357 passing) andnpm run buildare green, and the branch merges cleanly with #13.Not in this PR:
integrations test, which also exits 0 when an integration is unreachable. That function needs the bigger fix tracked as "integrations test checks what it claims".runon an LLM error. It needs a live sandbox to reproduce, so it belongs with therunrobustness work.