Platform
OpenClaw / Pi Agent
context-mode version
1.0.53
Full doctor output (REQUIRED)
## context-mode doctor
- [x] Runtimes: 8/11 (73%) — javascript, shell, typescript, python, ruby, go, php, perl
- [x] Performance: FAST (Bun)
- [x] Server test: PASS
- [x] FTS5 / SQLite: PASS — native module works
- [x] Hook script: PASS — hooks/pretooluse.mjs
- [x] Version: v1.0.53
Exact prompt that triggered the bug (REQUIRED)
No specific prompt triggers it — it occurs when the conversation is long enough to trigger compaction. The compaction hook fires, OpenClaw truncates conversation history, and the next API call to Anthropic fails because `thinking` / `redacted_thinking` blocks in the truncated history were modified.
Typical trigger: a session with 15+ tool calls using Anthropic `claude-opus-4-6` with extended thinking enabled. After compaction, the next user message triggers the error.
Full error output (REQUIRED)
LLM request rejected: messages.13.content.10: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.
Steps to reproduce (REQUIRED)
- Install context-mode v1.0.53 as OpenClaw native plugin (
npm run install:openclaw)
- Configure OpenClaw with an Anthropic model that has extended thinking enabled (e.g.
claude-opus-4-6 with thinkingDefault: "xhigh")
- Start a conversation and make many tool calls (15+) to grow the context window
- Wait for compaction to trigger (context-mode's
before_compaction hook fires)
- Send another message after compaction
- Anthropic API rejects the request with the thinking block validation error above
What have you tried to fix it?
- Verified OpenClaw is on v2026.3.24 which includes the fix for a similar issue in a different code path (#52961: "preserve latest assistant thinking and redacted-thinking block ordering during transcript image sanitization")
- Searched context-mode source code:
git log --all --oneline --grep='thinking' returns 0 results, rg 'thinking|redacted_thinking' src/ build/ returns 0 matches — there is zero handling of thinking blocks anywhere in the codebase
- The compaction logic (
compact() returning firstKeptEntryId) has no awareness of Anthropic's thinking block constraints
- Using
/new to reset the session before compaction triggers is a workaround but not a fix
Pre-submission checklist
Operating System
Linux (Ubuntu/Debian)
JS Runtime
node v22.21.0, bun 1.3.10
Platform
OpenClaw / Pi Agent
context-mode version
1.0.53
Full doctor output (REQUIRED)
Exact prompt that triggered the bug (REQUIRED)
Full error output (REQUIRED)
Steps to reproduce (REQUIRED)
npm run install:openclaw)claude-opus-4-6withthinkingDefault: "xhigh")before_compactionhook fires)What have you tried to fix it?
git log --all --oneline --grep='thinking'returns 0 results,rg 'thinking|redacted_thinking' src/ build/returns 0 matches — there is zero handling of thinking blocks anywhere in the codebasecompact()returningfirstKeptEntryId) has no awareness of Anthropic's thinking block constraints/newto reset the session before compaction triggers is a workaround but not a fixPre-submission checklist
Operating System
Linux (Ubuntu/Debian)
JS Runtime
node v22.21.0, bun 1.3.10