Skip to content

fix: remove deleted Anthropic beta header for AWS#4955

Draft
Roland0511 wants to merge 1 commit into
QuantumNous:mainfrom
Roland0511:upgrade/v1.0.0-rc.5-aws-beta-fix
Draft

fix: remove deleted Anthropic beta header for AWS#4955
Roland0511 wants to merge 1 commit into
QuantumNous:mainfrom
Roland0511:upgrade/v1.0.0-rc.5-aws-beta-fix

Conversation

@Roland0511
Copy link
Copy Markdown

@Roland0511 Roland0511 commented May 19, 2026

Summary

  • Remove the inherited anthropic-beta header when runtime header overrides are enabled but no replacement anthropic-beta is provided.
  • Add AWS relay coverage for deleting the beta header from Bedrock Claude requests.

Why

Runtime header overrides can intentionally remove request headers. The AWS relay copied the incoming anthropic-beta header into the Bedrock payload even when the override map omitted it, so removed beta flags could still be forwarded upstream.

Tests

  • go test ./relay/channel/aws -run 'TestDoAwsClientRequest_(AppliesRuntimeHeaderOverrideToAnthropicBeta|RemovesAnthropicBetaWhenRuntimeOverrideDeletesIt)'

Summary by CodeRabbit

  • Bug Fixes

    • Fixed header handling to properly remove the anthropic-beta header from outgoing requests when runtime header overrides are configured without explicitly including it.
  • Tests

    • Added test case validating correct header removal behavior during runtime override scenarios.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3f2a162a-51be-4272-a171-b556907f3e45

📥 Commits

Reviewing files that changed from the base of the PR and between 5dd0d3b and 49767a5.

📒 Files selected for processing (2)
  • relay/channel/aws/relay-aws.go
  • relay/channel/aws/relay_aws_test.go

Walkthrough

When UseRuntimeHeadersOverride is enabled and the override configuration does not include the anthropic-beta header, the code explicitly removes any existing anthropic-beta header from the outgoing AWS request, with a new test verifying the behavior.

Changes

Anthropic-Beta Header Cleanup

Layer / File(s) Summary
Anthropic-beta header removal and validation
relay/channel/aws/relay-aws.go, relay/channel/aws/relay_aws_test.go
When runtime header override is enabled and anthropic-beta is absent from headerOverride, the code removes any existing anthropic-beta entry from requestHeader before applying overrides. Test verifies that the outgoing AWS payload no longer contains anthropic_beta field when runtime override settings are empty while the inbound request provides the header.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • QuantumNous/new-api#3066: Both PRs modify relay/channel/aws/relay-aws.go/doAwsClientRequest and its tests around anthropic-beta runtime header override handling (one ensuring it's applied; the other ensuring it's removed when the override deletes it).
  • QuantumNous/new-api#2226: Both PRs address handling of anthropic_beta so it's not sent when not intended—main PR deletes the anthropic-beta header under runtime header overrides (and tests the payload), while retrieved PR makes AwsClaudeRequest.AnthropicBeta JSON-optional/conditionally set in dto.go.

Suggested reviewers

  • seefs001

Poem

🐰 A header vanishes with care,
When override decrees it bare,
The beta tag will disappear,
Tests confirm the path is clear! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing the anthropic-beta header when runtime header overrides delete it for AWS Bedrock relay requests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant