Repository navigation
qwen27 metal: a reply's history pin no longer evicts another conversation's newest state - #3556
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/qwen27-pin-room
branch
from
November 17, 2026 14:24
d5e5666 to
afd4feb
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.
On macOS,
qwen27_served's "a reply's end keeps its prompt's born: newest conversations precede redundant history under pressure" test fails on main every time, in debug and fast builds (twenty runs out of twenty), witherror.NewestConversationEvicted. CI runstest-nativeon macOS only in the scheduled job, so PRs never see it.The test is right and the engine was wrong. When a reply finishes, the Qwen 3.8 27B Metal engine may pin the conversation's history so a same-prompt regeneration finds it. Before taking that optional pin,
qwen27_resume.zigcounted only the history and the reply, and skipped other conversations' states that nothing was borrowing. In a tight cache it granted the pin anyway. The history then became a borrower the eviction order can't touch, so fitting the reply evicted another conversation's newest state, where the normal order would have dropped the now-redundant history first.The pin now charges everything the cache already holds and every promised slot before it is taken. If that fits, history stays available as before; if not, the normal eviction order decides. The pin can no longer displace another state or a promise. Eviction policy, cache keys, snapshot copying and reply provenance are unchanged, and tokens can't move: this only decides what the cache keeps.
A new boundary test fails on the old engine and passes here.
test-nativepasses on macOS in fast and debug builds, and lean findings stay level.