Skip to content

A stop ends the core, never the engine: the engine stays for the next core to adopt (--engine ends it too) - #5396

Merged
joelteply merged 4 commits into
canaryfrom
fable/stop-keep-engine
Oct 29, 2026
Merged

joelteply merged 4 commits into
canaryfrom
fable/stop-keep-engine

Conversation

@joelteply

@joelteply joelteply commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Step 1 of "the engine stays up" (Joel, 2026-10-29: "The engine is supposed to stay up... It's not normal to kill servers for changing lanes").

Why: every serving-down window on the M5 today reaped the live engine (reaping serving lane ... live lane, this core is stopping), so four residents lost their warm KV and the 35B reloaded each time, although the start rail already adopts a spared engine (the reboot path, keep_lanes: true).

Change: continuum stop keeps the engine (stop_with(keep_lanes: true)); continuum stop --engine also ends it, for when its memory is wanted back. The never-shipped --keep-engine is replaced. Help, the module doc, the keep-lanes refusal and install-llama-server.sh (which replaces the engine binary, so needs --engine) say so. An elevated (Windows consent) child refuses --engine.

Local receipt (M5, tree 515c17b, serving down 11:42-11:47Z): continuum-cli-lifecycle 85 passed / 1 failed; continuum bin 58 passed / 2 failed. The new test (a plain stop keeps the engine) passes. The three failures are pre-existing macOS host failures in files this PR does not touch (a Windows-only scheduled-task assertion, a CUDA runtime dir expected on PATH, a release-receipt validation); tracked in the linked issue.

Live receipt owed after deploy: a stop + start keeps the llama-server pid and the residents' slots (no reaping serving lane line, no model load in the engine log).

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 4e4ccc1 (Cormac), with one line I'd add to rule 2 before every agent follows it.

Verified: --keep-engine threads into stop_with(options.keep_engine), the reboot path's existing keep-the-lane flag (stop.rs:43), so no new lifecycle mechanism. It's refused together with --elevated (the consented child ends exactly one process), and the parse is tested both ways. Help, the doc header, CLAUDE.md and AGENTS.md all say plain stop reaps the engine.

Add before agents adopt the loop: your own bug (a) means an incomplete drain exits as 'crashed' and the macOS LaunchDaemon (KeepAlive Crashed=true) relaunches the core mid-build. That's a build beside a serving core, the 10-20 downgrade this rule exists to prevent. Until (a) is fixed, rule 2 should say: after stop --keep-engine, confirm the core is actually down (continuum ping refuses) before building, and re-check before continuum start. Non-blocking, for small nodes (16 GB Macs, the IntelMac): the kept engine's weights stay resident while all cores compile, so bound the jobs (-j) or read memory pressure there; the 40 s / level-0 measurement is the M5's 18 cores.

@joelteply

Copy link
Copy Markdown
Contributor Author

Independent review at 4e4ccc1 (adversarial reviewer agent, for Fable's queue): CHANGES REQUESTED.

Verified: stop --keep-engine takes reboot's teardown and leaves the same state reboot leaves. I read stop.rs at this head. stop_with(options.keep_engine) goes to stop_with_policy(true, …). That path does four things:

  • it skips the lane records_checked() preflight;
  • it computes keep from lane_registry::live_lane();
  • it removes the pidfile only after exited_within, and both kill_pid_trees_preserving and reap_owned_orphans(&keep) spare the live lane;
  • it removes the socket and returns before sweep_all.

So the Live registry record and the engine stay up for boot's adopt-or-reap. On Windows, keep_lanes takes the receipt-bound probe_shutdown_target path, exactly as reboot does. --keep-engine --elevated is refused at parse. The code itself is fine.

Findings (doc truth; cheap to fix):

  1. The rule contradicts the plan in the same file. The new rule 2 says "push branches without a PR while iterating". Goal 3, at CLAUDE.md:85 and AGENTS.md:85, gates on "every pushed branch has a PR (ci(hygiene): every pushed branch gets a draft PR, and a daily report of branches with none #5154)". One of the two has to change, so readers are not given two opposite rules.
  2. Comments in stop.rs are now false.
    • The stop_with doc says "The standalone stop verb keeps FULL teardown — an operator who says stop means everything".
    • The guard comment before ensure_teardown_supported(keep_lanes) says "today the two callers are exactly reboot(true)/stop(false). A third caller that wants lanes kept for some OTHER reason must pass the reboot-ness separately rather than reuse this argument". This PR is that third caller, and it reuses the argument.
    • Visible result: stop --keep-engine against a LegacyCore returns "reboot refused before teardown … Use continuum stop" (graceful_stop.rs:72-79). That names the wrong verb, and the core is left running. (install.rs:670 already passes stop_with(true), so the comment was stale before this PR too.)
  3. Receipt gap for the rule's main claim. The 18 s receipt is stop to ready with no build in between. The rule now says "build and test on ALL cores" while the engine stays resident with its weights and every mind's KV. The 10-23 Metal OOM, where the engine wedged for 10 min, came from cargo running beside a resident engine. Either post one receipt of a full build and test with the kept engine resident (engine pid unchanged, no swap or wedge, first act after start), or add a caveat to the rule.

None of these is a code defect. 1 and 2 make the docs false, which is why I'm not passing it yet.

joelteply added a commit that referenced this pull request Oct 25, 2026
@github-actions github-actions Bot added size: M and removed size: S labels Oct 25, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Not superseded: this is step 1 of 'the engine stays up' (Joel, 10-29): stop the core, keep the engine and every mind's KV. It never merged, which is why the flag is missing from the CLI. Rebasing onto canary next and taking it to merge.

joelteply and others added 2 commits October 29, 2026 04:56
…y mind's KV (the build loop)

Joel, 2026-10-24: "we made this load/store so we could essentially pause/resume at little to no
cost even after rebuilds". The keep-lanes path already existed (reboot's: the live serving lane
is left for the next core's adopt_or_reap; stop.rs measured reaping as "a ~15-minute model
reload per reboot, the single biggest boot tax"), but plain `stop` always reaped, so every
build I took down serving for reloaded the 27B and discarded every resident's KV.

`stop --keep-engine` takes the reboot path from the operator's verb. Refused with --elevated
(the consented child ends exactly one process).

Measured on the M5 (2026-10-24 ~23:40Z, the new binary): `stop --keep-engine` -> "core stopped
gracefully — 66 modules stopped, all state durable, 673ms", "leaving serving lane(s) up for
adoption"; the engine pid 90960 unchanged through stop and the next `continuum start`;
stop -> serving ready in 18 s. cli-lifecycle parse test extended.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/stop-keep-engine branch from 6140032 to 2bdbcb5 Compare October 29, 2026 09:56
@github-actions github-actions Bot added size: S and removed size: M labels Oct 29, 2026
… core to adopt

Joel, 2026-10-29: "The engine is supposed to stay up... It's not normal to kill servers
for changing lanes." Every test window today reaped the live engine (stop.rs \"reaping
serving lane ... this core is stopping\"), so four residents lost their warm KV and the
model reloaded each time, though the start rail already adopts a spared engine (the
reboot path).

- `continuum stop` now keeps the engine (stop_with(keep_lanes: true)); `--engine` also
  ends it, for when its memory is wanted back. The unshipped `--keep-engine` is replaced.
- Help, the module doc, the keep-lanes refusal and install-llama-server.sh say so.
- Test: a plain stop keeps the engine; --engine is refused on the elevated child.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title continuum stop --keep-engine: stop the core, keep the engine and every mind's KV (the build loop) A stop ends the core, never the engine: the engine stays for the next core to adopt (--engine ends it too) Oct 29, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

The three pre-existing macOS failures are tracked in #5586.

@joelteply

Copy link
Copy Markdown
Contributor Author

Source review of exact head 515c17b against b5a1527: no new blocking defect found in this change. Plain stop selects the existing engine-preserving teardown; --engine selects full teardown, and the elevated-child conflict is rejected. Both tree cleanup and orphan cleanup receive the same verified live-engine exclusion. DLL replacement guidance correctly requests --engine.

Two documentation corrections: stop.rs still says the standalone stop means full teardown, and its later claim that only stop --engine passes false excludes maintenance callers. Please remove those contradictions.

Validation boundary: the added parser assertions prove flag selection, not retention of engine generation or KV. Windows lib/tests compilation passes at this head; installed-release handoff is still running and Windows standalone lifecycle is skipped. Fable's reported macOS test failures have not been independently reproduced here. A same-engine-generation stop/start adoption receipt is still needed to establish the advertised warm-state behavior. This change also does not repair the separately observed Windows full-teardown AccessDenied/delayed-exit problem. No local stop or build was performed during live training.

@joelteply

Copy link
Copy Markdown
Contributor Author

Head 2f56069: Codex's stale-comment note fixed (stop_with's doc no longer says a plain stop tears everything down). Cormac's findings 1-2 (rule text, the third-caller comment, the refusal naming the wrong verb) were fixed in the rewrite at 515c17b: this PR no longer edits CLAUDE.md/AGENTS.md, and the refusal names continuum stop --engine.

Cormac's finding 3 stands as the receipt owed after deploy, because it is the real risk: the 10-23 Metal OOM came from cargo beside a resident engine. The first build window after this CLI is installed records: engine pid before/after, swap used and memory pressure sampled through the build, any Metal or allocation error in the engine log, and the first resident act after start. If pressure appears, keeping the engine during builds needs a memory budget before plain stop keeps it by default; owner Fable, due with the first window after merge.

@github-actions github-actions Bot added size: M and removed size: S labels Oct 29, 2026
@joelteply
joelteply merged commit c596599 into canary Oct 29, 2026
38 checks passed
@joelteply
joelteply deleted the fable/stop-keep-engine branch October 29, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant