#6460 [Engine] Claude Code auto-compaction returns an empty summary near the context limit unless `anthropic_thinking` is `on_request`

open · @ThatsR4d · 0 コメント · GitHub で見る

BenchmarksSetup & installServer & APINVIDIA / CUDAModels & quantsLinux

本文

### Area

[Engine]  (speed, kernels, models, the server and API)

### Desktop app, Terminal or source?

Terminal (the `strata` command)

### What happened

Claude Code 2.1.328 against Strata's `/v1/messages`: when a long session reaches its compaction point (~250K tokens with `CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144`), the compaction fails with `compact_result: failed, compact_error: "summarization produced empty response"`, the next request is "Prompt is too long", and the session ends. Seen on Terminal-Bench 2.1 `make-mips-interpreter` after ~56 min of work.

Claude Code's summary request asks for no thinking. With the default `anthropic_thinking` (as the template) Strata thinks anyway, and near the context limit the little output room left goes to the thinking, so the summary text is empty.

Fix: `"anthropic_thinking": "on_request"` in the run config (we also set `"reasoning_close_retry": true`). Verified afterwards:
- Claude Code's main turns still think (they request it), helper requests do not.
- Manual `/compact` at 130K: 130K -> 4.9K tokens in 24 s, summary correct.
- Automatic compaction at the limit: 257K -> 14K tokens in 43 s, the session continued and answered a question about content from before the compaction correctly.

(We did not re-run the old default at 257K for a strict A/B; the failure above is the "before".)

DETAILS.md already says Claude Code's short helper calls need `on_request`. Suggestion: make `strata connect claude-code` (or setup, when the Anthropic endpoint is used) write `"anthropic_thinking": "on_request"`, or make it the default for `/v1/messages`.

### Smallest steps or command that reproduce it

1. Default run config (no `anthropic_thinking` key), `ANTHROPIC_BASE_URL=http://127.0.0.1:8080`, `CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144`.
2. `claude -p` a task that reads ~14 files of ~19K tokens each (fills the context to the compaction point).
3. stream-json shows `"compact_result": "failed"` / "summarization produced empty response".

### Reproduction status

Reproduced locally

### Strata version

Strata 0.2.16 / engine 0.1.62 (failure and fix both seen there; 0.2.17 has the same default)

### Graphics card, memory and system

RTX 4090 24 GB, i9-14900K, 128 GB DDR5, Ubuntu 26.04 (Linux 7.0), driver 615

### Model, size and settings

Qwen3.8-Flash-Next IQ3_S (GSQ-RCO) and Unsloth UD-Q3_K_XL, 262K context, DFlash2; Claude Code 2.1.328, effort medium

関連リンク

インストール・モデル・リリースへのサイト内リンク。