openclaw - 💡(How to fix) Fix Thinking block signature expiry causes session-fatal loop (no automatic recovery)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When adaptive thinking is enabled, Anthropic signs each thinking block with a time-limited signature. If a session runs long enough that old thinking blocks are still present in the active transcript when the next request fires, Anthropic rejects the entire request with:

LLM request rejected: messages.69.content.6: Invalid signature in thinking block

Session-fatal — recoverable with /new, no data loss to MEMORY.md or workspace files.


Error Message

  1. Anthropic rejects with signature error above Fix 1 (best — runtime fix): Before building the API request, scan thinking blocks in the transcript and strip any whose signatures are expired or near expiry. If a stripped block was the only content in that message, replace it with a placeholder. This is transparent to the user and prevents the error class entirely. Fix 2 (good — runtime fix): Catch the Invalid signature in thinking block API error and automatically retry the request with thinking blocks stripped from the transcript. Surface a brief notice to the user ("Compacted stale thinking blocks — continuing"). This is a recovery path rather than prevention.

Root Cause

Anthropic thinking blocks carry signatures that expire after some time window (exact TTL unknown — not documented publicly). OpenClaw's existing transcript hygiene does not strip or age-check thinking block signatures before replaying the transcript to the API.

The existing safeguards don't help:

  • maxActiveTranscriptBytes: 6mb — the session was only 1.8MB; this never fired
  • Pi's token-count compaction threshold (contextTokens > contextWindow - reserveTokens) — the session was well within the context window; this never fired either
  • Neither guard is time-aware, so neither catches the signature-age problem

Fix Action

Fix / Workaround

Fix 3 (workaround — config): Expose a compaction.reserveTokens config knob (or equivalent) that lets users force more aggressive compaction so thinking blocks are summarized away before they expire. This is a proxy fix — it works because compaction replaces raw thinking blocks with a text summary, eliminating the signed blocks. This is what we are doing as a stopgap pending Fix 1 or Fix 2.

Current Workaround

Limitation: This workaround only helps during active sessions where token accumulation triggers compaction. It does not address the idle-session case — if a session goes idle for hours without reaching the compaction threshold, old thinking blocks can still expire in place and cause the same failure on the next message.

Code Example

LLM request rejected: messages.69.content.6: Invalid signature in thinking block
RAW_BUFFERClick to expand / collapse

Bug Report: Thinking Block Signature Expiry Causes Hard Session Failure

Reported: May 24, 2026
Reporter: Stan Dennison (Mak agent on AboveBook)
OpenClaw version: 2026.5.18 (50a2481)
Model: anthropic/claude-sonnet-4-6


Summary

When adaptive thinking is enabled, Anthropic signs each thinking block with a time-limited signature. If a session runs long enough that old thinking blocks are still present in the active transcript when the next request fires, Anthropic rejects the entire request with:

LLM request rejected: messages.69.content.6: Invalid signature in thinking block

Session-fatal — recoverable with /new, no data loss to MEMORY.md or workspace files.


Steps to Reproduce

  1. Enable adaptive thinking on a main session (default for sonnet-4-6 with thinking=adaptive)
  2. Have a long-running session (several hours) with tool calls and extended thinking turns
  3. Leave the session idle for a period
  4. Send a new message — the runtime replays the full transcript including old thinking blocks
  5. Anthropic rejects with signature error above

Impact

  • Seen twice on the same instance within 48 hours:
    • Instance 1 (May 22, 2026): Crash at ~1:33am CDT. Session started sometime May 21 evening. Elapsed time unconfirmed — session file deleted at crash.
    • Instance 2 (May 24, 2026): Crash at ~1:31am CDT. Session file 82347fb1-370e-4abd-a736-6522a425f9c2.jsonl was 1.8MB at failure. Previous session ended 00:01 CDT (minimum ~90 min elapsed); actual session start likely earlier on May 23 given file size.
  • Both failures required manual /new to recover
  • No data loss to MEMORY.md or workspace files; session context lost since last compaction

Root Cause

Anthropic thinking blocks carry signatures that expire after some time window (exact TTL unknown — not documented publicly). OpenClaw's existing transcript hygiene does not strip or age-check thinking block signatures before replaying the transcript to the API.

The existing safeguards don't help:

  • maxActiveTranscriptBytes: 6mb — the session was only 1.8MB; this never fired
  • Pi's token-count compaction threshold (contextTokens > contextWindow - reserveTokens) — the session was well within the context window; this never fired either
  • Neither guard is time-aware, so neither catches the signature-age problem

Proposed Fixes (in order of preference)

Fix 1 (best — runtime fix): Before building the API request, scan thinking blocks in the transcript and strip any whose signatures are expired or near expiry. If a stripped block was the only content in that message, replace it with a placeholder. This is transparent to the user and prevents the error class entirely.

Fix 2 (good — runtime fix): Catch the Invalid signature in thinking block API error and automatically retry the request with thinking blocks stripped from the transcript. Surface a brief notice to the user ("Compacted stale thinking blocks — continuing"). This is a recovery path rather than prevention.

Fix 3 (workaround — config): Expose a compaction.reserveTokens config knob (or equivalent) that lets users force more aggressive compaction so thinking blocks are summarized away before they expire. This is a proxy fix — it works because compaction replaces raw thinking blocks with a text summary, eliminating the signed blocks. This is what we are doing as a stopgap pending Fix 1 or Fix 2.


Current Workaround

We are setting agents.defaults.compaction.reserveTokens: 150000 (or 100000) to trigger compaction at ~50k–100k contextTokens, well before thinking blocks age out. This causes more frequent compaction but eliminates the failure mode.

Limitation: This workaround only helps during active sessions where token accumulation triggers compaction. It does not address the idle-session case — if a session goes idle for hours without reaching the compaction threshold, old thinking blocks can still expire in place and cause the same failure on the next message.


Additional Context

  • The bug is deterministic once a session runs long enough — it always reproduces
  • Thinking blocks appear at high density in heavy tool-call sessions (each turn may produce one)
  • The 1.8MB session file size at failure corresponds to roughly 30-40 turns with frequent tool use
  • Disabling adaptive thinking entirely avoids the issue but degrades diagnostic quality — not an acceptable long-term fix

Filed by Stan Dennison — West Plains, MO — [email protected]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Thinking block signature expiry causes session-fatal loop (no automatic recovery)