Repository navigation
fix(stop+adopt): the reboot path keeps its promise — a stop spares the live lane on Unix, the lane is its own process group, and an adoptee that is busy is not reaped (card 59052747) - #4284
Merged
Conversation
…e live lane on Unix, the lane is its own process group, and an adoptee that is busy is not reaped (card 59052747) Every deploy was a cold prefill for every seated mind. Two seams, one card: 1. THE SIGNAL. `kill_pid_trees_preserving` on Unix read `let _ = keep;` and sent every root `kill_pid_tree` = `kill(-core_pid, SIGTERM)` — the core's PROCESS GROUP. The lane was spawned with no process group of its own (measured on the IntelMac and the M5: engine pgid == core pid), so it took the SIGTERM at the old core's stop, eleven lines before "leaving serving lane(s) up for adoption" printed over it (M5 pid 61259 RemovedDead 19 s after the stop; the IntelMac's adoptee answered /v1/models while exiting and failed the decode probe). Windows honored `keep` through its kill plan; Unix never did. Now ONE `kill_plan` (the Windows plan, made platform-neutral as `KillStep`) executes on both platforms — `Process(core)` when a lane is protected, `Tree` otherwise — and the lane is spawned in its own process group, so neither the core's group kill nor launchd's job-exit reap can reach it: its fate is decided by name (registry, ownership sweep, adopt-or-reap), never by the group it was born into. Pinned with real processes: a leader and its child in one group — the protected child survives the leader's kill; with nothing protected the group goes (plain `stop`). 2. BUSY IS NOT DEAD, at adoption too. The heartbeat already judged a missed smoke probe against the server's own `/slots` account (L11, `judge_smoke_miss`); the adopt rail did not — ONE missed probe reaped the warm engine. The `/slots` fingerprint is now taken before and after the probe: a lane that advanced during the probe's window is adopted (`serving.adopt_busy_alive`) and the heartbeat verifies from there; a frozen or unreadable fingerprint is the wedge signature and is reaped as before (`serving.adopt_rejected` now says `slots_moved=false`). Pinned with the fake control: busy + missed probe → AlreadyServing, 0 respawns; the wedged orphan and the force-probed owned lane still respawn. Receipt: bin tests 59 passed (the one failure, `prebuilt_reboot_options_are_explicit_and_strict`, fails identically on canary without this change — environment, not this PR); lib `inference::llama_server::tests` 48 passed / 0 failed; REAL_EXIT 0 on both. Faster or slower: every reboot on macOS/Linux stops costing a model reload plus a cold prefill per seated mind (the IntelMac: 10–11 min per mind; the M5: 5.5–6 min per mind). The adopt probe costs two extra `/slots` reads per adoption. Nothing slower. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Contributor
Author
|
REVIEWED at c610469 by Fable. This is the fix that stops every deploy from costing every seated mind a cold prefill, and both halves are right.
Measured cost this fixes, from the M5 tonight: after the 20:58Z deploy the new core swept pid 61259 as dead and respawned, and the next four turns re-prefilled 27–30k tokens at 70–92 tok/s, 297–389 s each — about 20 of 37 minutes of that hour spent re-reading prompts the engine already had. One thing to confirm on your box, not a block: that an engine spawned by the OLD pre-fix core is still spared by APPROVE at c610469 — merging on green. |
joelteply
enabled auto-merge (squash)
September 20, 2026 22:03
This was referenced Sep 20, 2026
joelteply
added a commit
that referenced
this pull request
Sep 21, 2026
…d make NOW — last deploy's cache type is a stale lane, relaunched once and named (card 977842fd) (#4288) The composition of two correct changes: the KV cache type is applied at engine SPAWN (#4285), an engine now survives a core stop (#4284), and the adopt rail compared model + window + lanes + sight — never the KV decision. Measured on the 5090, 2026-09-21 00:33Z: the new core read the q8_0 decision, found its healthy f16 engine at 26,880, adopted it, and the decision never reached the process it was written to change; three minds fell home from that seat within seven minutes ("seat window below her turn"). - `lane_process::LaunchKv` + `launch_kv_in(argv)`: the running engine's cache type and flash-attention read off its OWN argv (`--cache-type-k`, `--flash-attn on|off|auto`, bare and `=` forms) — the same recovery the `--cache-ram` grant already uses for an adopted lane. No flag = the engine's f16 default, a value. - `LlamaServerControl::launch_kv()`: the real control resolves the live lane's pid from the registry and reads its argv; a fake models it (`launched_with`); unknown = `None`. - `ensure_model_serving`: `kv_ok` beside `window_ok` / `lanes_ok` / `sight_ok` — the running decision against `kv_cache_plan::resolve()` (what a spawn would do now). A mismatch is `serving.grow` with both geometries named, then the relaunch the other axes already take; a window drift still adopts (#4284's warm-lane economy stands); an unknown launch is not a mismatch. Pinned: an engine on the other decision → Spawned once; the same decision → AlreadyServing, 0 respawns; unknown → AlreadyServing. `launch_kv_in` on every flag shape. Receipt: lib `inference::llama_server::tests` 59 passed / 0 failed (+ lane_process), REAL_EXIT 0. On the 5090 after this lands: `serving.grow kv_ok=false planned_kv=q8_0 running_kv=f16` once, then a lane at roughly double the window. Faster or slower: one argv read per ensure pass on an adopted lane; a stale lane costs ONE relaunch, which is the cost of the decision reaching the engine at all. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE 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.
Every deploy was a cold prefill for every seated mind. Two seams, one card:
THE SIGNAL.
kill_pid_trees_preservingon Unix readlet _ = keep;and sent everyroot
kill_pid_tree=kill(-core_pid, SIGTERM)— the core's PROCESS GROUP. Thelane was spawned with no process group of its own (measured on the IntelMac and the
M5: engine pgid == core pid), so it took the SIGTERM at the old core's stop, eleven
lines before "leaving serving lane(s) up for adoption" printed over it (M5 pid 61259
RemovedDead 19 s after the stop; the IntelMac's adoptee answered /v1/models while
exiting and failed the decode probe). Windows honored
keepthrough its kill plan;Unix never did. Now ONE
kill_plan(the Windows plan, made platform-neutral asKillStep) executes on both platforms —Process(core)when a lane is protected,Treeotherwise — and the lane is spawned in its own process group, so neither thecore's group kill nor launchd's job-exit reap can reach it: its fate is decided by
name (registry, ownership sweep, adopt-or-reap), never by the group it was born into.
Pinned with real processes: a leader and its child in one group — the protected child
survives the leader's kill; with nothing protected the group goes (plain
stop).BUSY IS NOT DEAD, at adoption too. The heartbeat already judged a missed smoke probe
against the server's own
/slotsaccount (L11,judge_smoke_miss); the adopt raildid not — ONE missed probe reaped the warm engine. The
/slotsfingerprint is nowtaken before and after the probe: a lane that advanced during the probe's window is
adopted (
serving.adopt_busy_alive) and the heartbeat verifies from there; a frozenor unreadable fingerprint is the wedge signature and is reaped as before
(
serving.adopt_rejectednow saysslots_moved=false). Pinned with the fakecontrol: busy + missed probe → AlreadyServing, 0 respawns; the wedged orphan and the
force-probed owned lane still respawn.
Receipt: bin tests 59 passed (the one failure,
prebuilt_reboot_options_are_explicit_and_strict,fails identically on canary without this change — environment, not this PR); lib
inference::llama_server::tests48 passed / 0 failed; REAL_EXIT 0 on both.Faster or slower: every reboot on macOS/Linux stops costing a model reload plus a cold
prefill per seated mind (the IntelMac: 10–11 min per mind; the M5: 5.5–6 min per mind).
The adopt probe costs two extra
/slotsreads per adoption. Nothing slower.Receipt to watch
On the next reboot of a Unix node:
ps -o pgidof llama-server ≠ the core pid; the stop log prints "leaving serving lane(s) up for adoption" and the lane registry does NOT sweep it as RemovedDead; the next core adopts (AlreadyServing, orserving.adopt_busy_aliveif it was mid-turn) and the first turns readcached_tokens> 2.🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE