Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 8, 2025

Description

This PR fixes an issue where AWS Bedrock was not correctly inferring model capabilities for Claude 4.5 Sonnet when using custom ARNs with cross-region inference.

Problem

When users specified a custom ARN like au.anthropic.claude-sonnet-4-5-20250929-v1:0 with region ap-southeast-2, the model capabilities were incorrectly detected:

  • ❌ Context Window: 128,000 tokens (should be 200,000)
  • ❌ Max output: 5,000 tokens (should be 8,192)
  • ❌ Does not support computer use (should support)
  • ❌ Does not support prompt caching (should support)

Solution

  1. Enhanced model detection patterns: Reorganized the guessModelInfoFromId method to check more specific patterns first (e.g., claude-sonnet-4-5 before generic claude-4)
  2. Added regional prefix support: Extended parseBaseModelId to handle additional regional prefixes including au., af., me., il., cn., and jp.
  3. Correct capability assignment: Ensured Claude 4.5 models get the correct capabilities including computer use, prompt caching, and reasoning support

Changes

  • Updated guessModelInfoFromId method with more specific pattern matching
  • Added support for additional regional inference prefixes in parseBaseModelId
  • Ensured proper capability detection for Claude 3.5 and 4.5 models

Testing

  • ✅ All existing tests pass
  • ✅ Tested with bedrock.spec.ts and bedrock-custom-arn.spec.ts
  • ✅ Linting and type checking pass

Fixes #8561


Important

Fixes AWS Bedrock model detection for Claude 4.5 Sonnet with custom ARNs by updating detection logic and handling regional prefixes.

  • Behavior:
    • Fixes incorrect model capability detection for Claude 4.5 Sonnet with custom ARNs in guessModelInfoFromId().
    • Corrects context window, max output tokens, and support for computer use and prompt caching.
  • Functions:
    • Updates guessModelInfoFromId() in bedrock.ts to prioritize specific patterns like claude-sonnet-4-5.
    • Extends parseBaseModelId() to handle regional prefixes like au., af., me., etc.
  • Testing:
    • Validated with bedrock.spec.ts and bedrock-custom-arn.spec.ts.

This description was created by Ellipsis for 9d835c2. You can customize this summary. It will automatically update as commits are pushed.

- Enhanced guessModelInfoFromId to properly detect Claude 3.5 and 4.5 Sonnet models
- Added support for computer use and reasoning capabilities detection
- Added support for additional regional inference prefixes (au., af., me., il., cn., jp.)
- Fixed issue where custom ARNs with regional prefixes weren't properly recognized

Fixes #8561
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 8, 2025 06:13
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Oct 8, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 8, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Self-review initiated: a robot judging its own reflection—what could possibly be unbiased.

},
"claude-3-5": {
// Claude 4 Opus
"claude-opus-4": {
Copy link
Author

Choose a reason for hiding this comment

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

P1: Pattern typo prevents detection of Claude 4 Opus; Anthropic naming uses 'claude-4-opus'. This key won't match real IDs like '...claude-4-opus-...'.

Suggested change
"claude-opus-4": {
"claude-4-opus": {

"me.", // Middle East
"il.", // Israel
"cn.", // China
"jp.", // Japan (alternative to ap-)
Copy link
Author

Choose a reason for hiding this comment

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

P2: Unverified regional prefix 'jp.' may not be a documented AWS inference profile prefix; stripping it could inadvertently mangle legitimate model IDs. Recommend relying on AWS_INFERENCE_PROFILE_MAPPING or adding tests/docs reference before introducing new prefixes.

@daniel-lxs daniel-lxs closed this Oct 28, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 28, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

4 participants