Repository navigation
Conversation
… by moving it: launch with --minds, name the mind on each turn, stream her in while she waits (fork #139) Serves the residents' acts directly (plan path step 1, "Fast"; order line 3b): on the M5 today a mind switch serialized her whole state into the engine's prompt cache (up to 2.35 GB a switch) and dropped her when she did not fit (10 times, 8.7 GB), so the arriving mind re-prefilled at swap speed. Fork #139 makes a switch a sequence move (0.16 ms parked, ~10 ms through flash, 0.16 ms when streamed in ahead); this is the core's half that turns it on. - Launch: an engine whose --help lists --minds (probed beside --train-dir; an older engine never sees the flag) starts with --minds <plan lanes> beside --kv-unified: one parked sequence id per lane (shared_pool owns it). - Request: a keyed turn carries "page" = PageKey::engine_id() beside id_slot: a mind is her persona id, a fork is derived from (persona, room) in its own namespace (v5), so it can never equal a mind's. - Stream-in: before a keyed turn waits for admission, POST /minds/prefetch for her (inference::minds, fire and forget, probed; 404 = an engine without minds), so her state is in the pool when her lane frees. Not in this PR (Codex, agreed split): reading /props.context_geometry.resident_minds before dispatch to skip the core's own save/erase/restore around switches and learning, and learning with side_sequence + learn_pin. Tests: the shared-pool launch test asserts --minds equals the plan's lanes. Compiled by CI (no build beside the M5's serving lanes). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Review at 4449ecb: request changes before integration. minds::prefetch spawns a detached task for every keyed request before admission, rather than only a queued turn. It has no admission lifetime, cancellation, deduplication, or engine-incarnation binding. A cancelled turn can still page state in and evict another mind; delayed work can hit a replacement engine at the same URL. Put this through the existing endpoint/admission completion owner with bounded outstanding work and a typed matching-incarnation result. The feature probe/404-ignore route is a compatibility fallback. The coordinated pin must require resident_minds and refuse unsupported/mismatched engines before dispatch. Do not silently send page to an engine that ignores it. Decode the typed prefetch result instead of collecting arbitrary response text and substituting empty strings on errors. --minds currently derives from lane count, but the design specifies resident count: these differ when minds exceed concurrent lanes. Supply the existing roster-owned count, including capacity reserved for the learning side sequence, rather than treating concurrency as residency. These are integration requirements for the complete replacement; core save/restore has not been removed. |
…gine that declared them, bound to its pid and deduped; --minds is the seated minds plus one learner; the pool geometry counts parked ids
- The pool's geometry check required sequence_capacity == slots: an engine keeping resident minds reports lanes +
parked ids, so the pin would have made the core reject its pool. ContextGeometry reads resident_minds
{lanes, parked_ids} (declared on /props) and the check is slots + parked ids.
- Discovery records resident_minds per engine from the same /props body (resident_minds_by_root); the prefetch is
sent only to an engine that declared it (never a 404 guess), carries the slot pool's engine pid (the engine refuses
a stream meant for a replaced process, fork #139), and is deduplicated per (engine, mind) until its reply returns.
- ServingTarget.minds = the seated minds + 1 side sequence for learning at the resident launch (launch.rs); 0 on
every single-purpose lane (eval, vision sidecar, fixtures). --minds takes it, only for an engine that lists it.
Compiled by CI (no build beside the M5's serving lanes).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Follow-up at 4809c0a: resident_minds_by_root is written before the page_discovery_generation check in discover_pool. A delayed response from a retired engine can therefore publish its ownership flag and then return Superseded. The new map is also keyed only by URL, not incarnation. Do not use it to authorize skipping core paging. Publish this descriptor atomically with the existing settled pool under its generation owner, and invalidate it through that owner's replacement path. Add a delayed-old-props/replacement replay proving the obsolete response cannot change the new pool's paging authority. PID-only prefetch binding still permits PID reuse; use the existing full incarnation (pid, started_s). The detached task and independent static in-flight registry still have no turn-cancellation owner. Deduplication alone does not resolve the cancellation finding. |
…th the pool, the prefetch is the waiting turn's, and the engine's own token binds it - Discovery race: the resident-minds declaration now lives on the slot pool, set on the candidate before it is published and checked against an installed pool (MindsMismatch), after the superseded-generation check. The root-keyed map is gone. - Identity: the engine draws an incarnation token (fork #139, resident_minds.incarnation); the prefetch carries it and a replaced engine refuses it. No OS pid. - Ownership: the prefetch is a future the turn awaits inside its own lane wait (biased select: admission first, so a turn admitted at once never streams); admitted or cancelled, it is dropped with the wait. No detached task. - --minds: the resident controller holds it (LlamaServerControl::seat_minds, default no-op; set by the serving daemon to the seated minds + 1 learner); ephemeral lanes never set it, so ServingTarget is unchanged. - ContextGeometry decodes /props.context_geometry once into a typed struct; page_key builds the fork id without slicing; prepare drops a redundant cfg!(windows) (the install receipt exists only on Windows already). Compiled by CI (no build beside the M5's serving lanes). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ble set whose result is dropped; swallowed_errors ratchet) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…inds side runs against the engine that switches minds, so CI tests the pair, not two halves apart #139 is the shipping line (f39cf25fb) plus resident minds: a mind switch is a sequence move in milliseconds through the pool and flash, prefetch from flash while others decode, typed receipts, incarnation, learn pins. Re-pinned to the shipping line's merge commit once #139 lands. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Exact-head paired review: d5c4e5d is not approved for merge. Findings and required failure replays are posted on the pinned fork: CambrianTech/llama.cpp#139 (comment) . In particular, core discovery compares |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Architecture acceptance correction following Joel's explicit instruction: fixing the four correctness findings does NOT make #139 the intended context-switch implementation. I missed this distinction in my earlier review.
The required contract is: bind the decode lane to the mind's already-resident native storage through stable descriptors; no state-sized cell/layer traversal, serialization, repacking or recomputation on that switch. Offload/restore retains the compute layout and transfers only required bytes through existing residency/completion owners. Shared prefixes, recurrent state, draft state, buffer lifetimes and GPU completion fences must be accounted for explicitly. Contiguity alone is not proof that attention kernels can bind that layout without a conversion. Review must check the actual switch call graph and measure switch work versus context size, with bytes moved and cells visited reported. Fault replay remains native, as requested; do not add Python tooling for this recovery work. Fable owns the revised engine layout/design; Codex independently reviews before implementation or acceptance. Preserve current resident state and active builds while coordinating the deployment phase. |
…l no longer mismatches forever (M5 outage 2026-11-17 04:20Z) An owned spawn publishes its pool at readiness (engine_generation.rs EndpointTransition::ready) from its launch contract, which carries no minds declaration, so the pool held resident_minds = None; discovery compared that None to the engine's declared minds and returned MindsMismatch on every request for the engine's life (every resident's deliberation refused, ~10 /props re-probes a second; the M5 after a --prebuilt restore spawned the engine itself). 03:03Z worked because that engine's pool was installed by discovery, which records minds from /props. The pool's resident minds are now a set-once record of the engine's own declaration (OnceLock, the same shape as its incarnation): discovery records it when it installs a pool; a pool an owned spawn published has no record until its first discovery records the engine's declaration; only a recorded, DIFFERENT declaration is MindsMismatch. With the record set, discovery reaches page admission and the steady-state fast path instead of re-probing. Not compiled locally (the M5 is a serving node); CI is the check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…dmission regression (Codex's 14fd635 review) - discover_page_admission (the lifecycle-checkpoint path, which can precede the first adapter discovery) now records the engine's declared minds from the same /props body before it grants page admission. Granted admission is discover_pool's fast path, so an owned pool admitted there undeclared would have been read as core-paged minds (stream.rs takes pool.resident_minds() only from a pool discover_pool returned). Both admission grants now follow the declaration; those two are the only writers of page admission (engine_generation.rs; readiness clears it). - with_resident_minds builds the record with OnceLock::from (no discarded set result: source-hygiene swallowed_errors). - slots/tests/discover.rs an_owned_spawn_learns_its_engines_minds_at_discovery: a fake engine declaring resident minds on /props, an owned ready generation, then discover_pool must accept the owned pool, record the declaration, grant admission, and the fast path must return the same declared pool (before the fix: MindsMismatch on every discovery). Not compiled locally (the M5 is a serving node); CI is the check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…e's minds (Codex on 5b2f48a) a_lifecycle_admission_first_still_declares_the_engines_minds: owned spawn, then discover_page_admission (the checkpoint path) FIRST, then the adapter's discover_pool fast path; the admitted owned pool must carry the engine's declared minds. This is the case the adapter-first test could not catch (it would pass with the lifecycle declaration omitted). Both tests share one fixture (owned_spawn_declaring_minds: fake engine /props declaring minds + an owned ready generation). Not compiled locally (serving node); CI is the check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…string_identities_in_tests 184 -> 187) The fake engine's /props in the owned-spawn discovery tests is a typed Serialize struct mirroring the fork's context_geometry.resident_minds shape, instead of a json! map read by field name. Not compiled locally (serving node); CI is the check. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
Integration finding on 3384931: the --minds launch argument encodes the plan lane count at startup. This contradicts §4.14 and blocks using this PR for production. Resident admission and release must go through the running engine API. Changing demand must preserve the engine incarnation and existing persona state. |
This serves the residents' acts directly (plan path step 1, "Fast"; order line 3b).
Why
On the M5 today, a mind switch serialized her whole state into the engine's prompt cache, up to 2.35 GB per switch. When she didn't fit, she was dropped: 10 times, 8.7 GB. The arriving mind then re-prefilled at swap speed. Fork #139 makes a switch a sequence move. Measured on the 0.8B:
This PR is the core's half that turns it on.
What
--helplists--minds(probed alongside--train-dir) starts with--minds <plan lanes>beside--kv-unified. That gives one parked sequence id per lane. An older engine never sees the flag."page"=PageKey::engine_id()next toid_slot. A mind's id is her persona id; a fork's is derived from (persona, room) in its own v5 namespace, so it can never equal a mind's.POST /minds/prefetchfor her (inference::minds). It's fire-and-forget, and an engine without minds answers 404. Her state is then in the pool when her lane frees.Not here
Per the split agreed with Codex, Codex owns the core's remaining half:
/props.context_geometry.resident_mindsbefore dispatch, to skip the core's own save/erase/restore around switches and learning;side_sequenceandlearn_pin.Measured
The engine's receipts are on fork #139. This PR is compiled by CI only (no build beside the M5's serving lanes). The shared-pool launch test asserts
--mindsequals the plan's lanes.Measured after deploy
Owner: Fable, on the M5 once #139 is pinned. Switch time per act (
timings.mind.switch_msandfrom), prefill tokens per act, decode tok/s, and swap, against today's baseline.🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo