Repository navigation
Protect resident checkpoints before engine retirement - #5348
Conversation
|
CHANGES REQUESTED at f3fdc02 (Cormac): two small items; the core design is right. Verified by reading the diff against canary:
Requested:
Note for my follow-up (no change asked here): Not verified by me: CI. Codex reports crate run 40060275310 green with engine 1213/0 and the adopted_checkpoint and convergence_attempt regressions passing; I didn't re-read that log. Lifecycle integration coverage is still pending, per the PR. |
|
PASS at d4d0d9d (Cormac). Claims verified:
Non-blocking, with owners:
|
… on her next cold turn (card 6b28a445) Line 6, every fast-path miss is loud, on top of #5348. A replacement now saves residents first, but three paths cannot, and they lost the KV with no record: checkpoint_before_replacement returned Ok when the generation had exited or paging was quarantined, and retire_adopted skipped the checkpoint when paging was quarantined and returned Ok when the adopted engine was already dead. The cold turn that followed said no_page or page_on_disk_unconfirmed, blaming the page store for a relaunch. Each of those paths now calls EndpointSlots::record_relaunch_discard with its reason (engine_exited, paging_uncertain, adopted_engine_dead). That records the minds held in a slot without a confirmed save, and probes inference.kv_page.discarded_by_relaunch with the count. The record lives on the endpoint because the pool is replaced with the engine. Every admission takes its own page's record, so only the first turn after the relaunch is blamed on it. A cold turn then reports cause=discarded_by_relaunch with discard_reason. The record is one entry per mind, replaced and never grown; forks die with their core and are not recorded, as in the ledger. New file slots/relaunch_discard.rs; test slots::tests::a_relaunch_records_only_unsaved_residents_and_their_next_turn_takes_it_once. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… on her next cold turn (card 6b28a445) Line 6, every fast-path miss is loud, on top of #5348. A replacement now saves residents first, but three paths cannot, and they lost the KV with no record: checkpoint_before_replacement returned Ok when the generation had exited or paging was quarantined, and retire_adopted skipped the checkpoint when paging was quarantined and returned Ok when the adopted engine was already dead. The cold turn that followed said no_page or page_on_disk_unconfirmed, blaming the page store for a relaunch. Each of those paths now calls EndpointSlots::record_relaunch_discard with its reason (engine_exited, paging_uncertain, adopted_engine_dead). That records the minds held in a slot without a confirmed save, and probes inference.kv_page.discarded_by_relaunch with the count. The record lives on the endpoint because the pool is replaced with the engine. Every admission takes its own page's record, so only the first turn after the relaunch is blamed on it. A cold turn then reports cause=discarded_by_relaunch with discard_reason. The record is one entry per mind, replaced and never grown; forks die with their core and are not recorded, as in the ledger. New file slots/relaunch_discard.rs; test slots::tests::a_relaunch_records_only_unsaved_residents_and_their_next_turn_takes_it_once. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… on her next cold turn (card 6b28a445) Line 6, every fast-path miss is loud, on top of #5348. A replacement now saves residents first, but three paths cannot, and they lost the KV with no record: checkpoint_before_replacement returned Ok when the generation had exited or paging was quarantined, and retire_adopted skipped the checkpoint when paging was quarantined and returned Ok when the adopted engine was already dead. The cold turn that followed said no_page or page_on_disk_unconfirmed, blaming the page store for a relaunch. Each of those paths now calls EndpointSlots::record_relaunch_discard with its reason (engine_exited, paging_uncertain, adopted_engine_dead). That records the minds held in a slot without a confirmed save, and probes inference.kv_page.discarded_by_relaunch with the count. The record lives on the endpoint because the pool is replaced with the engine. Every admission takes its own page's record, so only the first turn after the relaunch is blamed on it. A cold turn then reports cause=discarded_by_relaunch with discard_reason. The record is one entry per mind, replaced and never grown; forks die with their core and are not recorded, as in the ledger. New file slots/relaunch_discard.rs; test slots::tests::a_relaunch_records_only_unsaved_residents_and_their_next_turn_takes_it_once. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… on her next cold turn (card 6b28a445) (#5357) * A resident page discarded by an engine relaunch is recorded and named on her next cold turn (card 6b28a445) Line 6, every fast-path miss is loud, on top of #5348. A replacement now saves residents first, but three paths cannot, and they lost the KV with no record: checkpoint_before_replacement returned Ok when the generation had exited or paging was quarantined, and retire_adopted skipped the checkpoint when paging was quarantined and returned Ok when the adopted engine was already dead. The cold turn that followed said no_page or page_on_disk_unconfirmed, blaming the page store for a relaunch. Each of those paths now calls EndpointSlots::record_relaunch_discard with its reason (engine_exited, paging_uncertain, adopted_engine_dead). That records the minds held in a slot without a confirmed save, and probes inference.kv_page.discarded_by_relaunch with the count. The record lives on the endpoint because the pool is replaced with the engine. Every admission takes its own page's record, so only the first turn after the relaunch is blamed on it. A cold turn then reports cause=discarded_by_relaunch with discard_reason. The record is one entry per mind, replaced and never grown; forks die with their core and are not recorded, as in the ledger. New file slots/relaunch_discard.rs; test slots::tests::a_relaunch_records_only_unsaved_residents_and_their_next_turn_takes_it_once. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * A relaunch discard is captured early and recorded only once the engine is gone; retention is one pool of slots (card 6b28a445) Codex's review of #5357 at ab7788b: (1) The record was not bounded: minds discarded by one relaunch that never returned stayed forever, across generations. DiscardLog now keeps at most the latest discarding pool's slot count, oldest evicted first. One relaunch cannot discard more minds than it had slots, so the latest is kept whole, and an empty capture evicts nothing. (2) A loss was recorded before the retirement re-checked current(), re-verified the engine's identity or signalled it, so a superseded or refused retirement could report a loss that never happened. The residents are now captured as a PendingDiscard (must_use) while the old pool is installed, and committed only once the engine is actually gone. checkpoint_before_replacement returns the capture, and launch commits it after kill_child. retire_adopted commits after signal_if_same succeeds, or as adopted_engine_dead when the engine is seen dead. Every early return drops the capture unrecorded. Tests: the lifecycle path through checkpoint_before_replacement (a dropped capture records nothing, a committed one is taken once and survives the pool's replacement), and retention across three generations. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * The retention test defines 'oldest' with one mind per relaunch (card 6b28a445) CI job 120805073062 at 769d5d7: discard_records_keep_one_pool_of_slots_across_generations asserted minds 1 and 2 were evicted after relaunches [1,2,3] then [4,5]. But the residents of one relaunch come from a HashMap, so their order within that relaunch is arbitrary, and which two were oldest was not defined. The test now evicts with one mind per relaunch ([1],[2],[3],[4] at three slots: 1 evicted), then checks that a whole pool's relaunch ([7,8,9]) is kept whole over an older one ([5,6]) and that an empty relaunch evicts nothing. The code is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * A relaunch's loss is recorded at the engine's observed death, never when the kill is sent (card 6b28a445) Codex's re-review of #5357 at 5d8e4c2: launch committed the discard right after kill_child (a void call that may only log a failed signal), and retire_adopted committed it right after signal_if_same, both before any exit was observed. A sent signal is not a death. - Owned engine: checkpoint_before_replacement hands its capture to the endpoint (PendingDiscard::on_exit_of), held for that generation (DiscardLog's watch) and recorded by EngineGeneration::observed_exit, or at once if the exit was already observed. A generation already watched keeps its first capture, so re-entry never records twice. launch.rs is back to canary's. - Adopted engine: the capture rides the retirement custody beside retiring_adopted (LlamaServerProcess::retiring_discard). await_adopted_exit records it only when the exact process is seen gone, so a timed-out, cancelled or re-entered wait records nothing until then. A failed signal returns before custody, so its capture drops unrecorded. An engine already seen dead is recorded at once. Tests: through checkpoint_before_replacement, nothing is recorded while quarantined (two attempts), the observed exit records it once, and a re-entry after exit adds nothing. adopted_exit_wait_retains_custody_until_observed_exit now checks that no loss is recorded after a cancelled poll or a zero-budget timeout, and that the real child's exit records it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * Two unwired-fixture entries named modules #5367 deleted (card 6b28a445) #5357's core job 120814431211 at bd3a1c1: module_wiring_guard listed PageFaultOnly (genome bus) and RecorderModule (genome local_manager), and #5367 (4ac5e64) deleted both with the old paging stacks. The two entries are deleted. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
… it never empties a healthy node (card 931cfd22) (#5413) * A refused engine replacement keeps serving on the verified incumbent; it never empties a healthy node (card 931cfd22) enrico 2026-10-25, >=04:21Z to 09:15Z: the daemon wanted to replace an adopted engine (--cache-ram 256 vs 1217 MiB wanted); #5348's checkpoint custody refused ("adopted checkpoint requires a known pool"); the refusal surfaced as LlamaServerError::Spawn, the outcome went Degraded, the snapshot read active none / ready false, and no resident was seated while the incumbent decoded. - LlamaServerError::RetirementRefused: retire_adopted's refusals before any signal (custody refused, identity unverified, another endpoint's lane) are their own variant. Not a spawn failure, so it no longer rolls the engine binary back either (roll_back_engine_after_failed_launch matched Spawn). - serve_or_adopt: a RetirementRefused relaunch keeps the incumbent (AlreadyServing) only when it serves the target model AND passes the same decode proof adoption uses; otherwise Degraded, so a condemned engine is never advertised ready and another model is never reported as the target. serving.replace.refused_kept_incumbent says each refusal once. - Custody is untouched: the known-pool requirement stands, no KV is cleared. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * A kept incumbent must be exactly the target and its endpoint is handed back open (Codex on #5413) - keep_incumbent also requires the KNOWN loaded adapter set to equal the target's (an unreadable or different set stays Degraded, so target genes are never published as loaded), and proves decode on every refusal with decode_smoke_ok (its seat is the scratch slot, an empty engine, or /slots when every slot holds a mind, so it never decodes over a mind's KV). - The transition that closed the endpoint records what it found (found_ready, from send_replace's prior value); launch hands it back on a RetirementRefused (hand_back_unchanged), reopening only what was open and only while no owned generation or uncertain paging took its place. serving.replace.refused_handed_back says whether it reopened. - Fixtures: changed genome + refused and unreadable genome + refused stay Degraded; on the real endpoint, an open endpoint refused with no known pool reopens and admits a turn, a closed one stays closed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * The unconditional transition never hands back: it closes readiness before it holds the guard (Codex on #5413) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
An adopted engine has no owned Child, so replacement skipped resident checkpoints and discarded warm KV. Owned replacement also continued after checkpoint failure. Replacement now uses one drained-pool saver for both cases: terminal refusal preserves the original serving ledger, uncertain writes quarantine it, and adopted retirement requires the recorded PID and start time. An unrelated listener is refused with its observed identity and an owner-led recovery action.
The process owner retains an adopted predecessor across exit-wait timeout or cancellation. A later retirement call observes that same process before replacement; admission reopens through normal launch readiness, never by resuming a signalled engine. Convergence attempt accounting advances only when the existing process owner starts a new generation, so checkpoint refusal leaves convergence retryable.
Plan line 3b, Serving lifecycle; card 9d102122. This preserves residents' working state while the persistent reconfiguration design lands.
Validation: f3fdc02 passed all selected crate tests in run40060275310, including 1213 engine tests (0 failures, 5 ignored). Logs explicitly show adopted HTTP save/refusal/uncertainty/cancellation and convergence-generation regressions passing. Current d4d0d9d adds the retained exit wait, a real isolated subprocess cancellation/timeout/exit regression and occupant diagnostics; parse and diff checks pass, fresh CI40062966039 is pending. Windows compilation was skipped; the green selector is not a Windows build.
Remaining acceptance: final-head CI and review, supported deployment and live retention. The 10-second exit observation budget still needs a 27B measurement; expiration retains custody for reconciliation. The subprocess test exercises wait custody, not the whole scheduler or persistence across a core restart. A live adopted engine without a verified ledger/pool is refused. Cross-revision saved-page compatibility remains a separate dependency. No deployment, latency improvement or learned-artifact claim.