Repository navigation
A mind's checkpoint crosses a restart beside her record - #164
Merged
Merged
Conversation
A hybrid mind restored with every token she held could not rewind to her view's end: her checkpoint lived in host memory only, so the first turn after a restart re-prefilled her whole prompt (the M5, 2026-11-27: Aiko shared 214,911 of 246,764 tokens with what she held and prefilled 1,019 s). llama_persona_checkpoint_write_file writes a checkpoint beside her record of the stop's generation, only while it is still valid against the parked blocks it is written with: her owner, her cells' lineage, and an uncut receipt at its position. llama_persona_checkpoint_read_file reads it into blocks already restored from her record of that generation, checks owner, epoch, recurrent layout, generation, every row length from their geometry and a position they hold, then binds it to their restored cells (their lineage, a fresh receipt), so it rewinds exactly as one taken before the stop. A refused read leaves nothing taken. The checkpoint struct moves into llama-persona.h so the file code reaches it. Measured on the M5 (Qwen3.6-35B-A3B Q4_K_M, checkpoint_handoff example in continuum): view 4,096 tokens, tail 256, decode 32: after the restart she prefilled the 256-token tail, not 4,352; all 32 decoded tokens equal a never-stopped control's; a checkpoint of another generation refused. Checkpoint file 65.9 MB (her recurrent rows in every snapshot group). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
to CambrianTech/continuum
that referenced
this pull request
Nov 27, 2026
… across a restart) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…art round trip tested natively Codex on #164: the read built row lengths and read rows (allocations) before the try around its receipt, and the write built its staging name outside any, so std::bad_alloc under memory pressure could cross the C ABI into Rust. Both exported functions are now a boundary over internal bodies: any bad_alloc inside returns out_of_memory, a refused read leaves nothing taken (its commit allocates first, then only swaps), a refused write leaves no file (its staging file opens only after its name exists), and the reader's file closes through the existing RAII guard. test-persona-blocks section 10, on a tiny random qwen35moe hybrid: her checkpoint written beside her record and read into the blocks restored from it rewinds her so a different continuation is byte-identical to decoding it in place; a read before her record, or of another generation, is refused with nothing taken; a write for blocks that are not hers is wrong_owner; with every allocation failing, the read and the write each return out_of_memory, nothing taken and no file written, and she then reads, binds and serves. Mutation: the read boundary's catch narrowed away terminates the test with an uncaught std::bad_alloc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…pt (Codex on #164) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply
added a commit
to CambrianTech/continuum
that referenced
this pull request
Nov 27, 2026
…ever re-prefills her view (#6290) * Her checkpoint survives a restart: the first turn after it rewinds, never re-prefills her view After a restart a mind came back with her held tokens and KV in place but no checkpoint (it lived in host memory only), and on the hybrid a prompt that diverges inside what she holds cannot rewind without one. So her first turn re-prefilled her whole prompt: on the M5 at 09:52Z (build c43b2ba) Aiko started no_checkpoint with reused 0, sharing 214,911 of 246,764 tokens with what she held, and prefilled 1,019 s; Benchy the same. Her view-end checkpoint now travels with her blocks (fork CambrianTech/llama.cpp#164): - A stop hands it over beside her record, in the same generation, only while the fork finds it still valid against her parked blocks (owner, cell lineage, an uncut receipt) and only when it holds exactly its end within her history and was taken under the genes her blocks carry. It is fenced durable before the manifest names it (Codex: publish the descriptor only once all blocks are durable). - The resume reads it into her restored blocks; the fork checks it against them and binds it to their restored cells. Her history resumes with it as her view checkpoint under the genes she resumes under, so reuse::choose rewinds to it, and a prompt that diverges before its end still restarts as diverged_before_checkpoint (Codex's first-turn check). - A checkpoint that cannot cross (refused by the fork, or not exactly its end) is a probe (persona.engine.checkpoint_not_preserved / _not_restored) and she crosses without it: her blocks and history are her durable state; only that rewind is lost. - The manifest goes to format 4, PreservedMind.checkpoint naming its file and end; a format-3 manifest is upgraded explicitly (each mind as she was, with none). Cleanup knows .ckp files. driver.rs stays at 999 lines; the new types live in preserve/mind_files.rs and driver/history.rs. ## Measured - checkpoint_handoff (new example) on the M5, Qwen3.6-35B-A3B Q4_K_M, 2026-11-27 ~10:05Z: view 4,096, tail 256, decode 32. After the restart she prefilled the 256-token tail, not 4,352; all 32 decoded tokens equal a never-stopped control's; a checkpoint of another generation refused with nothing taken. Checkpoint file 65.9 MB. - cargo test -p continuum-engine --features metal --lib persona_scheduler::preserve: 8 passed (format-3 upgrade, and cleanup keeps a named .ckp and removes an older or torn one). - Ratchets vs origin/canary: pass. - After deploy (owner: Fable, the M5): the first turn of each resident after a restart reports a rewind, not no_checkpoint, with prefill near her tail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Pin the fork at c1eea1394 (CambrianTech/llama.cpp#164: her checkpoint across a restart) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Pin the fork at 454276082 (#164: her checkpoint's file calls never throw across the C boundary) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * Pin the fork at fad04059f (#164: the forced allocation-failure receipt) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
A hybrid mind restored with every token she held could not rewind to her view's end: her
checkpoint lived in host memory only, so the first turn after a restart re-prefilled her
whole prompt (the M5, 2026-11-27: Aiko shared 214,911 of 246,764 tokens with what she held
and prefilled 1,019 s).
llama_persona_checkpoint_write_file writes a checkpoint beside her record of the stop's
generation, only while it is still valid against the parked blocks it is written with: her
owner, her cells' lineage, and an uncut receipt at its position. llama_persona_checkpoint_read_file
reads it into blocks already restored from her record of that generation, checks owner, epoch,
recurrent layout, generation, every row length from their geometry and a position they hold,
then binds it to their restored cells (their lineage, a fresh receipt), so it rewinds exactly
as one taken before the stop. A refused read leaves nothing taken. The checkpoint struct moves
into llama-persona.h so the file code reaches it.
Measured on the M5 (Qwen3.6-35B-A3B Q4_K_M, checkpoint_handoff example in continuum): view 4,096
tokens, tail 256, decode 32: after the restart she prefilled the 256-token tail, not 4,352; all
32 decoded tokens equal a never-stopped control's; a checkpoint of another generation refused.
Checkpoint file 65.9 MB (her recurrent rows in every snapshot group).
Continuum side: CambrianTech/continuum (fable/checkpoint-survives-restart), the stop hands this file over with her blocks and the resume binds it back.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo