-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
Gateway crash corrupts session history: thinking blocks become unrecoverable #25194
Copy link
Copy link
Description
Bug Report
Summary
When the OpenClaw gateway crashes while a session has thinking mode enabled (thinking=low or higher), the session becomes permanently unrecoverable. Every subsequent message returns:
LLM request rejected: messages.17.content.57: 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 only fix is /reset to discard the entire session history.
Steps to Reproduce
- Have a session with thinking mode enabled (default:
thinking=lowon claude-sonnet-4-6) - Exchange several messages so thinking blocks accumulate in session history
- Crash the gateway (e.g. via an invalid config value, unhandled exception, etc.)
- Gateway restarts and reconstructs sessions from stored history
- Send any message in the affected session
Expected Behavior
Session history is reconstructed with thinking blocks preserved exactly as-is (required by Anthropic API). Session continues normally.
Actual Behavior
Thinking blocks are dropped or modified during session reconstruction after crash. Every subsequent API call is rejected by Anthropic with the error above. Session is permanently broken until /reset.
Why This Matters
- A crash that isn't the user's fault (or is, as in my case — a bad config value) should not permanently destroy an active session
- The error message gives no indication that
/resetis the fix — users will retry, get the same error, and be stuck in a loop - This is a reliability/safety issue: any unclean gateway shutdown can silently corrupt sessions
Suggested Fixes
- During session reconstruction: Preserve thinking blocks byte-for-byte from stored history. Do not strip or summarize them.
- Or: detect the error and auto-recover: If an API call returns this specific error, offer to strip history back to before the last thinking block (with user confirmation) or auto-
/reset - Immediate UX fix: When this error occurs, reply to the user with a human-readable explanation and
/resetsuggestion instead of forwarding the raw API error
Environment
- OpenClaw version: pinned at
076df941a3265067802e0951a4233cfb7e8597ea - Model:
anthropic/claude-sonnet-4-6 - Channel: Telegram
- Thinking mode:
low(default)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.