Repository navigation
fix(translation): report a dropped thinking budget on the way to Responses - #856
Open
harshitwandhare wants to merge 1 commit into
Open
harshitwandhare wants to merge 1 commit into
harshitwandhare wants to merge 1 commit into
Conversation
Contributor
Author
|
Rebased onto On the new head |
harshitwandhare
force-pushed
the
fix/responses-thinking-budget-diagnostic
branch
from
October 2, 2026 07:34
6e8a83a to
f91516d
Compare
…onses Signed-off-by: Harshit Wandhare <harshitwandhare45@gmail.com>
harshitwandhare
force-pushed
the
fix/responses-thinking-budget-diagnostic
branch
from
October 11, 2026 02:27
f91516d to
67f8cf6
Compare
Author
|
Rebased onto |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #792, which @afourniernv closed as superseded by #840 and asked for this part as a new PR.
What was broken. Since #840, an Anthropic request with
"thinking": {"type": "enabled", "budget_tokens": 10000}translated to OpenAI Responses has noreasoningkey. That part is right. But the budget is dropped with no diagnostic. A caller on the default policy gets nolossy_conversionwarning, and a caller onLossyConversionPolicy::Rejectgets the request translated anyway.Why. The Anthropic branch of the Responses encoder builds
reasoningfrom scratch and reads onlythinking.type. The rest ofthinkingis discarded without going throughpush_lossy, which is how this codec reports the other content it cannot map, such as image and file blocks.What the fix does. When the Anthropic
thinkingobject hasbudget_tokens, the encoder callspush_lossywith a message that names it. The translated body does not change.adaptiveanddisabledreport nothing, since #840 maps both ontoeffort.I left
thinking.displayout. The request in #239 sends"display": "omitted"with adaptive thinking, so reporting it would make those requests fail underReject. I can add it if you want it reported too.How it was verified. I applied only the new tests to
mainat64def564first.anthropic_thinking_budget_drop_to_responses_is_reportedfails there on the diagnostics count (left 0, right 1). The other new test passes on both, as a guard against reportingadaptiveordisabled. With the fix, both pass, and #840'santhropic_thinking_to_responses_uses_normalized_effortpasses unchanged.Gates, run in WSL (Ubuntu 24.04, Python 3.12):
mainat64def564cargo test --workspace --lockedcargo test -p switchyard-runner --features prefill-router --lockedpytest tests/ -m "not integration"Re-run 2026-10-11 after rebasing onto
fc64565a:cargo test --workspace --locked962 / 0 over 40 binaries (960 onmainplus the two tests here), prefill-router 68 / 0, fmt and both clippy runs clean. pytest was not re-run, since the branch touches no Python.cargo fmt --all --check, bothcargo clippy ... -D warningsruns (with and withoutprefill-router),ruff check,mypy switchyard, actionlint and the SPDX header scan (226 files, 0 missing) are all clean on the branch.Summary by CodeRabbit