fix(thinking): normalize disabled level-only models - #5768
smartershining wants to merge 1 commit into
Conversation
|
This pull request targeted The base branch has been automatically changed to |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 446727b405
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| config.Budget = 0 | ||
| if cannotDisableLevelModel { | ||
| config.Mode = ModeLevel | ||
| config.Level = clampLevel(LevelMinimal, modelInfo, toFormat) |
There was a problem hiding this comment.
Preserve provider-specific supported fallback levels
When a configured level-only model advertises only a provider-specific effort such as Levels: []string{"ultra"}, clampLevel(LevelMinimal, ...) ignores every unrecognized level and returns minimal, even though that value is not supported. Because this fallback is generated after level validation, the provider applier sends the invalid effort upstream; preserve an advertised fallback or validate the generated level before returning.
AGENTS.md reference: AGENTS.md:L25-L29
Useful? React with 👍 / 👎.
Summary
Normalize an explicit disabled-thinking request for pure level-only models before numeric budget clamping.
Some OpenAI-compatible models expose only reasoning levels and do not support disabling reasoning. A Claude request with
thinking.type=disabledcurrently falls into the numeric budget path with a zero budget, which emits the misleading warningthinking: budget zero not allowedand relies on unsorted provider metadata for its fallback.This change:
noneunchanged when the model explicitly supports it;noneto the canonical lowest supported level when a pure level-only model cannot disable thinking;Tests
go test -count=1 ./internal/thinking ./internal/thinking/provider/openai ./testgo build -buildvcs=false -trimpath -o /tmp/cpa-pr1-build ./cmd/server