Backport: fix(amazon-bedrock): drop foreign-provider reasoning blocks instead of sending them unsigned#14882
Merged
gr2m merged 2 commits intorelease-v6.0from Apr 30, 2026
Merged
Conversation
…f sending them unsigned (#14765) ## Background When a conversation contains reasoning blocks signed by a different provider (e.g. Anthropic-signed reasoning replayed through Bedrock during cross-provider fallback), the converter pushes the reasoning text without a signature, and Bedrock's converse API rejects the request with: messages.N.content.M.thinking.signature: Field required `@ai-sdk/anthropic` already handles the symmetric case gracefully — it drops unrecognized reasoning metadata and emits a warning. ## Fix In the `case 'reasoning'` branch of `convertToBedrockChatMessages`, only fall through to the unsigned-reasoning push when `providerOptions` is empty or contains exclusively the `bedrock` key. Foreign-provider metadata (e.g. `anthropic`) causes the block to be dropped instead. This preserves the existing prefill behavior introduced in #13972 while fixing the cross-provider replay case. ## Repro A conversation that has assistant turns with `providerOptions.anthropic` on its reasoning parts, sent through `bedrock(...).doStream(...)`, currently reproduces the validation error. The added test covers this. After gh pr create runs, it'll print the PR URL. CI will run automatically; the CLA bot will comment with a sign link if you haven't signed before. Co-authored-by: asdf <asdfsdf>
gr2m
approved these changes
Apr 30, 2026
Two new tests called the non-existent `convertToAmazonBedrockChatMessages` and one used `providerOptions.amazonBedrock` (which the source does not parse for signatures), so both failed at runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
|
gr2m
added a commit
that referenced
this pull request
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated backport of #14765 to the release-v6.0 branch. FYI @thestonechat