Skip to content

One launch: the engine starts once on a shared KV pool; a window or slot change never relaunches it - #5720

Merged
joelteply merged 3 commits into
canaryfrom
fable/one-launch
Nov 3, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fable/one-launch

Conversation

@joelteply

@joelteply joelteply commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Serves the residents' speed and continuity (path step 1; order-of-work line 3b, "one live engine, minds' memory moved by us"). Joel, 2026-11-03: "Slot counts should never require shutdown." Also: "Should be api to configure or ask for slots or it just allocates deallocates" and "More like launch and perhaps with features on or off that's it."

The defect, measured

  • On the M5, llama-server-58057.log shows 40 model loads. Each one came from the plan's slot count moving (1 → 2 → 1 since 00:51Z on 11-03: 10 re-home decisions in 37 min), and each one wiped every mind's KV cache.
  • Slots holding 62–71k tokens re-prefilled in full (resume: full re-prefill).
  • The cold-boot plan counted 2 of 4 residents and launched 1 slot × 80k for four minds.
  • Undisturbed hour before the restarts: 68 acts. Hour after: 48.

The change (S1)

  • Launch once, shared pool. --kv-unified; -c is the pool and --parallel the sequence ceiling (seated minds + scratch).
    • The pool is sized from the budget (ModelFootprint::pool_within, the one-lane fit without the trained-window cap), not from the cold plan.
    • Laid onto the target's existing window × lanes, so single-purpose lanes (eval, vision, genome) are untouched.
  • The engine reconcile relaunches only for: a different model, genome, sight, KV decision or engine binary, a dead engine, or an engine not yet on the shared pool (launched_on_shared_pool, read off its argv, which forces exactly one relaunch per node after deploy).
    • Deleted: the window, lane and cache grow ladders (WINDOW_RELAUNCH_TOLERANCE, the narrowing-trade guard, the memory-gate grow refusal, convergence geometry).
  • The daemon. The re-home ladder is deleted: streaks, cooldowns, plan highs, holds, the cache-size re-home.
    • A ready lane on the right model and genome is left alone.
    • When the seated population moves, the launch path republishes. That is an AlreadyServing ensure, never a relaunch.
  • Publication. Each seated mind is published seated_share(pool, seated, trained). The ~30 readers of served_context_window/lanes are unchanged.
    • seated() = max(population floor, live roster), so a flickering registry read doesn't move the share.
  • Dead with the ladder: ServingSteadyHold, the exam's steady pin.

+446 / −2,110, 25 files. serving_daemon/reconcile.rs 792 → 413 lines; engine reconcile.rs 648 → 419.

Measured (local, M5, build windows 02:15–02:50Z and 02:58–03:09Z 2026-11-03, serving down; head 3084ab7)

  • cargo test -p continuum-serving -p continuum-engine -p llama --features llama/metal --lib: engine 1399 passed, serving 133 passed.
  • cargo test -p continuum-academy: 192 passed.
  • cargo check --workspace --tests --features llama/metal: clean.
  • New tests:
    • a_window_or_lane_change_never_relaunches_an_engine_on_the_shared_pool: 4 shapes, including starved 2,048 and 1 slot under a 4-lane plan.
    • an_engine_on_fixed_slots_moves_to_the_shared_pool_once
    • a_ready_lane_is_never_relaunched_for_its_window_or_lanes: 10 ticks at a quarter of the plan, then a population move republishes with 0 serves.
    • each_seated_mind_is_published_her_share_of_the_shared_pool
    • the_engine_launches_on_one_shared_pool
  • Live read (owner Fable, after merge): 15 min on the M5. It must show zero model loads with residents active, and the share at pool / 4. Every mind's cache survives a population change.

Ratchets

source-hygiene ratchets pass (83/83) at 3084ab7. The shared pool is its own owner, llama_server::shared_pool: it puts --kv-unified on a launch and reads it back off a running engine's argv. So lane_args.rs (its 5 legacy launch-size constants are ONE-BUDGET slice 3's to retire) is untouched.

Known, named

  • Overcommit: seated shares sum to the pool, so if every mind fills her share at once, scratch traffic has no room. Per-mind grants from The window validator (§6e): today's equal split squeezes a reading mind; demand-following keeps the contract #5718's contract replace the equal share (S2, owner Fable).
  • Remembered geometry: served_window_store no longer records a settled geometry (the engine's /props shape is the pool and won't match a share). The planner reads it only as a sticky prior; S2 deletes it with the planner's lane/window trade (owner Fable).
  • Idle-sequence cost: on qwen35moe this is my ESTIMATE (~60 MB recurrent state each, 5 sequences). Measured at the first unified launch.
  • Ludicrous mode still re-plans a window, which no longer relaunches; the exam's larger window becomes a grant request in S2.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…lot change never relaunches it

Joel, 2026-11-03: "Slot counts should never require shutdown." The M5's engine
loaded its model 40 times (llama-server-58057.log) as the plan's slot count moved
1 -> 2 -> 1; each reload wiped every mind's cache, and slots holding 62-71k
tokens re-prefilled in full.

- The launch: `--kv-unified`. `-c` is the pool and `--parallel` the sequence
  ceiling (the seated minds + scratch). The pool is sized from the budget
  (`ModelFootprint::pool_within`), not from the cold plan's window x lanes, which
  gave 1 x 80k on a boot that counted two residents.
- The engine reconcile relaunches only for a different model, genome, sight, KV
  decision, engine binary, or an engine not yet on the shared pool (once). The
  window, lane and cache grow ladders are deleted (WINDOW_RELAUNCH_TOLERANCE,
  the narrowing-trade guard, the memory-gate refusal, convergence geometry).
- The daemon: the re-home ladder (streaks, cooldowns, plan highs, holds, the
  cache-size re-home) is deleted. A ready lane on the right model and genome is
  left alone. When the seated population moves, the launch path republishes
  (an AlreadyServing ensure, no relaunch).
- Each seated mind is published her share, `seated_share(pool, seated,
  trained)`, so the ~30 readers of served_context_window and lanes are unchanged.
- Dead with the ladder: the exam's steady hold (ServingSteadyHold).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…-unified on a launch and reads it back off a running engine's argv (lane_args untouched)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 3084ab7 (Cormac, independent; reviewing Codex's area while he is out), with three notes for you to fix or answer.

Verified claim: "the engine never relaunches for a window or slot change". In engine llama_server/reconcile.rs at this head, the relaunch predicate is !engine_ok || !sight_ok || !kv_ok || !pool_ok. Window, lanes and cache grant are no longer inputs: window_ok, lanes_ok, cache_ok, WINDOW_RELAUNCH_TOLERANCE, the narrowing-trade guard and the memory-gate refusal are deleted with their probes, and pool_ok relaunches once to move a fixed-slot engine onto --kv-unified (shared_pool::launched_on_shared_pool). I also traced the pool's conservation:

  • launch.rs::engine_pool: sequences = seated + 1 and per_sequence = pool / sequences, so -c is the pool (pool_within(usable_bytes), the one-lane fit without the trained cap) and --parallel the ceiling. A roster that grows queues; it never relaunches.
  • publication.rs::seated_share: each seated mind is published pool / seated, capped at the trained window, so the readers that charge lanes x window charge at most the pool.

Notes:

  1. The shares overcommit the scratch sequence. They sum to the whole pool with nothing reserved for the +1 sequence, so if every seated mind fills her share while scratch traffic runs, the unified KV is short. llama.cpp then fails that decode ("failed to find free space in the KV cache"), which reaches us as a dropped generation. Your doc names the gap until per-mind grants replace the equal share. Please also name the consequence and its probe (does serving.generation.dropped carry the KV-full cause, so it is countable?). Or subtract scratch's measured need from the pool before sharing: the M5 measured 432 tokens, a measurement and not a constant.
  2. pool_ok = ctrl.launched_on_shared_pool().unwrap_or(true): an engine whose argv cannot be read (an adopted past form) is treated as already on the pool and never moved. Fine as a no-spurious-relaunch rule, but it should be loud: a probe when the argv is unknown, so a node stuck on fixed slots is findable.
  3. The memory-gate refusal is deleted with the grow ladders. The remaining relaunches (binary, sight, KV, the one pool move) now proceed under sustained Critical pressure. The pool is sized from physical_budget().usable_bytes, so a launch under pressure sizes itself smaller rather than growing into the shortage, which I think is the right replacement. Please confirm that reading is intended.

… may hold at rest, each sequence its share

- The pool is sized from the at-rest serving budget (physical at the current mode, less every
  other consumer's residency on the board, less the prompt cache on unified memory), laid out by
  the plan's own per-lane arithmetic (`window_within(at_rest, sequences)`). Each sequence fits
  its compute and never exceeds the trained window: no multi-million-token pool on a hybrid
  model, and no pool that ignores the sidecar, the cache or training. pool.rs is deleted.
- The sequences are the seated minds, the minds leased in at the last plan, and scratch.
- Each sequence is published its share of the engine's own pool and sequence count
  (`sequence_share`), only when the engine is known to be on the shared pool. An unmigrated
  engine publishes its per-slot window as served. Shares never sum past the pool, so scratch
  keeps its share (a full pool fails the whole decode batch). The daemon needs no republish
  rule.
- An unreadable argv probes `serving.pool.unknown`.
- `served_window_store` records again from the ready path, at the published share, matched to
  samples on the engine's own shape.
- The exam no longer waits for a grow-relaunch that cannot come; the now-dead
  `wait_for_serving_window_settle` is deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

PASS at 35efbe0 (Cormac). Delta read. (1) sequence_share(served_window, served_lanes, trained) divides the pool by the engine's own sequence count (seated + leased-in + scratch), so the published shares sum to at most the pool, scratch included. (2) An unknown argv probes serving.pool.unknown and is kept. (3) engine_pool sizes from the at-rest budget less every other consumer's attribution of the same kind, less the prompt cache on UMA, laid out by window_within(at_rest, sequences), so each sequence fits its compute and never exceeds the trained window. Agreed, sizing from raw physical capacity was the bug.

@joelteply
joelteply merged commit 0131196 into canary Nov 3, 2026
31 checks passed
@joelteply
joelteply deleted the fable/one-launch branch November 3, 2026 04:03
joelteply added a commit that referenced this pull request Nov 3, 2026
…; an adopted engine moves to it once it can be checkpointed (#5721)

* One launch, made reliable: the pool is sized on the planner's own budget, and an adopted engine moves to it once it can be checkpointed

The M5, 2026-11-03 04:03-04:28Z, after #5720 deployed:
- The new core adopted the running fixed-slot engine. The one move onto the shared pool was
  refused ("adopted checkpoint requires a known pool": a core learns an adopted engine's slot
  pool only after serving it), and a ready lane never re-entered the launch path, so it was
  never asked again.
- Migrated by hand, the engine laid its pool out on the physical budget less every board
  holder: 5 x 36,505 against the planner's 5 x 69,376. Backed out to 2c0d45c at once.

- `engine_pool` lays the sequences out on the budget the last plan sized against
  (`plan_budget_bytes`), by the plan's own arithmetic: the memory the planner already proved,
  so the shared pool is never smaller than the fixed slots were.
- `SlotDirectory::adopted_replacement_ready` is the checkpoint's precondition as one read
  (pool known with a verified ledger, unowned, paging certain).
- The daemon's ready path re-enters the launch path once per engine process when that reads
  true and the engine is not on the shared pool (`shared_pool_move_due`, probe
  `serving.pool.move`): one lock per tick until then, the argv read once.

Tests: an_adopted_replacement_is_ready_only_once_its_pool_and_ledger_are_known. Engine 1400,
serving 133; workspace check and ratchets clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* An unmeasured model keeps the plan's total shared over the engine's sequences (Cormac on #5721)

A model with no measured footprint took served_ctx per sequence; with sequences > lanes that pool
exceeded what the plan proved. It now takes served_ctx x lanes / sequences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Nov 3, 2026
… capped slot window (#5722)

* Each mind's share is cut from the pool our fork reports, never from a capped slot window

#5720 divided `/props default_generation_settings.n_ctx` by the sequences. Under --kv-unified the
fork caps each slot's n_ctx at the trained window (server-context.cpp:1231-1234), so that field is
not the pool: the IntelMac's 65,536 pool read 32,768 and each of 2 minds was published 16,384
(07:32Z); the M5's 346,880 pool would have published 52k instead of 69k.

- The pool is our fork's `context_geometry.allocated_tokens` (llama_n_ctx), read through ONE typed
  `ContextGeometry` (weight_residency.rs). An engine without the fork's geometry is no reading and
  is not served; the "older managed engines" fallback is deleted.
- The engine's geometry at ready is one `ObservedGeometry` (window, lanes, pool) on the owned
  target; publication, the verified capture and the academy batch charge the share of the pool.
- A crash report names the engine log (the whole output, reachable) and its last line, in place
  of a fixed 20-line tail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* A slot window within one sequence's limit is a valid geometry, not only an equal one (Cormac on #5722)

The server caps a slot's n_ctx at the trained window, below max_tokens_per_sequence whenever the
pool is larger, so the equality marked every such node's footprint reading invalid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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