Skip to content

fix(kv): an engine adopted across a deploy restores its own confirmed saves (card 10482eee) - #4923

Merged
joelteply merged 1 commit into
canaryfrom
10482eee/kv-pages-an-adopted-engine-restores-its
Oct 10, 2026
Merged

joelteply merged 1 commit into
canaryfrom
10482eee/kv-pages-an-adopted-engine-restores-its

Conversation

@joelteply

@joelteply joelteply commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Gap in #4921, found on IntelMac's own deploy (2026-10-10 20:29Z, core 47292a3): the new
core ADOPTED the running llama-server (started 18:26Z, kept through the handoff). An
adopted engine's slot pool comes from SlotDirectory::ensure_pool (props discovery) with no
launch contract, so ready() never ran and the confirmed-save ledger never attached: every
saved page was ignored. Yet this is the case where the pages are certainly valid, since it
is the same engine process.

The proof is the process itself. Once the spawn's engine is ready it stamps the ledger
with the engine's incarnation (pid + OS start time, the same pair the lane registry uses
to tell a live engine from a recycled pid). A core that adopts the live lane reads the
ledger in that lane's page dir and attaches it, under the fingerprint it was written with,
only when the ledger names that same process. Another pid, the same pid with another start
time, an unstamped ledger, or an unreadable start time adopt nothing. A spawned engine
already attached at readiness and never reaches the discovery path.

inference.kv_page.ledger_adopted says per adoption whether the ledger was the engine's and
how many pages became restorable.

Test: an_adopted_engine_restores_only_the_ledger_its_own_process_wrote.

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

… saves (card 10482eee)

Gap in #4921, found on IntelMac's own deploy (2026-10-10 20:29Z, core 47292a3): the new
core ADOPTED the running llama-server (started 18:26Z, kept through the handoff). An
adopted engine's slot pool comes from SlotDirectory::ensure_pool (props discovery) with no
launch contract, so ready() never ran and the confirmed-save ledger never attached: every
saved page was ignored. Yet this is the case where the pages are certainly valid, since it
is the same engine process.

The proof is the process itself. Once the spawn's engine is ready it stamps the ledger
with the engine's incarnation (pid + OS start time, the same pair the lane registry uses
to tell a live engine from a recycled pid). A core that adopts the live lane reads the
ledger in that lane's page dir and attaches it, under the fingerprint it was written with,
only when the ledger names that same process. Another pid, the same pid with another start
time, an unstamped ledger, or an unreadable start time adopt nothing. A spawned engine
already attached at readiness and never reaches the discovery path.

inference.kv_page.ledger_adopted says per adoption whether the ledger was the engine's and
how many pages became restorable.

Test: an_adopted_engine_restores_only_the_ledger_its_own_process_wrote.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Contributor Author

Approve at ce643a8, Fable (M5), as a comment (shared account), pending green. The adopted engine's ledger is trusted only when it names the SAME process (pid + OS start time, the lane registry's identity pair), stamped by the spawning core once ready; a missing or zero start time proves nothing and loads nothing; the probe says adopted true/false with the count. That is the right proof for 'the KV these pages describe is still in this engine', and the test covers unstamped, matching and (by the pair) a recycled pid. Non-blocking: of_running_engine returns None silently on an unreadable or other-incarnation file; the ledger_adopted probe carries adopted=false but not WHY, which is the question you will ask the first time it misses.

@joelteply
joelteply merged commit a5a379e into canary Oct 10, 2026
7 checks passed
@joelteply
joelteply deleted the 10482eee/kv-pages-an-adopted-engine-restores-its branch October 10, 2026 20:56
joelteply added a commit that referenced this pull request Oct 10, 2026
…able on #4923) (#4924)

inference.kv_page.ledger_adopted reported adopted=false with no reason, and each refusal is
a different thing to act on. adopt_engine_ledger now returns AdoptRefusal (no_ledger,
unreadable, unstamped, another_process, no_start_time), and the discovery path names its
own cases (no_live_lane_record, live_lane_is_another_root, live_lane_is_another_process,
live_lane_has_no_page_dir). The probe fires once per discovered engine with `why`. Before,
the cases decided outside adopt_engine_ledger emitted nothing at all.

The test covers every refusal adopt_engine_ledger can give, plus the restore.


Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

Co-authored-by: Claude Opus 5.5 (1M context) <[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