🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

fix(aibridge): handle sonnet 5 adaptive thinking in bedrock - #27339

Merged
johnstcn merged 7 commits into
mainfrom
cian/aigov-510-sonnet-5-adaptive-thinking
Jul 29, 2026
Merged

fix(aibridge): handle sonnet 5 adaptive thinking in bedrock#27339
johnstcn merged 7 commits into
mainfrom
cian/aigov-510-sonnet-5-adaptive-thinking

Conversation

@johnstcn

@johnstcn johnstcn commented Jul 20, 2026

Copy link
Copy Markdown
Member

Adds sonnet 5 to the list of models that require adaptive thinking for Bedrock InvokeModel.

Smoke-tested locally.

Obligatory disclosure: a Coder agent helped with this.

@johnstcn johnstcn self-assigned this Jul 20, 2026
@linear-code

linear-code Bot commented Jul 20, 2026

Copy link
Copy Markdown

AIGOV-510

@johnstcn johnstcn changed the title fix(aibridge): handle sonnet 5 adaptive thinking fix(aibridge): handle sonnet 5 adaptive thinking in bedrock Jul 28, 2026
@johnstcn
johnstcn marked this pull request as ready for review July 28, 2026 23:02
@johnstcn
johnstcn requested review from Copilot and pawbana July 28, 2026 23:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.effort and stripping unsupported output_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.

Comment thread aibridge/internal/integrationtest/bridge_internal_test.go Outdated
@johnstcn
johnstcn merged commit b371262 into main Jul 29, 2026
27 of 28 checks passed
@johnstcn
johnstcn deleted the cian/aigov-510-sonnet-5-adaptive-thinking branch July 29, 2026 11:40
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants