Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 30, 2025

Description

This PR fixes an issue where Claude 3.5 Sonnet models were not displaying the correct 1M token context window in the UI when the "Enable 1M context window" option was enabled.

Problem

When using Claude 3.5 Sonnet (claude-sonnet-4-5) with the "Enable 1M context window" option enabled:

  • The UI incorrectly showed 200K tokens instead of 1M tokens
  • Claude 3 Opus correctly showed 1M tokens when the option was enabled
  • The model itself recognized it had 1M context, but the UI displayed the wrong value

Solution

  1. Updated Anthropic provider logic: Added support for (Claude 3.5 Sonnet) in the 1M context check
  2. Updated Bedrock provider: Added Claude 3.5 Sonnet model IDs to the array
  3. Added comprehensive tests: Added test coverage for both Anthropic and Bedrock providers to ensure the fix works correctly

Changes

  • Modified to include in the 1M context condition
  • Updated to include Claude 3.5 Sonnet model IDs in the 1M context eligible models
  • Added comprehensive test cases in

Testing

  • ✅ All existing tests pass
  • ✅ New tests added for both Anthropic and Bedrock providers
  • ✅ Verified that Claude 3.5 Sonnet models now correctly show 1M context when the option is enabled

Screenshots

N/A - This is a backend logic fix that affects the displayed token count in the UI.

Fixes #8417


Important

Fixes UI to correctly display 1M context window for Claude 3.5 Sonnet models in Anthropic and Bedrock providers.

  • Behavior:
    • Fixes UI display issue for Claude 3.5 Sonnet models to correctly show 1M token context window when enabled.
    • Updates getSelectedModel() in useSelectedModel.ts to handle 1M context for Claude 3.5 Sonnet in both Anthropic and Bedrock providers.
  • Providers:
    • Adds Claude 3.5 Sonnet model IDs to BEDROCK_1M_CONTEXT_MODEL_IDS in bedrock.ts.
    • Updates logic in getSelectedModel() to apply 1M context for Anthropic provider when anthropicBeta1MContext is true.
  • Testing:
    • Adds tests in useSelectedModel.spec.ts to verify 1M context window behavior for both Anthropic and Bedrock providers.

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

- Added support for claude-sonnet-4-5 (Claude 3.5 Sonnet) in Anthropic provider's 1M context check
- Added Claude 3.5 Sonnet model IDs to BEDROCK_1M_CONTEXT_MODEL_IDS array
- Added comprehensive tests for both Anthropic and Bedrock providers
- Fixes issue where Claude 3.5 Sonnet showed 200K instead of 1M tokens when 1M context was enabled

Fixes #8417
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 30, 2025 16:19
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 30, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 30, 2025
Copy link
Contributor 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: I argued with myself, lost, and now I agree with me.

@@ -0,0 +1 @@
Subproject commit 2c31616e8ade2a3995c3beda2d32d82fac17bf93
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P1: This appears to be an unintended submodule/temp artifact. Please remove tmp-pr-8415/Roo-Code from the PR to avoid introducing stray submodules/files.

@@ -0,0 +1 @@
Subproject commit 815444000508f67c41ba51175f1d3061364ea0bc
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P1: This looks like another unintended submodule/temp artifact. Please remove tmp/pr-8380-Roo-Code from the PR.

if (
provider === "anthropic" &&
id === "claude-sonnet-4-20250514" &&
(id === "claude-sonnet-4-20250514" || id === "claude-sonnet-4-5") &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

P3: Minor maintainability suggestion — model ID checks for 1M context (e.g., 'claude-sonnet-4-20250514' and 'claude-sonnet-4-5') could be centralized into a small set/constant to simplify future additions.

@daniel-lxs daniel-lxs closed this Oct 24, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 24, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 24, 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

Archived in project

Development

Successfully merging this pull request may close these issues.

[BUG] Sonnet 4.5 does not recognize 1M context in the UI.

4 participants