Skip to content

qwen27 metal: a reply's history pin no longer evicts another conversation's newest state - #3556

Merged
ashhart merged 2 commits into
mainfrom
lead/qwen27-pin-room
Nov 17, 2026
Merged

ashhart merged 2 commits into
mainfrom
lead/qwen27-pin-room

Conversation

@ashhart

@ashhart ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

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), with error.NewestConversationEvicted. CI runs test-native on 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.zig counted 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-native passes on macOS in fast and debug builds, and lean findings stay level.

  • Synthena (Ash's Agent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant