fix(aibridge): handle sonnet 5 adaptive thinking in bedrock - #27339
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Bedrock request-shaping logic so Claude Sonnet 5 is treated as an “adaptive-only” model (rejects legacy thinking.type=enabled), aligning the gateway’s Bedrock InvokeModel behavior with Bedrock’s model constraints.
Changes:
- Adds Sonnet 5 to the Bedrock “requires adaptive thinking” model matcher so enabled-thinking requests are rewritten to adaptive.
- Extends unit and integration coverage to validate Sonnet 5 behavior, including preserving
output_config.effortand stripping unsupportedoutput_config.format. - Clarifies several Bedrock-thinking and “adaptive-only model” comments to be version-agnostic.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| aibridge/intercept/messages/base.go | Treats anthropic.claude-sonnet-5 as adaptive-only via bedrockModelRequiresAdaptiveThinking. |
| aibridge/intercept/messages/reqpayload.go | Comment updates to reflect adaptive-only behavior without tying it to specific versions. |
| aibridge/intercept/messages/base_internal_test.go | Adds Sonnet 5 test cases for enabled→adaptive conversion and output_config handling. |
| aibridge/internal/integrationtest/bridge_internal_test.go | Adds Bedrock integration coverage for Sonnet 5 adaptive-only behavior and effort preservation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pawbana
approved these changes
Jul 29, 2026
johnstcn
commented
Jul 29, 2026
pawbana
approved these changes
Jul 29, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Adds sonnet 5 to the list of models that require adaptive thinking for Bedrock InvokeModel.
Smoke-tested locally.