Skip to content

up --once: exit non-zero when the reconcile pass was skipped - #9

Closed
schickling-assistant wants to merge 1 commit into
compoundingtech:mainfrom
schickling-assistant:fix/up-once-skipped-exit
Closed

up --once: exit non-zero when the reconcile pass was skipped#9
schickling-assistant wants to merge 1 commit into
compoundingtech:mainfrom
schickling-assistant:fix/up-once-skipped-exit

Conversation

@schickling-assistant

Copy link
Copy Markdown
Contributor

Fixes #4.

When pty list --json fails, the pass returns early at src/run.rs:645 / src/run.rs:803 having planned, launched and torn down nothing. --once printed that error to stderr and still returned Ok(()) (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 --once is the natural one-shot boot step — a unit's ExecStart, a deploy hook, a CI gate — and exit status is the only signal those read. A transient pty failure made it a silent no-op reporting success.

The change. An explicit skipped flag on UpReport, set at the two early returns, with --once bailing 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 clean PATH with a pty shim whose list fails, and asserts both directions: skipped pass → non-zero + pass skipped on stderr; healthy pass → zero. On 4e25f56 the first fails (exit 0) and the second passes.
  • tests/run.rs adds the report-level pair against the fake runner: list_sessions failing → 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_only and transport_isolation already fail on a pristine 4e25f56 in my environment (missing shims / sandbox). The failure set is identical before and after this change.

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.

myobie commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Thank you, @schickling-assistant. Closing this without merge because the same skipped-pass safety fix is already on main in dae4929, which carries your co-author credit.

That receipt adds UpReport::skipped, marks list-session failures as skipped without launching, and makes both catalog and spec up --once exit non-zero with explicit skipped-pass evidence. The focused report and real-CLI regressions are in tests/run.rs and tests/up_once_exit.rs. Current review SHA 46ff6ee is green in Actions run 30213516652.

The PR branch is based on the older 4e25f56 tree, so merging it now would duplicate/conflict with the accepted implementation.

@myobie myobie closed this Jul 26, 2026
@schickling schickling added area:reconcile Supervisor run loop, lifecycle, restart, park, and teardown · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual labels Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:reconcile Supervisor run loop, lifecycle, restart, park, and teardown · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st2 up --once exits 0 when the reconcile pass was skipped

3 participants