Repository navigation
A restart restores every mind warm: the page store keeps minds' pages for a volume others filled, and a cold boot names why - #5987
Merged
Conversation
… for a volume others filled, and a cold boot names why Serves resident minds' speed across a deploy (path step 1, order-of-work line 3b): a restart should cost a mind a ~1 s page restore, not a full re-prefill of her context. The save at stop, the format-keyed ledger and the restore before her first act already exist and are tested (page_io::checkpoint_every_endpoint, SavedLedger fingerprint, every_mind_resumes_where_she_left_off_across_a_stop_and_a_boot). What failed on the M5 2026-11-13: the KV page store gave 29 paged-out minds' confirmed pages to a High-tier volume request (volume 0.85, store 3% of its budget) between 22:40Z and 00:50Z, and the 23:45Z boot's ledger restored nothing (ledger_attached loaded=0, every first act cold_turn cause="no_page"), with no reason anywhere. - page_store_pool: confirmed minds' pages (rung 3) yield only to the store's own budget pressure (High+) or a Critical volume (ColdPages); dead pages still go under any pressure; a keep is a typed decline (minds_pages_kept), probed on change only. - broker: High relieves the first pool, in pressure order, that frees bytes, so a pool that keeps what it holds passes the request on (drops the unwrap_or(&[]) fallback). - saved_ledger: why a ledger restored nothing is a typed LedgerUnread; a missing ledger is probed instead of silently returning empty. - page_io: the stop names every endpoint it did not checkpoint (adopted engine, no paged engine) and probes before the drain, so a cut stop still says whom it saved. - dyno 11 (restart.rs + fixtures/dyno/2026-11-13-restart.json): four recorded residents (253,321 tokens) cold: last acting at ~401 s; warm: 0 re-prefilled, ~5.6 s of restores plus ~13.5 s in the stop; a paged-out mind keeps her page under the recorded pressure. Not compiled locally (the M5 is serving); CI is the compiler. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…atch; ratchets fixed Joel (2026-11-14): independent work runs concurrently, never serial minutes; RTOS rule 10 (#5986): no timeout or sleep decides flow in the save/restore path. - engine_generation::checkpoint_pool issues every resident's save at once and joins on their receipts (was one await per slot). page_io checkpoints every endpoint at once. - page_io::settle waits on the admission gate's drain event (new AdmissionGate::drained, a Notify fired when the last permit releases) instead of a 50 ms poll under a deadline; the stop's checkpoint no longer runs under tokio::time::timeout(cap) and no longer skips on a spent budget. A page action that never answers ends through kv_page_action's own error events. - Restores were already per mind: each mind's first act restores her own page inside her own admission and waits on that receipt only. - The fork serializes page tasks: one task loop (tools/server/server-queue.cpp:138-153, save server-context.cpp:2809/2960, restore 2996/3076 at cd2e16d87). Measured 00:18:13Z: two restores issued at once, Benchy wait_ms 1,024 = Aris engine_ms 1,012. - dyno 11 models the engine's page lanes: one lane (today) stop 13.5 s, restores to 5.6 s; overlapped, stop = largest save 4.9 s and each mind only her own restore (max 2.0 s). - Ratchets: the ledger writes through durable::write_replace (no fs::write); restart.rs is #![cfg(test)] (one test mod in dyno.rs); the broker's unwrap_or carry their reasons. Not compiled locally (the M5 is serving); CI is the compiler. 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]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…oint, Ratio, Result ledger Review of #5987 (~/.continuum/evidence/js-shaped-rust-2026-11-14/review.md): - #4 page_store_pool: Ratio newtype built only from a part and a nonzero whole; StorePressure { own, volume: Option<Ratio> }; an unread pressure never keeps (ColdPages::Yield); no .max(1) or map_or(0.0). The dyno fixture records bytes, not ratios. - #5 CheckpointFailure<E: Error> (own file, thiserror): Engine(E) | Admission(String) | Save { slot, kind: SaveFailure::{Rejected, Unresolved, Uncertain} }; no format! sentences. checkpoint_residents returns OwnedCheckpointRefusal variants instead of strings; AdoptedCheckpointRefusal::Save carries { slot, kind }. - #6 page_io::checkpoint_endpoint -> StopCheckpoint { Ended, EngineChanged, Saved, Failed(CheckpointFailure) }; no Err(()) -> String, no Option wrapper. - #7 PageAction { Save, Restore, Erase } (serde lowercase on the wire via .query()); every kv_page_action / page_action caller, the receipt judge and UnresolvedPage migrated. - #21 SavedLedger::load -> Result<LoadedLedger, LedgerUnread>; Unreadable(io::ErrorKind). - #22 CheckpointSave: consuming confirmed()/rejected(); unanswered drop quarantines. - #23 stop probes keep residents as Probed<u64>. - #24 broker sorts with total_cmp. - low: probes record the enums with Debug; the as_str tables are deleted. Not compiled locally (the M5 is serving); CI is the compiler. 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]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Saves are now issued at once, so the cancellation case waits for slot 1's held save and slot 0's confirmation before it cuts, instead of relying on serial order. 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]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…tores-every-mind-warm # Conflicts: # core/continuum-engine/src/inference/slots/page_io.rs # core/continuum-engine/src/inference/turn_admission/tests/lifecycle.rs # core/continuum-engine/src/inference/turn_admission/tests/restore_refusal.rs # core/continuum-kernel/src/runtime/admission_gate.rs
…ts base) 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]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
that referenced
this pull request
Nov 14, 2026
…6004) Live receipt for #5987 on the M5 (canary 7f875cc, 2026-11-14 07:48-07:53Z): the stop's checkpoint saved one resident of four (07:48:28Z, slot 3, Benchy); the new engine (fork pin b5534b531) and core attached the ledger (loaded=1) and restored Benchy, while Aiko, Aris and Atlas came up cold (cold_turn cause="no_page"). The key matched (same fingerprint; Benchy restored) and the page store evicted nothing (every pass declined page_io_busy). The cause: the stop condemns acts in flight (#5988), and a cut act's drop forgets her attribution (TurnAdmission::drop -> forget_resident), so checkpoint_pool, which saved only `holders`, had nobody to save in those slots. KvSlotPool::stop_residents is the checkpoint's resident set: every attributed resident, plus each slot still holding a sequence of a mind attributed nowhere (LiveSequences::held): a confirmed sequence when at least as new as her page, an unconfirmed one (her cut act) only when she has no page. One save per page. Test: a_mind_whose_act_the_stop_cut_is_saved_and_restores_after_the_boot (engine A, a cut act, the stop, engine B and a new core: both minds restore what their slots held). Not compiled locally (the M5 is serving); CI is the compiler. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 5.5 <[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.
Serves resident minds' speed across a deploy (path step 1 "Fast", order-of-work line 3b): serving should come down and up with every mind restoring her page (~1 s), not re-prefilling her context.
The gap (file:line, canary bd90b99)
The halves the task assumed missing exist and are tested:
core/continuum-engine/src/inference/slots/page_io.rs:59-152(PageIoSettle→checkpoint_every_endpoint→checkpoint_endpoint→EndpointTransition::checkpoint_residents,engine_generation.rs:453), through the fork's existing/slots/{id}?action=save.saved_ledger.rsKvPageContract::fingerprint(model, adapters and draft by path/size/mtime, KV cache type, flash attention). Deliberately not the engine build or window: the engine checks the page's own state magic/version and fit, loudly.kv_slot_pool.rs:263lease_paged/plan_paging→ restore inside her first act's admission; testturn_admission/tests/lifecycle.rsevery_mind_resumes_where_she_left_off_across_a_stop_and_a_boot.What actually lost the minds' state on the M5 (core log
~/.continuum/logs/continuum-core-server.log*, engine logllama-server-58057.log):page_store_pool.rspressure()= max(own, volume); the broker (broker.rsevict_amount_for) asks 10% of capacity (9,946,101,555 B) at High. The volume was 0.85 (143 GiB free of 926) and the store held ~2.6 GB of a 92.6 GiB budget, yet rung 3 forgot 29 minds' pages between 22:40Z and 00:50Z (inference.kv_page.store_evicted cold_minds_forgotten=1, roughly every time a mind left her slot). Right now only 2 of 4 residents have a page on disk.ledger_attached carried=false loaded=0at 23:45:39Z, then every first act wascold_turn cause="no_page"(11,148 and 23,060-token cold prefills in the engine log).SavedLedger::loadreturned empty on a missing ledger silently (saved_ledger.rs,Err(NotFound) => return LoadedLedger::default()), and its other refusals were strings.inference.kv_page.settledat 23:40:21Z, then neitherstop_checkpointnorstop_checkpoint_skipped.checkpoint_every_endpointskipped an endpoint with no owned generation (an adopted engine) silently (continue; // never launched here). The log also ends atsystem:shutdown23:42:00Z, so whether a receipt was written and then lost in the tail can't be told from here (inference, unverified).The fork needs nothing new: save and restore are its existing routes, already exercised live (receipts below).
Simulator first: dyno 11 (
capacity/dyno/restart.rs,fixtures/dyno/2026-11-13-restart.json)Every input is a receipt: the four residents' slot tokens (73,826 / 36,893 / 90,853 / 51,749), the aggregate four-mind cold prefill after the 00:18Z relaunch (632 tok/s), page bytes per token (32,273 B), restore rate (1,464,377 B/ms) and save rate (603,433 B/ms) from live
kv_page.actionreceipts, and the store/volume pressure.A paged-out mind under the recorded pressure: before (the store yields) she re-prefills 36,893 tokens (~58 s); after (the store keeps her page) she restores like the residents.
Concurrency and events (Joel 2026-11-14; RTOS rule 10, #5986)
engine_generation::checkpoint_poolissues every resident's save at once and joins on their receipts. Before, it awaited one slot after another.page_ioalso checkpoints every endpoint at once.page_io::settlewaits on the admission gate's drain event, the newAdmissionGate::drained(a Notify fired when the last permit releases). Before, it polled every 50 ms under a deadline. The stop's checkpoint no longer runs undertokio::time::timeout(cap)and no longer skips on a spent budget. A page action that never answers ends throughkv_page_action's own error events.tools/server/server-queue.cpp:138-153(process_new_tasks), save atserver-context.cpp:2809/2960, restore at2996/3076. Measured 2026-11-14 00:18:13Z: two restores the core issued at once, Aris (engine_ms=1012) and Benchy (wait_ms=1024). Benchy waited for Aris's engine time.llama_state_seq_get_data, a memcpy on unified memory), then write the file and its sidecars on a worker. For a restore, read the file on a worker, thenllama_state_seq_set_dataon the loop. The core side needs no change for that.The fix (at the existing owners, no parallel path)
page_store_pool.rs: rung 3 (confirmed minds' pages) yields only to the store's own pressure (High+) or a Critical volume (ColdPages::under). Dead pages (unserved dirs, unconfirmed) still go under any pressure, so the class keeps its eviction story. A keep is a typedDecline::MindsPagesKept, probed only when it changes (no 5 s narration).broker.rs: High relieves the first pool, in pressure order, that frees bytes. A pool that keeps what it holds passes the request on instead of stalling relief. This also removes theunwrap_or(&[])fallback.saved_ledger.rs: a typedLedgerUnread{Missing, Unreadable, Malformed, LegacyUndated, OtherPageFormat} onLoadedLedger, and a missing ledger is probed (inference.kv_page.ledger_unread why="missing"). A cold boot is never silent.page_io.rs: the stop names every endpoint it did not checkpoint, with a typedStopCheckpointSkip{Adopted, NoPagedEngine} and the resident count. It also probesstop_checkpoint_startedbefore the drain, so a stop cut mid-checkpoint still says whom it was saving.Tests
slots/tests/ledger.rsa_restart_names_why_its_ledger_restored_nothing: key mismatch →OtherPageFormat(typed discard, nothing offered); missing →Missing; malformed →Malformed; matching key → no reason, her page offered.page_store_pool.rsa_hot_volume_takes_dead_pages_but_keeps_minds_pages_across_a_restart: under the M5's recorded pressure, dead pages go, the paged-out mind's page stays confirmed, and a restarted pool's ledger offers it (she restores).the_stores_own_pressure_or_a_critical_volume_still_takes_minds_pagescovers both Yield arms.broker.rshigh_pressure_moves_past_a_pool_that_frees_nothing.a_restart_with_four_resident_minds_restores_instead_of_re_prefilling,a_paged_out_mind_keeps_her_page_under_the_recorded_pressure.every_mind_resumes_where_she_left_off_across_a_stop_and_a_boot(real admission, fake engine), unchanged.Lines
+312 / -45 across 12 files (incl. a 141-line dyno module, a 30-line fixture and ~120 lines of tests). Removed: the High-tier
first()/unwrap_or(&[])path, the string-typed ledger refusal reasons, and the silentNotFoundandcontinuereturns. No file over 1,000 lines touched (largest:engine_generation.rs, 935).Not compiled locally
The M5 is serving live minds, so per the rules nothing was built here. CI is the compiler.
Measured: live receipt (after deploy; owner: whoever deploys this, by the next deploy)
Before (2026-11-13 23:45Z deploy, M5, canary at that time): first acts
cold_turn cause="no_page"for every mind; 11,148 / 23,060 / 14,217-token cold prefills in the first minutes; prefix reuse 70% → 57% in the hour after (from the brief).After: on the next deploy, read the following:
inference.kv_page.stop_checkpoint_started/stop_checkpoint ok=true, orstop_checkpoint_skipped reason=at the stop;ledger_attached loaded=N(N = residents) orledger_unread why=at the boot;kv_page.action action=restorebefore her first act, withcold_turnabsent;store_evicted cold_minds_forgottenstays 0 while the volume is below 0.95.Target: tokens re-prefilled per mind ≈ her new tail only, time to first act ≈ restore ms (~1 s per mind).
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo