Skip to content

fix(coding-agent): resolve thinking level overrides in temporary model switcher#5291

Open
PGupta-Git wants to merge 2 commits into
can1357:mainfrom
PGupta-Git:fix/select-temporary-thinking-override
Open

fix(coding-agent): resolve thinking level overrides in temporary model switcher#5291
PGupta-Git wants to merge 2 commits into
can1357:mainfrom
PGupta-Git:fix/select-temporary-thinking-override

Conversation

@PGupta-Git

Copy link
Copy Markdown

What

  • Resolves configured thinking level overrides from config.yml when picking a model temporarily (e.g. Alt+P or /switch).
  • Gracefully handles missing docs/ directory in generate-docs-index.ts so the build/bundle works outside the monorepo context.

Why

Fixes #5290. When switching a model temporarily via Alt+P or /switch, the switcher immediately sets the session model to its native default reasoning level (e.g., medium for google-antigravity/gemini-3.5-flash), completely ignoring custom role-specific thinking level overrides defined in config.yml (e.g. smol: google-antigravity/gemini-3.5-flash:high or tiny: google-antigravity/gemini-3.5-flash:high).

With this change, the switcher looks up your role configurations in config.yml to see if a custom thinking level (like :high) is configured for the selected model, and applies it.

Testing

  • Verified resolution behavior against mock configurations.
  • Verified that bun run check:types and Biome checks pass cleanly.
  • Updated packages/coding-agent/CHANGELOG.md.

  • bun check passes
  • Tested locally
  • CHANGELOG updated (if user-facing)

@github-actions github-actions Bot added the vouched Passed the vouch gate label Jul 12, 2026

@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: 7c28eed36e

ℹ️ 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".

Comment thread packages/coding-agent/src/modes/controllers/selector-controller.ts Outdated
Iterating only MODEL_ROLE_IDS missed any user-defined roles (e.g.
modelRoles.review, modelRoles.coding) because that constant only lists
the built-in set. Switch to settings.getModelRoles() which returns
every configured role string, built-in and custom alike, making the
temporary-switcher override lookup complete.

Addresses review feedback on can1357#5291.
@PGupta-Git

Copy link
Copy Markdown
Author

Good catch @chatgpt-codex-connector. Fixed in e5624e0 — replaced the MODEL_ROLE_IDS iteration + getModelRole(role) per-entry with a single Object.entries(this.ctx.settings.getModelRoles()) call, which returns every configured role string (built-in and custom) directly. The MODEL_ROLE_IDS import is also cleaned up since it's no longer needed in this file.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@roboomp roboomp added cli CLI commands and arguments fix review:p3 triaged tui Terminal UI rendering and display labels Jul 14, 2026

@roboomp roboomp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P3 — superseded by merged PR #5297 (a57244830), which fixes the same temporary-picker path in AgentSession and adds regression coverage.
This implementation also scans only built-in MODEL_ROLE_IDS, leaving custom configured roles unfixed; see the inline finding.
Thanks for the focused report and patch.

const matchPreferences = getModelMatchPreferences(this.ctx.settings);
let resolvedThinkingLevel: ConfiguredThinkingLevel | undefined;

for (const [, roleModelStr] of Object.entries(this.ctx.settings.getModelRoles())) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

blocking: MODEL_ROLE_IDS contains only the ten built-in roles, while Settings.getModelRoles() may contain custom roles and getKnownRoleIds(settings) is the existing enumeration that includes them. A model assigned only as modelRoles.critic: …:high therefore never reaches this loop, so the temporary picker still falls back to the model default. Please resolve across the known/configured roles rather than the static built-in list; merged PR #5297 does this in AgentSession.resolveTemporaryModelThinkingLevel().

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

Labels

cli CLI commands and arguments fix review:p3 triaged tui Terminal UI rendering and display vouched Passed the vouch gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Alt+P temporary switcher ignores custom role thinking level overrides

2 participants