Skip to content

Compaction fails: thinking/redacted_thinking blocks cannot be modified #45558

@assimetria-ai

Description

@assimetria-ai

Bug

During session compaction, assistant messages containing thinking or redacted_thinking blocks are modified (summarized/trimmed). The Anthropic API rejects this:

messages.131.content.7: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.

Root Cause

Compaction rewrites/summarizes assistant messages, but Anthropic requires thinking blocks to remain exactly as generated. The compactor needs to either:

  1. Strip thinking blocks entirely before compaction
  2. Preserve thinking blocks verbatim when summarizing surrounding content
  3. Replace the entire message (including thinking) with a plain text summary

Impact

  • Blocks LLM responses until compaction retries or session resets
  • User sees raw error message in Telegram
  • Happens more frequently with large sessions and adaptive thinking enabled

Environment

  • OpenClaw 2026.3.1 (2a8ac97)
  • Model: claude-opus-4-6 with thinking=adaptive
  • Compaction mode: default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions