Repository navigation
qwen27 metal: pin the reply history with a full cache again (fixes #5141) - #5154
Merged
Merged
Conversation
This was referenced Nov 26, 2026
ashhart
force-pushed
the
lead/qwen27-reply-history-pin
branch
from
November 26, 2026 05:39
be9e03c to
f671f9f
Compare
ashhart
added a commit
that referenced
this pull request
Nov 26, 2026
ashhart
added a commit
that referenced
this pull request
Nov 26, 2026
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.
Fixes #5141. Since #3556 (1.2.10), Qwen3.8-27B on Metal pinned the conversation history before saving the reply end only when there was room beside every other cached state. With a full cache the history was not pinned, saving the reply end could evict it, and a client that sends history without reasoning (the usual OpenAI-client behaviour) resumed nothing on the next turn: about 20 s to first token at 34K context instead of 0.06 s on 1.2.9.
This restores 1.2.9's rule. The pin counts the history, the new reply end, promised room, borrowed states and reservation-protected states, but no longer requires room beside an ordinary evictable state; it pins the history before the reply end is saved, and keeps the reply-end-only fallback when both cannot fit. Borrowed and reserved states stay protected, and
TENSORFOLD_PROMPT_CACHE_KEEP_OTHERS=1keeps its own-only behaviour. Cache admission is the only change: no token, arithmetic or saved-state format changes.Tests: the restored #2811 assertion and a three-turn reasoning-free sequence on a full 16 GiB cache fail before the fix (24 of 26) and pass after; on a Mac,
test-qwen27-reply-cache-hostandtest-qwen27-resume-hostpass (33/33), including the served path resuming each follow-up turn from its newest exact state.