Repository navigation
fix(anthropic): backport #42152 and #42288 to stable/1.102.x for v1.102.1 - #42538
Conversation
… beta to Bedrock Invoke and Vertex on /v1/messages Backport of #42288 to stable/1.102.x. Cherry-picked from merge commit fc82f6e (litellm_safeguards_bedrock_vertex_messages). The line has no bedrock_mantle beta-header mapping and no Mantle /v1/messages route, so the Mantle mapping, its test file, and the bedrock_mantle test parameter are left out.
…ine's budgets The picked TypedDict fields use read-only Sequence[Mapping[str, object]] annotations and the picked Vertex test carries a test-quality-ok marker, so stable/1.102.x's LIT001, LIT012 and TQ008 budgets hold. Static typing only, no runtime change.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
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.
|
| [ | ||
| ("bedrock-claude-opus-4.5", "bedrock"), | ||
| ("bedrock-converse-claude-sonnet-4.5", "bedrock_converse"), | ||
| ("bedrock-claude-fable-5.1", "bedrock"), |
There was a problem hiding this comment.
Invoke coverage routes elsewhere
This model auto-routes to Converse, so the supposed Invoke case no longer exercises InvokeModel. This weakens the existing end-to-end coverage and violates the requirement that test changes must not hide regressions. The repository requirement must be satisfied before merging
Rule Used: What: Flag any modifications to existing tests and verify they don't weaken test coverage or mask regressions. Why: Developers may alter tests to make failing code pass rather than fix the actual bug, hiding regressions. Good: ``` // Test updated t... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| with patch.object( # test-quality-ok: the GCP token exchange runs before the faked HTTP boundary | ||
| VertexBase, "_ensure_access_token", return_value=("test-token", "test-project") | ||
| ): |
There was a problem hiding this comment.
This test patches VertexBase._ensure_access_token on the class instead of injecting the token provider. That violates the repository directive requiring dependency injection rather than class-attribute monkeypatching, so it must be addressed before merging
Context Used: AGENTS.md (source)
…02.1) (#736) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.102.0` → `v1.102.1` | --- ### Release Notes <details> <summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary> ### [`v1.102.1`](https://github.com/BerriAI/litellm/releases/tag/v1.102.1) [Compare Source](BerriAI/litellm@v1.102.0...v1.102.1) ##### Verify Docker Image Signature All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53). **Verify using the pinned commit hash (recommended):** A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key: ```bash cosign verify \ --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \ ghcr.io/berriai/litellm:v1.102.1 ``` **Verify using the release tag (convenience):** Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules: ```bash cosign verify \ --key https://raw.githubusercontent.com/BerriAI/litellm/v1.102.1/cosign.pub \ ghcr.io/berriai/litellm:v1.102.1 ``` Expected output: ``` The following checks were performed on each of these signatures: - The cosign claims were validated - The signatures were verified against the specified public key ``` *** ##### What's Changed - fix(anthropic): backport [#​42152](BerriAI/litellm#42152) and [#​42288](BerriAI/litellm#42288) to stable/1.102.x for v1.102.1 by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42538](BerriAI/litellm#42538) - feat(typesafe): backport the jev change set to stable/1.102.x for v1.102.1 by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42595](BerriAI/litellm#42595) - chore(release): backport [#​42388](BerriAI/litellm#42388) and [#​41462](BerriAI/litellm#41462) to stable/1.102.x by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42618](BerriAI/litellm#42618) **Full Changelog**: <BerriAI/litellm@v1.102.0...v1.102.1> </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/London) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMDguMiIsInVwZGF0ZWRJblZlciI6IjQ0LjEwOC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.hayden.moe/hayden/phoebe/pulls/736
…02.1) (#2200) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.102.0` → `v1.102.1` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/6) for more information. --- ### Release Notes <details> <summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary> ### [`v1.102.1`](https://github.com/BerriAI/litellm/releases/tag/v1.102.1) [Compare Source](BerriAI/litellm@v1.102.0...v1.102.1) #### Verify Docker Image Signature All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53). **Verify using the pinned commit hash (recommended):** A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key: ```bash cosign verify \ --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \ ghcr.io/berriai/litellm:v1.102.1 ``` **Verify using the release tag (convenience):** Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules: ```bash cosign verify \ --key https://raw.githubusercontent.com/BerriAI/litellm/v1.102.1/cosign.pub \ ghcr.io/berriai/litellm:v1.102.1 ``` Expected output: ``` The following checks were performed on each of these signatures: - The cosign claims were validated - The signatures were verified against the specified public key ``` *** #### What's Changed - fix(anthropic): backport [#​42152](BerriAI/litellm#42152) and [#​42288](BerriAI/litellm#42288) to stable/1.102.x for v1.102.1 by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42538](BerriAI/litellm#42538) - feat(typesafe): backport the jev change set to stable/1.102.x for v1.102.1 by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42595](BerriAI/litellm#42595) - chore(release): backport [#​42388](BerriAI/litellm#42388) and [#​41462](BerriAI/litellm#41462) to stable/1.102.x by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42618](BerriAI/litellm#42618) **Full Changelog**: <BerriAI/litellm@v1.102.0...v1.102.1> </details> --- ### Configuration 📅 **Schedule**: (in timezone Europe/Rome) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMDQuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjEwNC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.aresu.eu/GiorgioAresu/home-ops/pulls/2200
…02.1) (#267) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/berriai/litellm](https://images.chainguard.dev/directory/image/wolfi-base/overview) ([source](https://github.com/BerriAI/litellm)) | patch | `v1.102.0` → `v1.102.1` | --- ### Release Notes <details> <summary>BerriAI/litellm (ghcr.io/berriai/litellm)</summary> ### [`v1.102.1`](https://github.com/BerriAI/litellm/releases/tag/v1.102.1) [Compare Source](BerriAI/litellm@v1.102.0...v1.102.1) #### Verify Docker Image Signature All LiteLLM Docker images are signed with [cosign](https://docs.sigstore.dev/cosign/overview/). Every release is signed with the same key introduced in [commit `0112e53`](BerriAI/litellm@0112e53). **Verify using the pinned commit hash (recommended):** A commit hash is cryptographically immutable, so this is the strongest way to ensure you are using the original signing key: ```bash cosign verify \ --key https://raw.githubusercontent.com/BerriAI/litellm/0112e53046018d726492c814b3644b7d376029d0/cosign.pub \ ghcr.io/berriai/litellm:v1.102.1 ``` **Verify using the release tag (convenience):** Tags are protected in this repository and resolve to the same key. This option is easier to read but relies on tag protection rules: ```bash cosign verify \ --key https://raw.githubusercontent.com/BerriAI/litellm/v1.102.1/cosign.pub \ ghcr.io/berriai/litellm:v1.102.1 ``` Expected output: ``` The following checks were performed on each of these signatures: - The cosign claims were validated - The signatures were verified against the specified public key ``` *** #### What's Changed - fix(anthropic): backport [#​42152](BerriAI/litellm#42152) and [#​42288](BerriAI/litellm#42288) to stable/1.102.x for v1.102.1 by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42538](BerriAI/litellm#42538) - feat(typesafe): backport the jev change set to stable/1.102.x for v1.102.1 by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42595](BerriAI/litellm#42595) - chore(release): backport [#​42388](BerriAI/litellm#42388) and [#​41462](BerriAI/litellm#41462) to stable/1.102.x by [@​devin-ai-integration](https://github.com/devin-ai-integration)\[bot] in [#​42618](BerriAI/litellm#42618) **Full Changelog**: <BerriAI/litellm@v1.102.0...v1.102.1> </details> --- ### Configuration 📅 **Schedule**: (in timezone America/New_York) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMDUuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjEwNS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.greyrock.io/todd/home-ops/pulls/267
TLDR
Problem this solves:
safeguardsfield on/v1/messagessafeguard_resultsHow it solves it:
stable/1.102.xwith their testssafeguardspasses through to Anthropic, Bedrock and Vertex,safeguard_resultscomes backUser Flow
Before: a developer running Claude Code through a LiteLLM gateway on this release line cannot use auto mode, because the gateway drops the field Claude Code needs for it
claudewithANTHROPIC_BASE_URL=https://litellm-domainand switch to auto mode (--permission-mode auto, or shift+tab)safeguardsarray in the body asking for the server-side classifiersafeguard_results, so/statusshowsAuto mode server: Disabledand every tool call is judged by the billed client-side classifier insteadAfter: the same developer gets auto mode through the gateway, with the classifier answers coming back from the provider
claudewithANTHROPIC_BASE_URL=https://litellm-domainand switch to auto mode (--permission-mode auto, or shift+tab)safeguardsarray in the body asking for the server-side classifiersafeguard_results(type: evaluated,outcome: not_flaggedper tool call), so/statusshowsAuto mode server: Enabledand the server-side classifier judges every tool callRelevant issues
Backport of #42152 and #42288
Affected release
Linear ticket
Resolves LIT-8336
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
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@greptileaito re-request a review after pushing changes)Backport checklist
e714ab4b20fix(anthropic): forward safeguards and anthropic-beta unchanged on native /v1/messages #42152 fix(anthropic): pass through thesafeguardsfield Claude Code sends (cherry-picked frome912ebe999, original author kept)b6f77c32b5fix(anthropic): forward Claude Code safeguards and dangerous-tool-use beta to Bedrock Invoke and Vertex on /v1/messages #42288 fix(anthropic): returnsafeguard_resultson Bedrock and Vertex too (cherry-picked fromfc82f6e8fa, original author kept). Its Mantle pieces are left out, that surface does not exist on this line60c019166aPrerequisite: thelocal_beta_headers_configtest fixture from47b2479c94, which the picked test file needs and this line lacks4f4ed1121abump: version 1.102.1(pyproject.toml, uv.lock).stable/1.102.xdid not exist, it was created by hand at thev1.102.0tag (95293834e8) for this backport712428ededBudget follow-up: the picked TypedDict fields use read-onlySequence[Mapping[str, object]]annotations and the picked Vertex test carries a# test-quality-okmarker, so the line's LIT001, LIT012 and TQ008 budgets hold. Static typing only, no runtime change, andmainkeeps its own annotations0fee6fcc76Test-only port of fix(test): unbreak the integration-cost and proxy_e2e_anthropic_messages CircleCI jobs on main #42048 (7966f50c34, original author kept): the picked beta-header map addsdangerous-tool-use-2026-09-03for Bedrock, which Claude Opus 4.5 on Bedrock Invoke rejects as an invalid beta flag, so the all-beta-headers Bedrock e2e cases run on Claude Fable 5.1 as they do onmain. Touchestests/proxy_e2e_anthropic_messages_tests/onlyDelays 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
Before (9529383)
Proxy booted from
95293834e8with--num_workers 2on port 29762, no DB; Claude Code v2.1.280 started withANTHROPIC_BASE_URL=http://localhost:29762and--permission-mode auto, modelanthropic-sonnet-5Claude Code auto mode through the gateway
Read and Bash tool calls run in auto mode, but
/statusreportsAuto mode server: Disabled: the gateway dropped thesafeguardsfield, so Claude Code falls back to its billed client-side classifierPOST /v1/messages with
safeguards(non-streaming and streaming, three providers)All six runs answer 200 with
safeguard_results: []: the beta header reached Anthropic but thesafeguardsfield did notAfter (0fee6fc)
Proxy booted from
0fee6fcc76with--num_workers 2on port 56342, no DB; Claude Code v2.1.280 started withANTHROPIC_BASE_URL=http://localhost:56342and--permission-mode auto, modelanthropic-sonnet-5Claude Code auto mode through the gateway
The same Read and Bash tool calls run in auto mode and
/statusreportsAuto mode server: Enabled: the server-side classifier answers inside the main requestPOST /v1/messages with
safeguards(non-streaming and streaming, three providers)All six runs answer 200 with one
dangerous_tool_useentry whosestatus.typeisavailableand whose per-call result isevaluatedType
🐛 Bug Fix
Caveats (if any)
0fee6fcc76):test_bedrock_invoke_messages_with_all_beta_headers[bedrock-claude-opus-4.5-bedrock]failed on the first CircleCI run. The picked beta-header map addsdangerous-tool-use-2026-09-03for Bedrock, and Claude Opus 4.5 on Bedrock Invoke rejects it as an invalid beta flag.mainhas run those cases on Claude Fable 5.1 since fix(test): unbreak the integration-cost and proxy_e2e_anthropic_messages CircleCI jobs on main #42048 (7966f50c34), ported here as0fee6fcc76; the CircleCI run at the tip no longer lists itllm_translation_testing,local_testing_part1andlocal_testing_part2fail on the TogetherAI cases only (the 18tests/llm_translation/test_together_ai.pycases,test_completion_custom_provider_model_name,test_completion_together_ai_stream,test_customprompt_together_ai,test_async_text_completion_together_ai). TogetherAI retired the serverlessopenai/gpt-oss-20bthose tests pin (itsdeprecation_dateis 2026-09-14), so they fail the same way at this line's base;mainfixed the suites in1aa2e19ee4,8c046e13bd,b478131701,515bf8c9d5and02ced74540. Nothing in this PR touches TogetherAIe2e_ui_testinguploads no junit results and fails ontests/e2e/ui/tests/mcp/mcpTools.spec.ts(the MCP Tools tab no longer lists theask_questioncard the spec hardcodes).mainrewrote the spec to check against the upstream's owntools/listin test(e2e-ui): check the MCP Tools tab against the upstream's own tools/list #42397 (b96842f62c). No dashboard code changes herev1.102.0GitHub release object is missing (its Create Release run failed on notes over 125000 characters), sostable/1.102.xwas created by hand at thev1.102.0tag (95293834e8). The release PR flow forv1.102.1should account for thatstable/**ruleset requires one approving review and has no required status checks, so the inherited CircleCI reds above do not gate the merge and are recorded here instead of mergingmaininto the line; every GitHub Actions check is green at the tipFinal Attestation