Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 12, 2025

Description

This PR attempts to address Issue #9182 where AWS Bedrock's Claude 4 Sonnet model identifier becomes invalid when using cross-region inference in Roo Code 3.30.2 and above.

Problem

When using the model anthropic.claude-sonnet-4-20250514-v1:0 with AWS Bedrock, users were getting "The provided model identifier is invalid" errors. This was happening because when cross-region inference is enabled, the model ID gets prefixed (e.g., us.anthropic.claude-sonnet-4-20250514-v1:0), but the prefixed ID wasn't being properly handled when looking up model information.

Solution

  • Fixed getModelById method to use the base model ID (without prefix) when looking up unknown models in guessModelInfoFromId
  • Enhanced guessModelInfoFromId to recognize Claude 4 Sonnet and Claude 4.5 Sonnet model patterns
  • Added comprehensive tests to verify the fix works with various configurations (cross-region, global inference, 1M context)

Testing

  • Added new test file bedrock-claude-4-sonnet.spec.ts with 11 test cases covering various scenarios
  • All existing Bedrock tests continue to pass
  • Verified that model information is correctly resolved even with regional prefixes

Related Issue

Fixes #9182

Feedback and guidance are welcome!


Important

Fixes handling of Claude 4 Sonnet model identifiers in AWS Bedrock for cross-region inference by updating model ID processing and adding tests.

  • Behavior:
    • Fixes getModelById in bedrock.ts to use base model ID without prefix for unknown models.
    • Enhances guessModelInfoFromId in bedrock.ts to recognize Claude 4 Sonnet and Claude 4.5 Sonnet patterns.
  • Testing:
    • Adds bedrock-claude-4-sonnet.spec.ts with 11 test cases for cross-region, global inference, and 1M context scenarios.
    • Ensures model information resolves correctly with regional prefixes.
  • Misc:

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

- Fixed getModelById to use baseModelId when looking up unknown models in guessModelInfoFromId
- Enhanced guessModelInfoFromId to recognize Claude 4 Sonnet and Claude 4.5 Sonnet patterns
- Added comprehensive tests for Claude 4 Sonnet model handling with various configurations

Fixes #9182
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 12, 2025 01:53
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 12, 2025
@dosubot dosubot bot added the bug Something isn't working label Nov 12, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly handles Claude 4 Sonnet model identifiers with cross-region inference prefixes by:

  • Using base model IDs (without prefixes) for model info lookups
  • Adding pattern recognition for Claude 4 and 4.5 Sonnet variants
  • Providing comprehensive test coverage for various configurations

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 12, 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:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Bedrock model identifier becomes invalid

3 participants