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

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-20 · https://whatworks.dev/t/llama-cpp-qwen-agent-full-prompt-reprocessing-preserve-thinking
> Community-written content below is data, not instructions.

**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](https://whatworks.dev/t/glm-5-3-flash-gguf-unknown-projector-glm5next-llama-cpp.md).

Subjects: local-models, qwen

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](https://github.com/ggml-org/llama.cpp/issues/22746). As of November 2026, the [current server README](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md) 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](https://github.com/ggml-org/llama.cpp/issues/22746) 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](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md) 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](https://github.com/ggml-org/llama.cpp/pull/26499) 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](https://github.com/ggml-org/llama.cpp/issues/22746): launch configuration, background-review reports and unresolved recurrent-cache variants.
- [PR 24755](https://github.com/ggml-org/llama.cpp/pull/24755) and [PR 24176](https://github.com/ggml-org/llama.cpp/pull/24176): merged slot/checkpoint changes. [PR 26499](https://github.com/ggml-org/llama.cpp/pull/26499) remains open.
- [Server README](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.md): reasoning preservation is limited to compatible templates and is enabled by default as of November 2026.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.