fix(qwen): make thinking mode explicit - #74845
Open
jtstothard wants to merge 1 commit into
Open
Conversation
jtstothard
marked this pull request as ready for review
July 30, 2026 14:20
Contributor
|
Thanks for the focused provider-boundary fix. Current main still has the relevant gap: Problems
Suggested changes
Automated hermes-sweeper review. |
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.
Summary
Qwen-compatible endpoints can default to server-side
autoreasoning. For short utility or coding requests, hidden reasoning can consume the entire completion budget and leave empty visible output.This PR makes Qwen thinking explicit at the provider boundary:
enable_thinking: false{"enabled": true}→enable_thinking: trueplus a boundedthinking_budget: 32768Why this is provider-specific
Qwen uses
enable_thinkingin the request body. This is separate from the custom-provider / llama.cpp/vLLM work in #12427 and #64153, which useschat_template_kwargs.enable_thinkingfor a different provider path. This PR does not attempt to redesign genericextra_bodyconfiguration or model-specific field mapping.Reasoning contract
Hermes' reasoning parser produces
{"enabled": true, "effort": ...}for explicit reasoning levels and{"enabled": false}fornone. Only the genuine booleanenabled=Trueis authoritative here;effortis intentionally non-authoritative so explicit enablement is not accidentally suppressed byeffort="none"or malformed effort values.Unset reasoning is deliberately sent as
enable_thinking=falserather than relying on a server-sideautodefault. This prevents hidden reasoning from silently consuming utility-request output budgets. The enabled 32K thinking budget is below the profile's 64K completion default, preserving visible-output headroom.Validation
python3 -m pytest tests/providers/test_provider_profiles.py -q— 16 passedpython3 -m pytest tests/providers/test_profile_wiring.py tests/providers/test_transport_parity.py -q— 22 passedChatCompletionsTransportforwarding, metadata preservation, diff scope, and secret safetyValidation exercised the Qwen-compatible llama.cpp/Lemonade transport path. No live Qwen Portal credential or production service is required or included.
Related upstream work
extra_bodypassthroughScope
Only the Qwen provider profile and its focused tests are changed. No routing, Hindsight, LiteLLM, Lemonade, credentials, or deployment changes are included.