-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
Bug: thinking/redacted_thinking blocks exposed to chat on context pruning #49573
Copy link
Copy link
Description
Bug Report
Description
When a long session triggers context pruning (cache-ttl mode), Anthropic API rejects the request with:
LLM request rejected: messages.N.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.
This error message is then sent directly to the chat channel (Telegram group in this case), exposing internal error details to end users.
Steps to Reproduce
- Have a long multi-turn conversation (60+ messages)
- Context pruning kicks in (
contextPruning.mode: cache-ttl) - A prior assistant message contains thinking blocks
- Pruning attempts to modify/truncate that message
- Anthropic API rejects → error surfaces in chat
Expected Behavior
- Error should be caught internally and handled gracefully
- Either: silently retry without the problematic message, or restart the session context
- Error should NOT be sent to the end-user chat channel
Actual Behavior
Raw API error string is sent as a chat message to the active channel (Telegram group chat).
Config
{
"contextPruning": {
"mode": "cache-ttl",
"ttl": "1h"
}
}Impact
- Confusing UX for end users in group chats
- Exposes internal system details publicly
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.