Skip to content

Backport: fix(amazon-bedrock): preserve reasoning text when signature is present#13979

Merged
1 commit merged into
release-v6.0from
backport-pr-13972-to-release-v6.0
Mar 31, 2026
Merged

Backport: fix(amazon-bedrock): preserve reasoning text when signature is present#13979
1 commit merged into
release-v6.0from
backport-pr-13972-to-release-v6.0

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Mar 31, 2026

This is an automated backport of #13972 to the release-v6.0 branch. FYI @dancer

#13972)

## background

`trimIfLast()` trims trailing whitespace from reasoning block text even
when a cryptographic `signature` is present. the signature is computed
over the exact original bytes - trimming even a single trailing newline
invalidates the text/signature pair, causing Bedrock to reject with
`ValidationException: thinking blocks cannot be modified`

## summary

- skip `trimIfLast` for reasoning blocks that have a signature
- reasoning blocks without a signature still get trimmed as before
- add test for multi-turn tool use with signed reasoning blocks

## checklist

- [x] tests have been added / updated (for bug fixes / features)
- [ ] documentation has been added / updated (for bug fixes / features)
- [x] a _patch_ changeset for relevant packages has been added (run
`pnpm changeset` in root)
- [x] i have reviewed this pull request (self-review)

## related issues

fixes #13583
@ghost ghost assigned dancer Mar 31, 2026
@ghost ghost enabled auto-merge (squash) March 31, 2026 17:18
@tigent tigent Bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider labels Mar 31, 2026
@ghost ghost merged commit 4918dda into release-v6.0 Mar 31, 2026
26 checks passed
@ghost ghost deleted the backport-pr-13972-to-release-v6.0 branch March 31, 2026 17:26
@ghost
Copy link
Copy Markdown
Author

ghost commented Mar 31, 2026

🚀 Published in:

Package Version
@ai-sdk/amazon-bedrock 4.0.85

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant