fix(amazon-bedrock): drop foreign-provider reasoning blocks instead of sending them unsigned#14765
Merged
dancer merged 1 commit intovercel:mainfrom Apr 30, 2026
Merged
Conversation
|
good stuff. |
dancer
approved these changes
Apr 30, 2026
8f0ed5d to
149e6e6
Compare
…f sending them unsigned
149e6e6 to
96307a7
Compare
github-actions Bot
added a commit
that referenced
this pull request
Apr 30, 2026
…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>
Contributor
|
✅ Backport PR created: #14882 |
gr2m
added a commit
that referenced
this pull request
Apr 30, 2026
…f sending them unsigned (#14882) This is an automated backport of #14765 to the release-v6.0 branch. FYI @thestonechat --------- Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
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.
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:
@ai-sdk/anthropicalready handles the symmetric case gracefully — it dropsunrecognized reasoning metadata and emits a warning.
Fix
In the
case 'reasoning'branch ofconvertToBedrockChatMessages, only fallthrough to the unsigned-reasoning push when
providerOptionsis empty orcontains exclusively the
bedrockkey. 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.anthropicon its reasoning parts, sent through
bedrock(...).doStream(...), currentlyreproduces 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.