published fresh until

llama.cpp re-reads the whole prompt every turn with Qwen 3.6: why?

Summary As of November 2026, preserve reasoning and keep the prompt prefix stable for Qwen agent loops. The [recurrent-state override PR](https://github.com/ggml-org/llama.cpp/pull/26499) remains open. As of November 2026, llama.cpp documents --reasoning-preserve as enabled by default.

Not for llama.cpp refusing to load a GGUF; see glm-5-3-flash-gguf-unknown-projector-glm5next-llama-cpp.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of November 2026, keep reasoning and the prompt prefix stable for cache reuse. Do first: use the Qwen preserve_thinking template setting described in the issue. As of November 2026, the current server README lists --reasoning-preserve as enabled by default.

The problem

Running Qwen 3.6 27B in llama-server behind an agent harness (OpenCode in the report), llama.cpp reprocesses the entire prompt on every turn instead of reusing the cache. The GitHub issue was opened by tarunkapadia-2266 on 2026-05-06 (ROCm build, 131072 context, q8_0 KV cache). It was closed on 2026-08-04. This is a contested thread, so the limits are spelled out below.

Template and prompt preservation

The issue's launch configuration includes the Qwen preserve_thinking setting. As of November 2026, the current llama-server README lists --reasoning-preserve / --no-reasoning-preserve with an enabled default. Do not assume every model preserves earlier reasoning automatically.

Fixes mentioned and merged

PR #24755 (slot selection, merged 2026-06-19) and PR #24176 (checkpoints at every user message, merged 2026-06-23) address cache-related behavior. Both pull requests are merged; that does not establish a result for every harness.

What commenters added (not confirmed)

  • A commenter said that in an agent that runs background review turns on a single slot, those turns invalidate the cache, and disabling the review nudge in that agent's config fixed it. It is that agent's setting, not a llama.cpp one.
  • Commenters in August 2026 reported a cannot roll into cache log line with recurrent models and posted their own analysis of a snapshot bug. A collaborator pointed to a simpler pull request (#26499, an environment override for n_rs_seq), still open as of November 2026.

Checklist

1. Start the server with --chat-template-kwargs '{"preserve_thinking":true}' for Qwen 3.6 agent loops. 2. Keep the system prompt and tool list stable across turns; changes can reduce cache reuse. 3. Use a current llama.cpp build, since several cache fixes landed after the report. 4. If it still reprocesses, capture the prompts with the server's prompt logging and attach them to a new issue.

Limits

The issue did not end with an agreed single root cause; the recommendations come from maintainers and commenters.

Sources

  • Issue 22746: launch configuration, background-review reports and unresolved recurrent-cache variants.
  • PR 24755 and PR 24176: merged slot/checkpoint changes. PR 26499 remains open.
  • Server README: reasoning preservation is limited to compatible templates and is enabled by default as of November 2026.

Started from a post by @tarunkapadia-2266, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# llama.cpp re-reads the whole prompt every turn with Qwen 3.6: why?
Summary: As of November 2026, preserve reasoning and keep the prompt prefix stable for Qwen agent loops. The [recurrent-state override PR](https://github.com/ggml-org/llama.cpp/pull/26499) remains open. As of November 2026, llama.cpp documents `--reasoning-preserve` as enabled by default.
Copy for agent
get the whatworks thread llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks