Skip to content

fix(test): unbreak the integration-cost and proxy_e2e_anthropic_messages CircleCI jobs on main - #42048

Merged
kerry-berri merged 2 commits into
mainfrom
litellm_fix_circleci_cost_and_bedrock_beta
Sep 19, 2026
Merged

kerry-berri merged 2 commits into
mainfrom
litellm_fix_circleci_cost_and_bedrock_beta

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • integration-cost has been red on main since 1b305cd landed
  • proxy_e2e_anthropic_messages_tests has been red on main since c19a199 landed
  • Both are stale test data, not production bugs

How it solves it:

  • Repin the Fireworks fallback cache-read case to the 50% default the code now applies
  • Run the all-beta-headers Bedrock cases on Claude Fable 5.1, the newest model, which accepts every mapped beta

User Flow

Before: a maintainer looks at any main pipeline in CircleCI and both jobs are red for reasons unrelated to their change

  1. They open the latest main pipeline at https://app.circleci.com/pipelines/gh/BerriAI/litellm?branch=main
  2. integration-cost fails with x-litellm-response-cost 0.0012456 != expected 0.0021672 on the deepseek-v4p1-flash-fallback_cache_read_at_input_rate case
  3. proxy_e2e_anthropic_messages_tests fails on both test_bedrock_invoke_messages_with_all_beta_headers cases with Bedrock 400 invalid beta flag
  4. They have to scroll past both to find out whether their own change broke anything

After: the same two jobs are green on main, so a red job means something real

  1. They open the latest main pipeline at https://app.circleci.com/pipelines/gh/BerriAI/litellm?branch=main
  2. integration-cost passes: the renamed fallback_cache_read_at_half_input_rate case expects 0.0012456
  3. proxy_e2e_anthropic_messages_tests passes: the two Bedrock cases hit Fable 5.1 with the full mapped beta list and get 200
  4. Any red job is now attributable to the PR under test

Relevant issues

Root causes:

Affected release

Linear ticket

Resolves LIT-8149

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Setup: python litellm/proxy/proxy_cli.py --config tests/proxy_e2e_anthropic_messages_tests/test_config.yaml --port 4000 with LITELLM_MASTER_KEY=sk-1234 and the CI Bedrock credentials for us-east-1. The cost case only runs inside the CircleCI integration harness (scripted upstream plus Postgres and Redis), so its Before is the CircleCI log and its After is the CI run on this PR

Before (f49fd22)

Bedrock invoke, every mapped bedrock beta

  1. curl -s http://localhost:4000/v1/messages -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: advanced-tool-use-2025-11-20,compact-2026-01-12,computer-use-2025-01-24,computer-use-2025-11-24,context-1m-2025-08-07,context-management-2025-06-27,effort-2025-11-24,fine-grained-tool-streaming-2025-05-14,thinking-binding-controls-2026-08-01,tool-search-tool-2025-10-19' -d '{"model":"bedrock-claude-opus-4.5","max_tokens":10,"messages":[{"role":"user","content":"Say hello"}]}'
  2. 400 {"type":"error","error":{"type":"invalid_request_error","message":"litellm.BadRequestError: BedrockException - {\"message\":\"invalid beta flag\"}. Received Model Group=bedrock-claude-opus-4.5 ..."}}
  3. Same request with only anthropic-beta: thinking-binding-controls-2026-08-01 also returns 400; each of the other nine flags alone returns 200

Bedrock converse, every mapped bedrock_converse beta

  1. Same curl with anthropic-beta: computer-use-2025-01-24,computer-use-2025-11-24,context-1m-2025-08-07,effort-2025-11-24,fine-grained-tool-streaming-2025-05-14,structured-outputs-2025-11-13,thinking-binding-controls-2026-08-01 and "model":"bedrock-converse-claude-sonnet-4.5"
  2. 400 ... BedrockException - {\"message\":\"The model returned the following errors: invalid beta flag\"}

Fireworks fallback cache-read cost (CircleCI job 2191123 on main)

  1. pytest tests/integration/cost_calculation/test_cost_tracking.py via .circleci/scripts/run_integration.sh cost
  2. AssertionError: fireworks_ai-accounts-fireworks-models-deepseek-v4p1-flash-fallback_cache_read_at_input_rate: x-litellm-response-cost 0.0012456 != expected 0.0021672

After (7966f50)

Bedrock invoke, every mapped bedrock beta

  1. curl -s http://localhost:4000/v1/messages -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: advanced-tool-use-2025-11-20,compact-2026-01-12,computer-use-2025-01-24,computer-use-2025-11-24,context-1m-2025-08-07,context-management-2025-06-27,effort-2025-11-24,fine-grained-tool-streaming-2025-05-14,thinking-binding-controls-2026-08-01,tool-search-tool-2025-10-19' -d '{"model":"bedrock-claude-fable-5.1","max_tokens":10,"messages":[{"role":"user","content":"Say hello and nothing else"}]}'
  2. 200 {"model":"bedrock-claude-fable-5.1","id":"msg_bdrk_rgklbehc2r5cuzdiphgzpxlhrp2di5zidgqqimaouki7yhki5qia","type":"message","role":"assistant","content":[{"type":"text","text":"Hello"}],"stop_reason":"end_turn","usage":{"input_tokens":17,"output_tokens":5, ...}}

Bedrock converse, every mapped bedrock_converse beta

  1. curl -s http://localhost:4000/v1/messages -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' -H 'anthropic-beta: computer-use-2025-01-24,computer-use-2025-11-24,context-1m-2025-08-07,effort-2025-11-24,fine-grained-tool-streaming-2025-05-14,structured-outputs-2025-11-13,thinking-binding-controls-2026-08-01' -d '{"model":"bedrock-converse-claude-fable-5.1","max_tokens":10,"messages":[{"role":"user","content":"Say hello and nothing else"}]}'
  2. 200 {"id":"chatcmpl-4b275756-c40b-4161-b092-9cd53b129717","type":"message","role":"assistant","model":"bedrock-converse-claude-fable-5.1","usage":{"input_tokens":17,"output_tokens":5},"content":[{"type":"text","text":"Hello"}],"stop_reason":"end_turn"}
  3. pytest tests/proxy_e2e_anthropic_messages_tests/test_all_beta_headers.py -k bedrock: both cases PASSED against the live proxy

Fireworks fallback cache-read cost

  1. data_errors() on the edited fixture returns empty, so the renamed case and its contracts.json entry are consistent
  2. The integration-cost job on this PR is the live run; see the checks tab

Type

✅ Test

Caveats (if any)

Low

Link to Devin session: https://app.devin.ai/sessions/fa3712a4b31d4d26a1877f606396ebc9
Open in Devin Desktop: https://app.devin.ai/desktop/session/fa3712a4b31d4d26a1877f606396ebc9?variant=devin

kerry and others added 2 commits September 19, 2026 23:33
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 19, 2026 23:35
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge because the changed expectations match current production behavior and preserve the intended integration coverage

Summary

This PR repairs two stale integration-test expectations without changing production behavior

  • Repins the Fireworks fallback cache-read fixture to the current 50% input-rate default and synchronizes its contract identifier
  • Moves Bedrock all-beta-header coverage to Claude Fable 5.1 for both Invoke and Converse configurations
  • Keeps the existing response, usage, provider-mapping, and cost-accounting assertions intact

Reviews (1) · Last reviewed commit: "fix(test): run the all-beta-headers bedr..."

@codecov

codecov Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@joshua-berri joshua-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@kerry-berri
kerry-berri merged commit 1fcef68 into main Sep 19, 2026
89 checks passed
mateo-berri pushed a commit that referenced this pull request Sep 22, 2026
Backport of #42048 to stable/1.102.x.
Cherry-picked from 7966f50 (main). The safeguards backport maps the dangerous-tool-use-2026-09-03 beta for Bedrock, which Claude Opus 4.5 on Bedrock Invoke rejects as an invalid beta flag, so the all-beta-headers Bedrock cases run on Claude Fable 5.1 as they do on main.
mateo-berri pushed a commit that referenced this pull request Sep 22, 2026
Backport of #42048 to stable/1.101.x.
Cherry-picked from 7966f50 (main). The safeguards backport maps the dangerous-tool-use-2026-09-03 beta for Bedrock, which Claude Opus 4.5 on Bedrock Invoke rejects as an invalid beta flag, so the all-beta-headers Bedrock cases run on Claude Fable 5.1 as they do on main.
mateo-berri pushed a commit that referenced this pull request Sep 22, 2026
Backport of #42048 to stable/1.100.x.
Cherry-picked from 7966f50 (main). The safeguards backport maps the dangerous-tool-use-2026-09-03 beta for Bedrock, which Claude Opus 4.5 on Bedrock Invoke rejects as an invalid beta flag, so the all-beta-headers Bedrock cases run on Claude Fable 5.1 as they do on main.
mateo-berri pushed a commit that referenced this pull request Sep 22, 2026
Backport of #42048 to stable/1.99.x.
Cherry-picked from 7966f50 (main). The safeguards backport maps the dangerous-tool-use-2026-09-03 beta for Bedrock, which Claude Opus 4.5 on Bedrock Invoke rejects as an invalid beta flag, so the all-beta-headers Bedrock cases run on Claude Fable 5.1 as they do on main.
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.

2 participants