Repository navigation
fix(working-memory): restore saves pre-custody results through spill and collapses only against the real window - #4982
Merged
Conversation
…and collapses only against the real window BigMama's live receipt of #4963 on the 5090 (ea94ab3, 14:08Z): Kimi resumed clean (0 're-run if needed', 0 tails), but at restore the 'results whose save failed are kept whole' probe fired, total 2,464 then 13,859 against cap 1,536. Those entries came from her pre-#4963 snapshot: no handle because they predate custody, not a failed save. So the probe named a failure that never happened, and because unsaved entries never collapse they sat over the share for good. - persona_workspace saves each handle-less restored entry through spill::retain before restore, so it collapses like any saved result and the probe names only a real save failure. - WorkingMemory::restore collapses only once the served window is known. The 1,536 cap was the floor budget (restore runs before set_served_window), which folded results her real window holds; the next settlement collapses against the served window. Test: restore_collapses_only_against_a_known_window. Card df0035bf. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ce held, which settles as it records CI job 114851650768 at 65881f7: the source folds one of four third-of-share results at record time, so its snapshot carries 3 whole entries; the test asserted 4. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ation and pins each before the next save Codex on #4982: - The retain loop had no test that ran it. - Several saves happen before the memory publishes its live set, and the persisted checkpoint (the old handle-less snapshot) names none of them, so a later save's pressure could evict an earlier file. spill::retain_handleless now owns the loop. Each saved handle is published live under a RestorePin (its own holder key space, so it can't replace a memory's set) before the next save. persona_workspace holds the pin until WorkingMemory::restore has published. The test runs the loop: each new handle resolves to the exact bytes, an existing handle is kept, each is pinned as it is saved, the pin withdraws on drop, and a failed save keeps its text whole with no handle. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ve before its file exists Codex on #4982 at afae2e7: retain_in returned before the pin was inserted, so a concurrent evictor could delete a new file in between. The handle is a content hash, known before the write, so LivePin::retain enters it into the live set eviction reads (same lock, is_live) and only then writes. On a failed write it removes the entry it added. The restore path uses it now. The live path (command executor, act/observe) adopting the same primitive is card 12b080c3, owner Cormac. Not claimed here. The test now pins the order: the handle is live while its file does not yet exist. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
… unused LivePin::retain waits for 12b080c3 78e1859 raised the unwired-public-machinery ratchet from 61 to 62. LivePin is constructed only in spill.rs, so its visibility is pub(crate). LivePin::retain had no caller yet; the live path's adoption (12b080c3) adds it back with its first caller. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…he live-set lock, so an existing file is never deleted while pinned Codex on #4982 at 8b93e75: FilesystemTierPool checked protect(path), released the lock, then removed the file. A LivePin taken in that gap on an EXISTING content-addressed file (same name) had its file deleted while pinned. The pool now removes through a guarded remover (removing_with -> Removal), replacing the separate predicate. spill::evict_unless_live reads the checkpoint, then checks the live set and deletes under the lock LivePin enters with. So a pin lands either before the check (the file is protected) or after the delete (its write recreates the file). The test proves the interleaving deterministically: inside the section, the lock a pin needs is held (try_lock is None). It also checks that a pinned existing file is protected, and that a pin after the delete rewrites the file. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
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.
BigMama's live receipt of #4963 on the 5090 (ea94ab3, 14:08Z): Kimi resumed
clean (0 're-run if needed', 0 tails), but at restore the 'results whose save
failed are kept whole' probe fired, total 2,464 then 13,859 against cap 1,536.
Those entries came from her pre-#4963 snapshot: no handle because they predate
custody, not a failed save. So the probe named a failure that never happened,
and because unsaved entries never collapse they sat over the share for good.
spill::retain before restore, so it collapses like any saved result and
the probe names only a real save failure.
The 1,536 cap was the floor budget (restore runs before
set_served_window), which folded results her real window holds; the next
settlement collapses against the served window.
Test: restore_collapses_only_against_a_known_window. Card df0035bf.
Co-Authored-By: Claude Opus 5.5 (1M context) [email protected]
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE