Repository navigation
fix(anthropic): drop unknown legacy thinking keys under drop_params when rebuilding adaptive thinking - #46741
Conversation
…hen rebuilding adaptive thinking
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Automatic reviews are disabled for this repository. |
|
@litereview code-review |
✅ code-review5/5 · Ready for human reviewScope: full · Full PR review. Completed · Some checks not run. No correctness findings. Checks and execution details
The manual E2E evidence in gist 3f16d949 qualifies:
I also ran the related unit tests locally:
View review · Reviewed |
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… updates rebuilds Bedrock Invoke copied every caller thinking key when adding display updates, so an unknown key still reached the provider with drop_params on. Filter that copy the same way, and cover each chat call site plus the global litellm.drop_params path in tests
|
@litereview code-review |
|
bugbot run |
|
@litereview code-review |
|
bugbot run |
…ing on /v1/messages and Bedrock Invoke
|
@litereview code-review |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 96797b4. Configure here.
|
@litellm-stampbot |
1 similar comment
|
@litellm-stampbot |
litellm-stampbot: risk lowApproved at Rules (
Judge (gpt-6-luna): low, probability of high 0.00 (high at or above 0.90)
Pushes do not re-run this check. Comment |
kerry-berri
left a comment
There was a problem hiding this comment.
Low risk by rule and by judgement at 96797b4
TLDR
Problem this solves:
thinkingkeys through to Claudedrop_paramsonHow it solves it:
drop_paramswhen LiteLLM rebuildsthinkingdrop_params, Claude's 400 still comes backblock_bindingand supporteddisplayvalues are always keptdrop_params, rebuilt adaptivethinkingalso dropsbudget_tokensUser Flow
Before: a developer with
drop_paramson gets a 400 when legacythinkingcarries a key Claude does not know"drop_params": truethinkingis{"type": "enabled", "budget_tokens": 2048, "not_a_real_key": true}thinking.adaptive.not_a_real_key: Extra inputs are not permittedAfter: the same request returns 200, and
block_bindingin the same object still applies"drop_params": truethinkingis{"type": "enabled", "budget_tokens": 2048, "not_a_real_key": true}drop_paramsthe same request still returns the 400Relevant issues
Follow-up to #46342
Design decisions
Every rebuild produces adaptive
thinking, so known keys are the adaptive fields of LiteLLM's Anthropic thinking type (type,display,block_binding). Always dropping the rest would also drop new Anthropic keys, so unknown keys follow the usualdrop_paramsrule and get the provider's 400 without it. Onlythinkingthat LiteLLM rebuilds is filtered, since filtering every Claude route changes requests that work todayPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<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 moreDelays 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
Last updated: 96797b4. QA and /live-pr-risk ran on 59e3bb4, the last commit with a product diff
Two 2-worker proxies call real providers, Before at the merge base and After at 59e3bb4. Cells read chat/messages. Cases send legacy
thinkingwithnot_a_real_keyanddrop_params: trueunless named otherwise, and the last two rows set only globaldrop_params. Every Before 400 isExtra inputs are not permitted, and the Afterblock_binding: error400 is the binding mismatchdrop_paramsdrop_paramsdisplay: updatesbudget_tokensdrop_params: falseblock_binding: error, foreign blockblock_binding: drop_block, foreign blockdrop_paramsclear_thinkingeditEach proxy's boot, commands and raw output are in the gist linked from each cell
Integration audit
The matrix ran at base 54ff82d and head 96797b4. Five drop cells (body, deployment and Claude Code's default
drop_paramson /v1/messages, Bedrock Invoke chat and messages) fail on base and pass twice on head, and the 52 other cells pass on bothProxy config
The second pair adds these lines
Before (54ff82d)
Anthropic, body
drop_paramsSame request on /v1/messages
After (59e3bb4)
Anthropic, body
drop_paramsSame request on /v1/messages
Type
🐛 Bug Fix
Caveats (if any)
Medium
drop_params, an unknown key or an adaptivebudget_tokensnow 400s instead of dropping silentlydrop_paramsor removing the keydrop_paramsby default unless the config sets it, so it keeps the dropdrop_paramson, only rebuiltthinkingdrops unknown keysthinkingon Opus 5.5 and legacy on Opus 4.6 still 400, as in the last releaseLow
drop_paramsuntil added, and the drop is not loggedlitellm.drop_params, which the chat path needsmcp-elicitationin the requiredunitrollup timed out once here and passed on a rerun. It also times out on recent main runs, and this PR does not touch itFinal Attestation
The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
96797b4 passes /audit
59e3bb4 passes /live-pr-risk