up --once: exit non-zero when the reconcile pass was skipped - #9
Closed
schickling-assistant wants to merge 1 commit into
Closed
Conversation
When pty list --json fails, the pass returns early having planned, launched and torn down nothing. --once printed that error to stderr and still returned Ok(()), so exit status could not distinguish "no pass happened" from "the pass ran and the fleet is fine" — and --once is exactly the one-shot boot step whose exit status a unit, deploy hook, or CI gate reads. Mark the report skipped at the two early returns and have --once bail on it. Per-agent errors during a pass that did run stay non-fatal; that distinction is the point. Loop semantics are untouched. tests/up_once.rs covers the CLI contract in both directions; tests/run.rs covers the report flag and its converse.
Contributor
|
Thank you, @schickling-assistant. Closing this without merge because the same skipped-pass safety fix is already on That receipt adds The PR branch is based on the older 4e25f56 tree, so merging it now would duplicate/conflict with the accepted implementation. |
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 #4.
When
pty list --jsonfails, the pass returns early atsrc/run.rs:645/src/run.rs:803having planned, launched and torn down nothing.--onceprinted that error to stderr and still returnedOk(())(src/main.rs:1691-1696,src/main.rs:1588-1595), so exit status could not distinguish "no pass happened" from "the pass ran and the fleet is fine".That matters because
--onceis the natural one-shot boot step — a unit'sExecStart, a deploy hook, a CI gate — and exit status is the only signal those read. A transientptyfailure made it a silent no-op reporting success.The change. An explicit
skippedflag onUpReport, set at the two early returns, with--oncebailing on it. The distinction is deliberate: a pass that did run and had a per-agent spawn error stays non-fatal and still exits 0, because that is a different condition from an absent reconcile. Supervising-loop semantics are untouched.Tests.
tests/up_once.rs(new file, so it will not conflict with in-flight edits elsewhere) drives the real binary on a cleanPATHwith aptyshim whoselistfails, and asserts both directions: skipped pass → non-zero +pass skippedon stderr; healthy pass → zero. On4e25f56the first fails (exit 0) and the second passes.tests/run.rsadds the report-level pair against the fake runner:list_sessionsfailing →skipped, nothing launched; a spawn failure → not skipped, errors present.The same flag would also let the supervising loop escalate a persistently skipping pass, but I did not presume to change loop behaviour — that felt like your call.
You may already have this in unpushed work; happy for it to be closed in favour of your version.
Note:
codex_hooks,materialize,native_onlyandtransport_isolationalready fail on a pristine4e25f56in my environment (missing shims / sandbox). The failure set is identical before and after this change.