Skip to content

fix(thinking): normalize disabled level-only models - #5768

Open
smartershining wants to merge 1 commit into
router-for-me:devfrom
smartershining:fix/thinking-disabled-level-only
Open

smartershining wants to merge 1 commit into
router-for-me:devfrom
smartershining:fix/thinking-disabled-level-only

Conversation

@smartershining

Copy link
Copy Markdown

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=disabled currently falls into the numeric budget path with a zero budget, which emits the misleading warning thinking: budget zero not allowed and relies on unsorted provider metadata for its fallback.

This change:

  • keeps none unchanged when the model explicitly supports it;
  • maps none to the canonical lowest supported level when a pure level-only model cannot disable thinking;
  • preserves the existing budget fallback for hybrid models;
  • avoids sending a level-only disabled sentinel through numeric budget clamping.

Tests

  • go test -count=1 ./internal/thinking ./internal/thinking/provider/openai ./test
  • go build -buildvcs=false -trimpath -o /tmp/cpa-pr1-build ./cmd/server

@github-actions

Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@github-actions
github-actions Bot changed the base branch from main to dev September 12, 2026 14:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant