Parent delivery index: #715. New first-party implementation/tests/automation are handwritten seeded .om; use existing compiler, runtime and migration owners. Reconcile current heads, PRs, comments, consumer pins and recovery archives before edits. No permanent Rust/C/.osc/Python implementation or hidden third-party inference engine. Qualify affected replacements before deleting superseded active code. Preserve live service, driver state, visibility and existing hardware coordination. Exact hashes, commands, raw results, negative controls and independent final-source review are required. Hardware NOT_RUN is not PASS.
Gap and ownership
Main kv_persist.rs blob 11129180724f6f0fd992e23e863bfbc301b396d8 provides sealed prefix persistence. qwen38/serve explicitly excludes attention-only persistence. #713 owns complete-state snapshots and restore correctness; #484 owns durable store/identity and #485 owns nonblocking offload. This issue adds bounded snapshot allocation and the reuse decision policy without recreating those systems.
Acceptance
- Extend #713's complete accepted state: attention KV, all model recurrent states, convolution tails, positions, pending consumed/emitted boundary and drafter state; include sampler state only where its continuation contract requires it.
- Retain committed-prefix pages/compact state within an explicit byte budget rather than duplicating whole context arenas. Count allocated backing, metadata, COW references, staging and transient scratch; freeing slots is not necessarily released RAM.
- Choose fresh prefill, best compatible RAM state or disk restore by estimated total completion cost: lookup+read/decrypt/validate+transfer+reconstruction+suffix prefill. A longer disk prefix does not automatically win over a shorter RAM hit.
- Calibrate on observed timing; bind profiles to model/tokenizer/template/precision/layout/backend and context shape; bound stale-data fallback and avoid eviction/restore oscillation.
- Record candidate costs, selected source, actual time saved/lost and miss/corruption fallback without exporting private traces. Preserve namespace isolation, checksums/sealing and atomic publication from #484.
- Test RAM-vs-disk crossover with injected I/O delays; repeated restore+suffix equals fresh prefill; speculative rejection, pending token, cancel/reuse, cross-session COW, quota exhaustion, corrupt/incompatible cache and restart recovery.
- Prove ready resident work progresses while another restore waits using #485's test contract. Do not hold runtime locks through disk waits.
- Measure cold prefill, warm RAM, host-page-cache restore and actual NVMe restore separately on the qualified 27B artifact. Report next-turn TTFT, memory, restore/commit cost and full workload latency. Preserve the simpler policy when measured overhead outweighs reuse.