Skip to content

[Bug]: thinking/redacted_thinking blocks get modified during context compaction → API 400 error #25347

@ManniGee68

Description

@ManniGee68

Summary

Version: 2026.2.23
Platform: macOS (Mac mini M2)
Regression: worked correctly before 2026.2.23
Description
Since upgrading to 2026.2.23, longer conversations regularly fail with the following API error:

LLM request rejected: messages.51.content.1: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.

The error occurs consistently in sessions with extended history. The Anthropic API requires that thinking and redacted_thinking content blocks are passed through unmodified in subsequent requests. It appears that the updated compaction or reasoning logic introduced in 2026.2.23 is altering or stripping these blocks when managing conversation history.

Steps to reproduce

Steps to Reproduce
1. Use a Claude model with thinking/extended thinking enabled (default behavior)
2. Have a longer conversation (50+ messages)
3. Context compaction triggers
4. Next API request fails with the error above

Expected behavior

Expected Behavior
thinking and redacted_thinking blocks in assistant messages must be passed through to the API exactly as received — unmodified and unremoved.

Actual behavior

Actual Behavior
The blocks appear to be modified or restructured during compaction, causing the Anthropic API to reject the request with a 400 error.

OpenClaw version

Version: 2026.2.23

Operating system

MacOS 26.2

Install method

npm MacMini

Logs, screenshots, and evidence

Anthropics API documentation explicitly states: “thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.”

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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