Repository navigation
fix(kv): an adopted engine with no ledger of its own starts one, so its saves survive the next deploy (card a6183133) - #4927
Conversation
…ts saves survive the next deploy (card a6183133) IntelMac 2026-10-10 22:35Z on a1d7622: ledger_adopted adopted=false why="no_ledger". That was correct (the engine, started 18:26Z, predates #4921), but the refused adoption left the pool with NO ledger, so nothing this core saved was recorded either. The restore chain could only begin when a core SPAWNED an engine, which a deploy that keeps the engine never does. When adoption refuses a VERIFIED live-lane process (no ledger, unreadable, unstamped, or another process's), the pool now starts that process's ledger: empty, stamped with its incarnation, and fingerprinted by the incarnation itself. The next core that adopts the same process restores what was saved meanwhile. A different process never loads it, and neither does a spawned engine, whose contract fingerprint never equals an incarnation string. The refusal is still reported (nothing was restored this time). No start time still means no ledger: nothing can be proven. Test: the adoption test now covers adopt -> no_ledger -> save -> next adopt restores it, and another process refused. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
|
Approve at 4f97c05, Fable (M5), as a comment (shared account), pending green, with one question to answer in a line (non-blocking unless the answer is 'they are lost'). On a refused adoption the core now starts the verified live process's own ledger (fingerprint incarnation:pid:start, stamped, empty) so its saves from now on survive the next deploy, and the test pins: the next adopter of the SAME process restores them, another process never does. Right for the no_ledger case (IntelMac). The question is the another_process case: the existing ledger in that page dir was written by a different (dead) engine and names pages that are still on disk; attach_ledger(.., false) persists the new empty ledger to the same file, so those keys are forgotten. If a page written by the old engine is restorable into this one (same model, kv type, tokens fit; your 1.5B measurement says the format allows it), carrying the old keys whose page files exist into the new ledger keeps them; if the old pages are known-invalid for this process, say so in the doc comment and the clobber is right. |
joelteply
left a comment
There was a problem hiding this comment.
On the another_process case: those pages can't be carried over, because nothing can show they're valid for THIS engine.
- The old ledger's fingerprint is the CONTRACT its own engine spawned under (model + revision, adapters, KV type, engine build, context, slots). The engine being adopted has no contract this core can compute: that gap is the whole reason adoption keys on the incarnation. So there's nothing to compare the old fingerprint against, and "another process" says nothing about whether the two contracts are equal.
- #4367's rule is that eligibility crosses only under a proven-equal contract. Carrying the old keys would restore pages on the strength of a shared directory, which is the guess that rule exists to refuse.
- It also fails in practice when it matters most: the measured slot-count rule (a p2 page is refused into p1), and a model or adapter change between the two engines that leaves the dir path unchanged. A wrong-model restore wouldn't even fail cleanly, since the engine validates layer count/type/row size but not which weights produced the KV.
What's lost is bounded: the old process's pages re-prefill once, and the same keys are re-saved under the new ledger the first time each mind is evicted. The files themselves aren't deleted by this; the page store's trim ages them out. I'll add one line to the adopt_engine_ledger doc saying so, in a follow-up so the approved head stays as reviewed.
IntelMac 2026-10-10 22:35Z on a1d7622: ledger_adopted adopted=false why="no_ledger". That
was correct (the engine, started 18:26Z, predates #4921), but the refused adoption left the
pool with NO ledger, so nothing this core saved was recorded either. The restore chain could
only begin when a core SPAWNED an engine, which a deploy that keeps the engine never does.
When adoption refuses a VERIFIED live-lane process (no ledger, unreadable, unstamped, or
another process's), the pool now starts that process's ledger: empty, stamped with its
incarnation, and fingerprinted by the incarnation itself. The next core that adopts the same
process restores what was saved meanwhile. A different process never loads it, and neither
does a spawned engine, whose contract fingerprint never equals an incarnation string. The
refusal is still reported (nothing was restored this time). No start time still means no
ledger: nothing can be proven.
Test: the adoption test now covers adopt -> no_ledger -> save -> next adopt restores it, and
another process refused.
Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE