| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found related PRs that deal with thinking/reasoning blocks, but they appear to be addressing different issues: Related PRs (not exact duplicates):
These are related to thinking/reasoning blocks but address model switching scenarios, whereas PR #12131 focuses on preserving the integrity of redacted_thinking blocks during message processing and multi-turn conversations. No exact duplicate PRs found - PR #12131 appears to be the only one addressing the specific issue of signature validation and block ordering for extended thinking with Claude. |
Sorry, something went wrong.
There was a problem hiding this comment.
I went through an AI assisted code review of this PR, as I've faced similar issues with OpenRouter models and was hoping this may help indirectly. Unfortunately, it appears it doesn't, however, it also doesn't impact other model providers. Here is the summary of my AI assisted code review:
This PR fixes signature validation errors when using extended thinking with Claude by removing overly strict handling of redacted_thinking blocks.
Lines 44-85 - normalizeMessages() function:
Lines 586-596 - toModelMessages() function:
Lines 88-104 - reasoning-end case:
Lines 968-991 - File handling:
New file: Test to ensure prompt does not fail when a file part is missing
UI/UX improvements: More robust session menu interactions and state management
Approve with caution. The changes fix a known issue with extended thinking on Claude, but the removal of strict redacted_thinking block handling should be monitored for any unexpected side effects.
Sorry, something went wrong.
The Anthropic API computes a cryptographic signature on the exact thinking text including trailing whitespace. Calling trimEnd() invalidates the signature, causing "Invalid data in redacted_thinking block" errors when thinking blocks are replayed in subsequent API calls. Closes anomalyco#10970
The Anthropic API requires thinking/redacted_thinking blocks to appear before other content blocks in assistant messages. Add reordering logic in normalizeMessages() and preserve all reasoning blocks including redacted_thinking in toModelMessages(). Ref anomalyco#10970
|
@thdxr @adamdotdevin (just tagging some subset of contributors who seem like they're working on opencode) Can this PR get reviewed and merged? We've been encountering similar issues with redacted thinking block errors for a few weeks, and spent some time triaging it to discover the same bugs as described here still present in the latest version. There's also this PR related to thinking block issues when compaction happens: #14393 |
Sorry, something went wrong.
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fix "Invalid data in redacted_thinking block" errors when using extended thinking with Claude.
Problem
When extended thinking is enabled, the Anthropic API returns thinking and redacted_thinking blocks with cryptographic signatures. Two issues caused these blocks to be rejected on subsequent API calls:
Changes
Testing
Reproduced the error by enabling extended thinking (High) with Claude Opus 4.5, triggering the error on the 2nd message of a session. After the fix, multi-turn conversations with extended thinking work without errors.
Closes #10970