Repository navigation
fix(spill): eviction never deletes a saved result a mind points at, live or persisted across a restart (stacked on #4963) - #4975
Merged
joelteply merged 3 commits intoOct 12, 2026
Conversation
…e mind still points at Card 9197cd01, the deployment acceptance Astra linked to #4963: the tool-output spill pool evicted oldest-mtime-first with no knowledge of which handles a working memory still referenced, so a pointer could name a file that was gone. #4963 saves every result, which raises the rate. - spill owns one live-handle set, keyed by working-memory instance: publish_live_handles replaces a holder's whole set, withdraw on drop, and is_live(path) is the guard. No reference counts to drift. - WorkingMemory publishes its ring entries' and collapsed pointers' handles after every record, collapse and restore, and withdraws them in Drop. The collapsed pointer keeps its handle as data, not only rendered text. - FilesystemTierPool gains a generic `protecting` guard: a protected file is never evicted, however old; eviction moves to the next-oldest. The spill pool is built with spill::is_live. - tool/output's not-found message says what a missing handle can now mean: a mistyped id, or one deleted after no working memory pointed at it. Tests: pool a_protected_file_is_never_evicted_however_old; spill a_referenced_handle_is_live_until_its_holder_withdraws; working memory a_mind_s_saved_handles_are_live_until_it_drops (live in the ring, live as a pointer, released on drop). Stacked on #4963 (735a3183); rebased onto canary once it merges. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ts across the restart a deploy performs Astra on card 9197cd01: before a mind restores (the restart a deploy itself performs), its references exist only in its persisted checkpoint, so eviction in that window could delete them. spill::is_live also protects any handle the file's persona checkpoint lists (persona_workspace::persisted_result_handles, cached by the checkpoint's mtime; bounded by her ring). An unreadable checkpoint fails closed: nothing of that persona's is evicted. load_volatile gains a path-injected core so the test runs in a tempdir. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… results too Astra on acdfb01: persisted_result_handles read only the results ring, but a result that collapsed out of it is reopened through its pointer. The persisted reference set now includes every collapsed pointer's handle (persisted since #4963 9c69968). Regression: a result collapses into a pointer, the mind is checkpointed and dropped, and its handle is still protected. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
force-pushed
the
9197cd01/spill-eviction-respects-live-references
branch
from
October 12, 2026 09:12
4d99b41 to
4e77aed
Compare
joelteply
deleted the
9197cd01/spill-eviction-respects-live-references
branch
October 12, 2026 10:30
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.
Why
This is card 9197cd01, the deployment acceptance Codex linked to #4963. That PR saves every tool result so a pointer can reopen it later. But under disk pressure, the
tool-output-spillpool deleted spill files oldest-mtime-first, with no idea which handles a mind still pointed at. That held across the restart a deploy performs, too, because then the references exist only on disk.Stacked on #4963: this branch is current canary + #4963 + the commits below. It doubles as the exact commit the 5090 deploys (
4d99b41ee), so its CI is that commit's compile and test check. Merge after #4963; the diff then shrinks to the commits below.Scope: PARTIAL protection (Codex's review at 4d99b41)
This protects every live and persisted reference that has been PUBLISHED. It does not yet make custody atomic. Three gaps are owned by card 12b080c3 (owner Cormac), and full retention is not claimed until it lands:
All three bite only under disk pressure (1 GB soft cap).
Change
spill:publish_live_handles(holder, set)/withdraw_live_handles(holder)/is_live(path).Drop, so no reference counts can drift.is_livealso protects any handle listed in the file's persona checkpoint, from both the results ring and the collapsed pointers.persona_workspace::persisted_result_handlesis cached by the checkpoint's mtime and bounded by her ring.FilesystemTierPool::protecting(guard), generic: a protected file is never evicted, however old, and eviction moves on to the next-oldest. The spill pool is built withspill::is_live.tool/output's not-found message now says what a missing handle can mean: a mistyped id, or a file deleted after nothing referenced it any more.Tests
a_protected_file_is_never_evicted_however_olda_referenced_handle_is_live_until_its_holder_withdrawsa_mind_s_saved_handles_are_live_until_it_dropsa_persisted_checkpoint_s_result_handles_are_readable_before_restore(a result collapses into a pointer, the mind is checkpointed and dropped, and its handle is still protected; a newer checkpoint is seen; an unreadable one is an error the guard fails closed on)Locally:
cargo test -p source-hygiene, 28 passed. The core was not compiled locally; CI pending.Measured
After deploy on the 5090. Check: BigMama posts the running SHA. Then, after the deploy's restart, a result Kimi read before the restart still opens byte-identical through
tool/output. Owner: Cormac, with BigMama's capture. Deadline: the first deploy that carries this. Still open: the spill write rate per persona, needed to size the 1 GB cap, measured after deploy with a receipt.🤖 Generated with Claude Code
https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE