openclaw - 💡(How to fix) Fix [Bug]: Auto-compaction corrupts Anthropic thinking-block signatures, bricks affected sessions

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…

After an embedded auto-compaction event in OpenClaw 2026.5.19, all subsequent Anthropic API calls in the affected session fail with Invalid signature in thinking block, rendering the session permanently unusable until the corrupted thinking block is manually removed from the session JSONL file.

Error Message

  1. The Anthropic API rejects the request with messages.<N>.content.<M>: Invalid signature in thinking block, and every subsequent message in that session hits the same error. The exact messages.<N>.content.<M> indices vary by session. The session becomes permanently unusable: OpenClaw delivers the API error verbatim to the channel, and no recovery happens automatically. The only workarounds observed: (1) /reset the session (loses context), or (2) manually edit the session JSONL file to remove the offending thinking content block (preserves context). User-visible error received in Telegram channel on every subsequent message: Severity: High — affected sessions become unusable end-to-end; the user sees only the raw API error, with no autonomous recovery.

Root Cause

After an embedded auto-compaction event in OpenClaw 2026.5.19, all subsequent Anthropic API calls in the affected session fail with Invalid signature in thinking block, rendering the session permanently unusable until the corrupted thinking block is manually removed from the session JSONL file.

Fix Action

Fix / Workaround

The exact messages.<N>.content.<M> indices vary by session. The session becomes permanently unusable: OpenClaw delivers the API error verbatim to the channel, and no recovery happens automatically. The only workarounds observed: (1) /reset the session (loses context), or (2) manually edit the session JSONL file to remove the offending thinking content block (preserves context).

  • Last known good version: NOT_ENOUGH_INFO (this is the first version we observed the issue on; we did not run the same workload on a prior version).
  • Workaround: manually remove the broken thinking content block from the offending message in the session JSONL file (path: ~/.openclaw/agents/<agentId>/sessions/<sessionKey>.jsonl). Preserves context but is not sustainable.
  • Note: lowering or disabling thinking mode would avoid the problem but degrades agent capability and is not an acceptable long-term workaround.

Code Example

Gateway startup confirming model+thinking config:
  [gateway] agent model: anthropic/claude-haiku-4-5 (thinking=medium, fast=off)

Auto-compaction event preceding the failure:
  2026-05-20T19:40:58 [openclaw] embedded run auto-compaction start

User-visible error received in Telegram channel on every subsequent message:
  Quinn: LLM request rejected: messages.37.content.15: Invalid signature in thinking block
  Michael: Quinn, what is wrong?
  Quinn: LLM request rejected: messages.37.content.15: Invalid signature in thinking block

Recovery via surgical removal of session JSONL message[37].content[15] (`thinking` block) restored session function with full conversational context preserved.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

After an embedded auto-compaction event in OpenClaw 2026.5.19, all subsequent Anthropic API calls in the affected session fail with Invalid signature in thinking block, rendering the session permanently unusable until the corrupted thinking block is manually removed from the session JSONL file.

Steps to reproduce

  1. Install OpenClaw 2026.5.19 (npm global, native Windows).
  2. Configure an agent with anthropic/claude-haiku-4-5 and thinking=medium.
  3. Use the agent in a long-running session via the Telegram channel until context size triggers an embedded auto-compaction (gateway log shows embedded run auto-compaction start).
  4. After auto-compaction completes, send any new user message in the same session.
  5. The Anthropic API rejects the request with messages.<N>.content.<M>: Invalid signature in thinking block, and every subsequent message in that session hits the same error.

Expected behavior

Auto-compaction should leave the session in a state that is valid for the Anthropic API. Acceptable approaches: (a) preserve thinking content blocks byte-exact along with their original signatures during compaction; or (b) drop thinking blocks from compacted history (Anthropic does not require historical thinking blocks in subsequent message turns); or (c) expose a configuration option (e.g., messages.thinkingInHistory: false) so operators can opt out of including thinking blocks in submitted history.

In all cases the session should remain usable across compactions without manual intervention.

Actual behavior

After an embedded run auto-compaction start event in the gateway log, the next user message and every subsequent message returns from the Anthropic API as:

LLM request rejected: messages.37.content.15: Invalid signature in thinking block

The exact messages.<N>.content.<M> indices vary by session. The session becomes permanently unusable: OpenClaw delivers the API error verbatim to the channel, and no recovery happens automatically. The only workarounds observed: (1) /reset the session (loses context), or (2) manually edit the session JSONL file to remove the offending thinking content block (preserves context).

OpenClaw version

2026.5.19 (a185ca2)

Operating system

Windows 11 Pro (Build 26200)

Install method

npm global (npm install -g openclaw)

Model

anthropic/claude-haiku-4-5

Provider / routing chain

openclaw -> anthropic (direct, no gateway proxy)

Additional provider/model setup details

  • Anthropic API key configured via agents/main/agent/auth-profiles.json (provider: anthropic, mode: api_key).
  • Agent runs with thinking=medium (per gateway startup log: agent model: anthropic/claude-haiku-4-5 (thinking=medium, fast=off)).
  • No proxy or model router in front of Anthropic.

Logs, screenshots, and evidence

Gateway startup confirming model+thinking config:
  [gateway] agent model: anthropic/claude-haiku-4-5 (thinking=medium, fast=off)

Auto-compaction event preceding the failure:
  2026-05-20T19:40:58 [openclaw] embedded run auto-compaction start

User-visible error received in Telegram channel on every subsequent message:
  Quinn: LLM request rejected: messages.37.content.15: Invalid signature in thinking block
  Michael: Quinn, what is wrong?
  Quinn: LLM request rejected: messages.37.content.15: Invalid signature in thinking block

Recovery via surgical removal of session JSONL message[37].content[15] (`thinking` block) restored session function with full conversational context preserved.

Impact and severity

Affected: any agent session that triggers OpenClaw's embedded auto-compaction while using an Anthropic model with thinking enabled. Severity: High — affected sessions become unusable end-to-end; the user sees only the raw API error, with no autonomous recovery. Frequency: Reproducible. Occurred 1/1 observed compaction event in a long-running Telegram session. Consequence: Session loses all forward progress; operator must either reset the session (losing all conversation context and the value built up in it) or manually edit the session's JSONL state to surgically remove the corrupted thinking content block.

Additional information

  • Last known good version: NOT_ENOUGH_INFO (this is the first version we observed the issue on; we did not run the same workload on a prior version).
  • Workaround: manually remove the broken thinking content block from the offending message in the session JSONL file (path: ~/.openclaw/agents/<agentId>/sessions/<sessionKey>.jsonl). Preserves context but is not sustainable.
  • Note: lowering or disabling thinking mode would avoid the problem but degrades agent capability and is not an acceptable long-term workaround.

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…

FAQ

Expected behavior

Auto-compaction should leave the session in a state that is valid for the Anthropic API. Acceptable approaches: (a) preserve thinking content blocks byte-exact along with their original signatures during compaction; or (b) drop thinking blocks from compacted history (Anthropic does not require historical thinking blocks in subsequent message turns); or (c) expose a configuration option (e.g., messages.thinkingInHistory: false) so operators can opt out of including thinking blocks in submitted history.

In all cases the session should remain usable across compactions without manual intervention.

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 [Bug]: Auto-compaction corrupts Anthropic thinking-block signatures, bricks affected sessions