fix: honor explicit thinking off on OpenAI-compatible providers - #1774
Merged
Conversation
An explicit withThinking('off') collapsed to the same internal state as
"never configured" on chat-completions providers, so the history-based
auto reasoning_effort injection (#1616) silently switched reasoning back
on and could leak the field to models that reject it. Store the requested
effort verbatim and derive the wire encoding per request, suppress the
auto-enable for an explicit 'off', and report the accurate current effort
('on'/'off') instead of recording 'off' for both.
🦋 Changeset detectedLatest commit: f379528 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
This was referenced Jul 16, 2026
Merged
Merged
ywh114
pushed a commit
to ywh114/kimi-code
that referenced
this pull request
Jul 19, 2026
…shotAI#1774) An explicit withThinking('off') collapsed to the same internal state as "never configured" on chat-completions providers, so the history-based auto reasoning_effort injection (MoonshotAI#1616) silently switched reasoning back on and could leak the field to models that reject it. Store the requested effort verbatim and derive the wire encoding per request, suppress the auto-enable for an explicit 'off', and report the accurate current effort ('on'/'off') instead of recording 'off' for both.
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.
Related Issue
No linked issue. Follow-up hardening on top of the #1616 auto-injection workaround; relates to the reasoning-effort audit that also produced #1765.
Problem
On OpenAI-compatible (chat completions) providers, an explicit thinking "off" collapsed to the same internal state as "never configured":
withThinking('off')storedundefined, exactly like a provider that never sawwithThinking. The history-based autoreasoning_effortinjection (introduced for #1616) could not tell the two apart, so:reasoning_effort: 'medium'— the UI said Off while the model kept reasoning (and billing for it).reasoning_effortinto the next request, producing a 400.thinkingEffortreportednullfor 'on', 'off', and unset alike, so request records fell back to'off'and mislabeled an active 'on' as 'off'.What changed
OpenAILegacyChatProvider(both the kosong copy and the vendored agent-core-v2 copy) now stores the requested effort verbatim in_thinkingEffort; the wire encoding is derived per request: 'off'/'on' send no field, concrete efforts pass through unchanged.thinkingEffortreturns the actual effort, fixing records/telemetry that previously logged 'off' for 'on'.reasoning_effort: 'none'is sent — OpenAI's support for that value is model-dependent, and a blind 'none' would replace one incompatibility with another.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.