Skip to content

Comments

fix: skip fine-grained-tool-streaming beta for older Claude 3 models on Bedrock#11720

Draft
roomote[bot] wants to merge 1 commit intomainfrom
fix/bedrock-invalid-beta-flag-older-claude-models
Draft

fix: skip fine-grained-tool-streaming beta for older Claude 3 models on Bedrock#11720
roomote[bot] wants to merge 1 commit intomainfrom
fix/bedrock-invalid-beta-flag-older-claude-models

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 24, 2026

Related GitHub Issue

Closes: #11715

Description

This PR attempts to address Issue #11715. Feedback and guidance are welcome.

Problem: When using older Claude 3 models (Haiku, Opus, Sonnet, and the original 3.5 Sonnet 20240620) on AWS Bedrock, the fine-grained-tool-streaming-2025-05-14 beta flag is sent to all Claude models indiscriminately. These older models do not support this beta flag, causing Bedrock to reject the request with "invalid beta flag".

Fix: Added a BEDROCK_FINE_GRAINED_STREAMING_UNSUPPORTED_IDS constant listing the older Claude 3 model IDs that do not support the beta. The condition in bedrock.ts now checks that a Claude model is NOT in this exclusion list before adding the beta header.

Files changed:

  • packages/types/src/providers/bedrock.ts - Added BEDROCK_FINE_GRAINED_STREAMING_UNSUPPORTED_IDS constant
  • src/api/providers/bedrock.ts - Updated the condition to exclude older models from receiving the beta
  • src/api/providers/__tests__/bedrock.spec.ts - Added tests verifying the beta is NOT sent for older models and IS still sent for newer models

Test Procedure

  • Added 2 new test cases in bedrock.spec.ts:
    1. Verifies all 4 unsupported older Claude 3 models do NOT receive the fine-grained-tool-streaming beta
    2. Verifies newer Claude models (e.g. Claude 3.5 Sonnet v2) still receive the beta
  • All 59 tests in bedrock.spec.ts pass
  • All 16 tests in bedrock-native-tools.spec.ts pass
  • All 6 tests in bedrock-reasoning.spec.ts pass
  • Full lint and type-check pass across the monorepo

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No documentation updates are required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Additional Notes

The excluded models are:

  • anthropic.claude-3-haiku-20240307-v1:0
  • anthropic.claude-3-opus-20240229-v1:0
  • anthropic.claude-3-sonnet-20240229-v1:0
  • anthropic.claude-3-5-sonnet-20240620-v1:0

Interactively review PR in Roo Code Cloud

…on Bedrock

Older Claude 3 models (Haiku, Opus, Sonnet, and the original 3.5 Sonnet
20240620) do not support the fine-grained-tool-streaming beta flag on
AWS Bedrock. Sending this beta causes Bedrock to reject the request with
"invalid beta flag".

This change adds an exclusion list for these older models and only sends
the beta header to Claude models that support it.

Closes #11715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] The model returned the following errors: invalid beta flag

1 participant