Repository navigation
core: a two-session KV isolation test across spill, offload and a retired page - #3840
Merged
Merged
Conversation
…ired page Sessions A and B have disjoint prompts of the same length and keep states at the same positions, so a lookup that went by position alone would hand one the other's rows. On the rows fake (rows_fake.zig) and the snapshot fake (prompt_cache_fake.zig), the test checks: 1. A's state is spilled to disk and dropped from RAM, then B is admitted: B's first turn prefills, its next turn resumes its own RAM state equal to a fresh pass of B's tokens, and A's spilled file is never read for B. 2. A's next turn then resumes A's spilled state from disk, equal to a fresh pass of A's own tokens. 3. After a page is retired and reused (A's spilled state and its blocks removed and another session's written; or A's dropped RAM storage left spare and taken by B's save), a lookup for A's prefix matches nothing, restores nothing and A prefills its own tokens. All three pass on main. With the token comparison removed from Rows.matches, the spill test (1, 2) and the disk retire test (3) fail; removed from the store's find, all three tests fail, the RAM page test (3) too. Tests only: no engine code changes.
ashhart
force-pushed
the
lead/kv-isolation-test
branch
from
November 19, 2026 09:56
b005584 to
6c73f08
Compare
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.
A regression test that pins prefix-cache isolation across spill, offload and page reuse: a kept state is only ever matched by its tokens, never by position, size or slot.
Sessions A and B have disjoint prompts of the same length and keep states at the same positions, so a lookup that went by position alone would hand one the other's rows. On the rows fake and the snapshot fake, the test checks:
All three pass on main. The tests catch the leak they guard against: with the token comparison removed from
Rows.matches, tests 1, 2 and the disk half of 3 fail; removed from the store's lookup, all three fail.Tests only, no engine change. A recent advisory in another engine (a request decoding against an unrelated request's prefix under cascade attention with CPU KV offload) prompted it; TensorFold already keys states by tokens, and this keeps it that way.
Checked on this head:
zig build test-rows-host,zig build check-release-paths,zig fmt --check, and the lean check (no new problems).