| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…tended thinking Three bugs corrupt reasoning block data when using Claude models via OpenRouter with extended thinking enabled: 1. trimEnd() on reasoning text mutates the text after Anthropic signs it, causing "thinking blocks cannot be modified" on subsequent turns. 2. Both tool-call and reasoning parts push into accumulatedReasoningDetails in the OpenRouter SDK message converter, producing duplicate thinking blocks that Anthropic rejects. 3. providerMetadata assignment (=) overwrites previously stored signature data when later delta/end events arrive with different metadata, causing "Invalid signature in thinking block". Fixes: remove trimEnd from reasoning-end handler, disable the tool-call case push in the SDK patch (reasoning case is the canonical source), and use Object.assign to merge providerMetadata instead of overwriting it.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found potential related PRs: Potentially Related PR:
Note: The PR description mentions potentially related issues #18078 and #18254, which may also be worth reviewing for context. The search didn't reveal any active duplicate PRs addressing the same OpenRouter reasoning block signature corruption issue. PR #19048 appears to be the primary fix for this issue. |
Sorry, something went wrong.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Issue for this PR
Fixes #18078
Related: #18254
Type of change
What does this PR do?
Fixes three bugs that corrupt reasoning block data when using Claude models via OpenRouter with extended thinking enabled:
trimEnd() on reasoning text mutates the text after Anthropic signs it, causing "thinking blocks cannot be modified" on subsequent turns.
Both the tool-call and reasoning cases push into accumulatedReasoningDetails in the OpenRouter SDK message converter, producing duplicate thinking blocks that Anthropic rejects.
providerMetadata assignment (=) overwrites previously stored signature data when later delta/end events arrive with different metadata, causing "Invalid signature in thinking block".
Fixes: remove trimEnd from the reasoning-end handler, disable the tool-call case push in the SDK patch (the reasoning case is the canonical source), and use Object.assign to merge providerMetadata instead of overwriting it.
How did you verify your code works?
Tested multi-turn conversations with Claude via OpenRouter with extended thinking enabled. Verified that reasoning signatures are preserved correctly across streaming events and that conversation history replays no longer produce signature validation errors.
Screenshots / recordings
N/A - no UI changes.
Checklist