Skip to content

qwen27 metal: pin the reply history with a full cache again (fixes #5141) - #5154

Merged
ashhart merged 5 commits into
mainfrom
lead/qwen27-reply-history-pin
Nov 26, 2026
Merged

ashhart merged 5 commits into
mainfrom
lead/qwen27-reply-history-pin

Conversation

@ashhart

@ashhart ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

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=1 keeps 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-host and test-qwen27-resume-host pass (33/33), including the served path resuming each follow-up turn from its newest exact state.

  • Synthena

@ashhart
ashhart force-pushed the lead/qwen27-reply-history-pin branch from be9e03c to f671f9f Compare November 26, 2026 05:39
@ashhart
ashhart merged commit f5736b4 into main Nov 26, 2026
2 of 12 checks passed
@ashhart
ashhart deleted the lead/qwen27-reply-history-pin branch November 26, 2026 05:40
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.

Prompt cache: once the cache is full, clients that drop reasoning miss on every follow-up again (regression since 1.2.10, still in 1.3.5)

1 participant