Repository navigation
fix(lifecycle): start reclaims-or-refuses instead of binding blindly (#420 tail) - #2291
Merged
Merged
Conversation
#420 tail) `stop` learned in #2287 that the pidfile names ONE core and is not evidence that only one is running. `start` never learned it. Its only guard was "does a core answer `ping`?", so a core that is RUNNING but NOT answering — wedged, mid-boot, or bound where this CLI cannot reach — was invisible, and `start` launched a second one on top of it. Same missing constraint as #2287, on the other side of the lifecycle, and the same as airc #355: reclaim belongs in BOTH shutdown and start. A second core is never benign. Both hold the same socket path (the later one unlinks and re-binds it) and whichever the kernel hands a connection to is the one that answers, so a shipped fix looks intermittently broken and an unshipped one intermittently fixed. The fix is ONE primitive both launch paths call, not a second ad-hoc check: `runtime/core_bind_guard::decide(ping_ok, running_pids)` — a pure, exhaustive 4-row truth table (Free / AlreadyServing / Occupied). It lives in the LIB, not the bin, because CI runs `cargo test -p continuum-core --lib`; a truth table tested inside a bin would not be covered by the gate that guards it. - `start`: Free launches, AlreadyServing no-ops, Occupied REFUSES and names the pids with the three ways out. Refuse rather than auto-kill: `reboot` guards destructive restarts behind live-training and live-benchmark leases, and a `start` that silently reaped a core would route around those guards. `start --force` is the explicit reclaim, and says plainly that it checks no lease. - `ensure_core_running` (implicit autostart): same guard, no reclaim arm. A command that merely wants a live core has no business killing one. Also bounds the ping (`PING_BUDGET`, 5s against a measured 20ms round trip). That is load-bearing, not defensive: an unbounded ping does not fail against an unresponsive core, it HANGS — the kernel completes connect() into the listen backlog whether or not the process is scheduled, and the read then waits for a reply that never comes. Without the bound the Occupied arm was unreachable on the live path despite green unit tests. Live, on this box: - SIGSTOP every core, run `start` — unbounded: no output, still hung at 90s. Bounded: exits 1 in 8s with the refusal naming both live pids, and the cores resume unharmed on SIGCONT. - Unserved socket with two live cores: exit 1 in 0s, both pids named. - Healthy core: `start` still no-ops. Idempotence preserved. - Found while testing: TWO cores were live on this machine at once (a debug build and the installed release, 78s apart, both holding /tmp/continuum-core.sock) — the #2287 condition, present in the wild. Note for whoever picks this up: `continuum reboot` sets CONTINUUM_SKIP_SELF_BUILD and so never rebuilds the `continuum` CLI itself. A CLI-only fix therefore does not reach an operator via reboot — proven here, where the installed CLI's `stop` left a survivor that the freshly-built `stop` then reaped with SPLIT BRAIN. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Aug 14, 2026
…finally CI-covered (#422) (#2292) Two defects, one root: deploy-verify only ever looked at the CORE, and the pure logic that decides its verdict was tested where CI does not look. ## It was half-blind `reboot` sets CONTINUUM_SKIP_SELF_BUILD and so never rebuilds the `continuum` CLI. That is deliberate — a running image cannot be replaced on Windows, and letting the start script build it failed the whole cargo invocation and skipped the CORE build (772s to that failure on BIGMAMA). The consequence was never written down: a fix that lives in the CLI cannot reach an operator through the documented deploy path, and deploy-verify printed its green checkmark anyway. Measured 2026-08-14, same machine, minutes apart: the installed CLI's `stop` reaped only the pidfile core and left pid 6453 alive and silent; the freshly-built CLI's `stop` then printed SPLIT BRAIN and reaped it. #2287 had merged and had NOT reached the installed CLI — while deploy-verify reported "✅ core is running build 1de9ceb". Every lifecycle fix shipped this week (#2287 stop-reaps-all, #2288 config.env, #2291 start reclaim-or-refuse) lives in the CLI; none was provably running. That is #194 one tier up. `cli_staleness_note` now rides alongside the core verdict on BOTH outcomes. It WARNS rather than failing: the core verdict is about whether the swap took, CLI staleness is a separate fact, and making it fatal would break deploy-verify for every operator whose CLI predates their core — today, all of them. Silence when it matches, so the note means something when it fires. Unjudgeable provenance (built outside a git tree) is stated, not swallowed, and never claims staleness it cannot prove. ## And its tests were unreachable `deploy_verdict` and `sha_matches` were pure and unit-tested — inside `bin/continuum.rs`. CI runs `cargo test -p continuum-core --lib`, which does not compile bin test mods, so the #194 guard was protected by tests nothing ran. Exactly the trap #2291 documented for the bind guard, sitting one function away the whole time. Moved to `runtime/deploy_provenance.rs` with their tests, plus new coverage for the CLI note and for sha_matches rejecting junk in both directions. The bin keeps everything impure (ping, git rev-parse, artifact resolution, process description) and delegates the verdicts. 4 tests, all under the --lib gate. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
Closes the remaining half of #420.
stoplearned in #2287 that the pidfile names ONE core;startnever did.The missing constraint
start's only guard was "does a core answerping?". A core that is running but not answering — wedged, mid-boot, or bound where this CLI can't reach — was invisible, sostartlaunched a second one on top of it. Same shape as #2287 on the other side of the lifecycle, and the same as airc #355: reclaim belongs in BOTH shutdown and start.A second core is never benign: both hold the same socket path (the later one unlinks and re-binds it), and whichever the kernel hands a connection to is the one that answers — so a shipped fix looks intermittently broken and an unshipped one intermittently fixed.
The fix — ONE primitive, not a second ad-hoc check
runtime/core_bind_guard::decide(ping_ok, running_pids)— pure, exhaustive 4-row truth table:Free/AlreadyServing/Occupied.It lives in the lib, not the bin, because CI runs
cargo test -p continuum-core --lib; a truth table tested inside a bin wouldn't be covered by the gate that guards it.start--forcereclaims)ensure_core_runningRefuse, not auto-kill.
rebootguards destructive restarts behind live-training and live-benchmark leases; astartthat silently reaped a core would route around them.start --forceis the explicit reclaim and says plainly that it checks no lease. An implicit autostart never reclaims at all — a command that merely wants a live core has no business killing one.The ping bound is load-bearing, not defensive
An unbounded ping doesn't fail against an unresponsive core, it hangs: the kernel completes
connect()into the listen backlog whether or not the process is scheduled, then the read waits for a reply that never comes. WithoutPING_BUDGETtheOccupiedarm was unreachable on the live path despite green unit tests. 5s against a measured 20ms round trip.Verification
Unit: 4 truth-table tests,
--lib(the CI gate). Live, on this box:start— unbounded: no output, still hung at 90s. Bounded: exit 1 in 8s with the refusal naming both live pids; cores resume unharmed on SIGCONT./tmp/continuum-core.sock) — the fix(lifecycle):stopreaps EVERY running core, not just the one the pidfile names #2287 condition, in the wild.Note for whoever picks this up
continuum rebootsetsCONTINUUM_SKIP_SELF_BUILDand so never rebuilds thecontinuumCLI itself, meaning a CLI-only fix does not reach an operator via reboot. Proven here: the installed CLI'sstopleft a survivor that the freshly-builtstopthen reaped with SPLIT BRAIN.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo