Skip to content

fix(coding-agent): respect role thinking for temporary model picks#5297

Open
roboomp wants to merge 1 commit into
mainfrom
farm/bcdb5392/alt-p-thinking-overrides
Open

fix(coding-agent): respect role thinking for temporary model picks#5297
roboomp wants to merge 1 commit into
mainfrom
farm/bcdb5392/alt-p-thinking-overrides

Conversation

@roboomp

@roboomp roboomp commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Repro

A focused session repro configured modelRoles.smol = google-antigravity/gemini-3.5-flash:high, verified the role resolver returned high, then called setModelTemporary(selectedModel) as the temporary picker did. Before the fix, bun test tmp-repro-5290.test.ts failed with Expected: "high"; Received: undefined for session.thinkingLevel.

Cause

packages/coding-agent/src/modes/controllers/selector-controller.ts handled the Model Hub onPick callback by calling session.setModelTemporary(model) without resolving explicit thinking metadata from configured roles. AgentSession.setModelTemporary() only applies a thinking level when its caller passes one, so the temporary picker bypassed the same role-thinking resolution used by role cycling in AgentSession.getRoleModelCycle() / applyRoleModel().

Fix

  • Added AgentSession.resolveTemporaryModelThinkingLevel() to scan configured model roles, resolve their model selectors with existing match preferences, and return the explicit thinking suffix when a temporary pick matches that role's resolved model.
  • Updated the temporary Model Hub picker (Alt+P, /switch, /model --temporary) to pass that resolved thinking level into setModelTemporary() while keeping the switch session-only.
  • Added regression coverage for google-antigravity/gemini-3.5-flash:high so temporary picks apply the role override instead of falling back to the model/default thinking state.
  • Updated the coding-agent changelog under [Unreleased].

Verification

bun test packages/coding-agent/test/agent-session-role-thinking.test.ts -t temporary passed with 1 test, 5 assertions. bun test packages/coding-agent/test/agent-session-role-thinking.test.ts passed with 20 tests, 112 assertions. bun run check in packages/coding-agent passed. Fixes #5290

Applied explicit thinking suffixes from matching configured model roles when the temporary model picker switches the session model.

Added regression coverage for the Alt+P temporary picker resolution path.

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

Labels

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

1 participant