Skip to content

Bug: Empty thinking-block signatures poison Anthropic Messages sessions (fix from #70054 not applied to standard Anthropic transport) #86886

Description

@tweetodavid

Bug: Empty thinking-block signatures poison Anthropic Messages sessions — fix from #70054 not applied to standard Anthropic transport

OpenClaw version: 2026.5.22
Provider: anthropic / anthropic-messages (direct Anthropic API, not Bedrock)
Model: claude-sonnet-4-6
Thinking level: medium


What happened

A user session with thinking_level: medium generated several assistant turns containing thinking blocks. The thinking blocks were persisted to the session JSONL with empty signatures ("signature": ""). On every subsequent turn the session was completely broken — every request failed immediately with:

LLM request rejected: messages.5.content.0: Invalid `signature` in `thinking` block

The session was permanently bricked. The user received no response and no error message. The only fix was to manually strip all thinking blocks from the raw JSONL transcript.


Root cause

Thinking blocks with empty/blank signatures are being persisted to the JSONL session transcript. When these are replayed to the Anthropic API on follow-up turns, Anthropic rejects the empty signature.


Why the existing fix doesn't help

Fix #70054 (released in 2026.4.25) addresses exactly this problem — "strip thinking blocks with missing, empty, or blank replay signatures before provider conversion" — but it is scoped to Agents/Anthropic/Bedrock only.

The standard anthropic-messages transport (direct Anthropic API) does not have the same guard. Sessions using direct Anthropic (not Bedrock) are still vulnerable to this issue.


Steps to reproduce

  1. Open a session with thinking_level: medium using anthropic/claude-sonnet-4-6 (direct Anthropic, not Bedrock)
  2. Have the agent produce several turns with tool calls (tool-call turns seem to be where signatures go missing)
  3. The JSONL will contain thinking blocks with "signature": ""
  4. Any subsequent turn in that session will fail with the Invalid signature error

Expected behavior

The same guard applied in #70054 for Bedrock should also be applied in the standard anthropic-messages transport: thinking blocks with missing, empty, or blank signatures should be stripped (or replaced with an omitted-reasoning placeholder) before sending to the API.


Additional context

  • The fix for Bedrock is at: Agents/Anthropic/Bedrock: strip thinking blocks with missing, empty, or blank replay signatures before provider conversion (CHANGELOG line ~4589)
  • The same logic needs to be applied to the equivalent path in the non-Bedrock Anthropic Messages transport
  • Discovered while running an agent session where the user (widget:user role) had thinking inadvertently enabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions