Repository navigation
fix(lifecycle): stop reaps EVERY running core, not just the one the pidfile names - #2287
Merged
Merged
Conversation
… pidfile names
Measured live 2026-08-14: two continuum-core-servers were alive at once, both with
/tmp/continuum-core.sock open — a debug build (23:51) and the installed release (23:54),
the second having unlinked and re-bound the path. `continuum stop` printed
stopping core (pid 70240)
singular, reaped that one, and left the other serving. `deploy-verify` had already been
saying "pid(s) 70240,68653" — plural — and treating it as a footnote inside a stale-binary
message.
Two reasons the survivor was invisible:
1. the multi-core sweep was gated behind `if !stopped`, so a pidfile present meant
"handled, stop looking". The pidfile names ONE core; it is not evidence that only one
is running.
2. `reap_owned_orphans` keys ownership on `~/.continuum/bin` (owned_engine_orphans:994).
A core built into the project's own mandated CARGO_TARGET_DIR is not under that root,
so every dev-built core is un-reapable by construction — which is exactly what the
survivor was.
Fix: after the pidfile core is killed, always enumerate `running_core_pids()` (name-based,
already platform-correct) and reap anything left. The pidfile pid is excluded from that set
because SIGTERM is asynchronous and would otherwise report a split brain on every ordinary
stop — a false alarm on a message whose whole value is that it only fires when something is
genuinely wrong.
Why a second core is never benign: whichever one the kernel hands a connection to is the one
that answers, so a shipped fix can look intermittently broken and an unshipped one
intermittently fixed. It also doubles the citizens — the observed symptoms were two sets of
personas heartbeating the same claims, a board row reading "Claimed" with no holder, and
duplicate Qwen2.5-VL lanes on 58091/58092 spawned ten seconds apart.
Live positive control, on a real split brain that reproduced on its own:
stopping core (pid 29747)
SPLIT BRAIN: 1 core(s) still running after the pidfile core was stopped — reaping (pid(s) 68653)
Both arms proven: the previously-dead pidfile-present path fired, and the false-positive
guard held (29747, freshly SIGTERMed, was correctly not counted as a survivor).
Remaining half, tracked separately: `start` still binds blindly. Every dispatched command
auto-starts a core when nothing answers the socket (dispatch → ensure_core_running), so a
core alive on an orphaned inode looks like "no core" and a fresh one is spawned — the loop
that manufactured this state. Start must reclaim-or-refuse, the same shape #90 already uses
for orphaned llama-server lanes and the same missing constraint as airc #355.
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
… NOWHERE for days (#407) (#2289) The memory API moved from `&str` to `&PersonaRef` — `load_corpus`, `multi_layer_recall` and `consciousness_context` all take the typed ref now (an identity is a type, not loose text). This test file kept handing them the bare `PERSONA_ID` literal, so the test binary stopped compiling: 12 × E0308 across 12 call sites. WHY IT LOOKED LIKE A WINDOWS PROBLEM AND WASN'T. The macOS job runs `cargo test -p continuum-core --lib` — lib only. The Windows job runs `cargo check -p continuum-core --lib --tests`. Only the second one builds test binaries, so only Windows went red, for days, on every canary push, and the card that tracked it (#407) reads "Continuum Windows CI has been RED". It was never Windows-specific and it was never a failing test: the binary did not compile on any platform, and `cargo check --tests` reproduces all 12 errors on macOS in one command. Meanwhile all 16 of these tests — semantic recall, associative recall by tags, cross-context, decay-resurface, multi-layer convergence, corpus replacement — had not executed anywhere. A red Windows column read as a platform quirk; what it actually meant was that a whole recall-accuracy suite was dark. Fix: one `persona()` constructor beside `PERSONA_ID`, and the 12 sites pass `&persona()`. The id string still lives in exactly one place, and the struct fields that legitimately want a `String` still use `PERSONA_ID.into()` — six of those, untouched. The one call that deliberately passes an unknown persona to assert an error keeps doing exactly that, now typed. Verified: `cargo check -p continuum-core --tests` clean (was 12 errors), and `cargo test -p continuum-core --test memory_recall_accuracy` → 16 passed, 0 failed. Compiling was not the bar; they pass. This unblocks the Windows column for every open PR — it is the only failure on #2286, #2287 and #2288, none of which touch this file. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
joelteply
added a commit
that referenced
this pull request
Aug 14, 2026
#420 tail) (#2291) `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. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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]>
joelteply
added a commit
that referenced
this pull request
Aug 14, 2026
…able (#422) (#2293) `continuum reboot` sets CONTINUUM_SKIP_SELF_BUILD=1 unconditionally, so start-server.sh skips the CLI build on every platform. That guard exists for exactly ONE constraint, stated in its own comment: Windows LOCKS a running image, so `cargo build --bin continuum` from inside the running `continuum` fails with `failed to remove file ...\continuum.exe`, cargo returns non-zero for the WHOLE invocation, every later build is skipped — the CORE included — and reboot dies after its full timeout having rebuilt nothing (772s on BIGMAMA, 2026-08-05). Real, and worth guarding. The same comment also records that on Unix it "silently works: unlink leaves the running inode" — and the guard was applied there anyway. That is the whole of #422: a Windows accommodation charged to every operator, making the documented deploy path (`edit → reboot → exercise`) structurally unable to ship a fix living in the CLI. Proven on this Mac 2026-08-14: `stop`'s split-brain reap (#2287) had merged and had NOT reached the installed CLI, leaving a core alive and silent — while deploy-verify printed its green checkmark, because it only looked at the core. Nothing else was missing. start-server.sh already installs the built CLI into ~/.local/bin with a temp+mv atomic swap, and does it OUTSIDE the guard — so on a Rebuild platform the loop closes with no new verb and no new swap machinery. The running image is normally the ~/.local/bin COPY, not the target-dir binary cargo replaces, so the Unix inode behaviour is a second line of defence rather than the first. deploy_provenance::cli_self_build(target_os) now owns the decision and names the one platform it is for. It takes the OS as a parameter rather than reading cfg!, so BOTH rows are unit-tested from any host — the Windows row is the one no Mac CI job would otherwise cover. On Skip the CLI states out loud that a CLI-side fix is NOT deployed; a silent skip that reads as a completed deploy is how the stale CLI survived a green deploy-verify in the first place. SECOND DEFECT, found while validating this and fixed here because enabling the build walks straight into it: the CLI's GPU-free flag was a bare `--no-default-features`, which on macOS ALWAYS fails — `metal` is not a default feature and `llama` is an unconditional path dependency, so the llama crate's `compile_error!("built on macOS WITHOUT --features metal")` fires. The GPU-free CLI build has therefore never once succeeded on a Mac; every `npm start` since it landed hit the loud "⚠ GPU-free continuum build failed … Please report this" fallback and shipped a GPU-linked CLI while reporting an anomaly nobody reported. CONTINUUM_CLI_FEATURES is now platform-shaped like the core's set already was, using `llama/mac-cpu-only` — that guard's OWN declared opt-in for a deliberately CPU-only build, which is exactly what a socket client wants. Verified: `cargo check --bin continuum --no-default-features --features llama/mac-cpu-only` compiles clean in 1m45s. Also repointed the swept-cache CLI restore (#296 path) from CONTINUUM_FEATURES to CONTINUUM_CLI_FEATURES — it was rebuilding the CLI WITH GPU deps, re-creating the exact Windows-unlaunchable bug (0-byte exit 127 on a CUDA-version mismatch) that the GPU-free build exists to prevent. Tests: 5/5 in runtime::deploy_provenance, under the `cargo test --lib` gate CI actually runs. 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.
What was measured
Two
continuum-core-serverprocesses were alive at once, both with/tmp/continuum-core.sockopen:~/.continuum/cache/cargo-target/debug/continuum-core-server~/.continuum/bin/continuum-core-servercontinuum stopprintedstopping core (pid 70240)— singular — reaped that one, and left the other serving.deploy-verifyhad already been reportingpid(s) 70240,68653— plural — but as a footnote inside a stale-binary message, so a split brain read as a version mismatch.Why the survivor was invisible to both sweeps
if !stopped. A pidfile present meant "handled, stop looking". But the pidfile names ONE core; it is not evidence that only one is running.reap_owned_orphanskeys ownership on~/.continuum/bin(owned_engine_orphans:994). A core built into the project's own mandatedCARGO_TARGET_DIRis not under that root, so every dev-built core is un-reapable by construction — which is exactly what the survivor was.Why a second core is never benign
Whichever core the kernel hands a connection to is the one that answers. A shipped fix can look intermittently broken and an unshipped one intermittently fixed — the worst possible debugging surface. Observed symptoms: two sets of personas heartbeating the same claims, a board row reading
Claimedwithowner=- claim=- lease=-, and duplicate Qwen2.5-VL lanes on 58091/58092 spawned ten seconds apart.The fix
After the pidfile core is killed, always enumerate
running_core_pids()(name-based, already platform-correct) and reap anything left. The pidfile pid is excluded from that set because SIGTERM is asynchronous and would otherwise report a split brain on every ordinary stop — a false alarm on a message whose entire value is that it only fires when something is genuinely wrong.Live positive control
On a real split brain that reproduced on its own during this session (a core respawned between two stops):
Both arms proven: the previously-dead pidfile-present path fired, and the false-positive guard held (29747, freshly SIGTERMed, was correctly not counted as a survivor). Verified afterwards that zero cores remained.
Remaining half (tracked separately, not in this PR)
startstill binds blindly. Every dispatched command auto-starts a core when nothing answers the socket (dispatch→ensure_core_running), so a core alive on an orphaned inode looks like "no core" and a fresh one is spawned — the loop that manufactured this state:stopkills B, leaves A → 5. next command sees nothing answering, auto-starts C → two cores again.This PR breaks the loop at step 4. Step 2 needs
startto reclaim-or-refuse — the same shape #90 already uses for orphaned llama-server lanes, and the same missing constraint as airc #355.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo