Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- Fixed the temporary model selector (`Alt+P` / `/switch` / `/model --temporary`) ignoring custom role-specific thinking level overrides from `config.yml` (e.g. `:high`), reverting to the model's native default level instead
- Improved search reliability for Perplexity provider by forcing retrieval for all queries
- Fixed JS eval cells losing top-level `function` and `var` declarations across cells when the defining cell contained top-level `await` — the async wrapper scoped them to the cell's IIFE instead of publishing them to the worker global

Expand Down
31 changes: 29 additions & 2 deletions packages/coding-agent/src/modes/controllers/selector-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import {
resolveAdvisorConfigEditPath,
saveWatchdogConfigFile,
} from "../../advisor";
import { formatModelSelectorValue, resolveAdvisorRoleSelection } from "../../config/model-resolver";
import {
formatModelSelectorValue,
getModelMatchPreferences,
resolveAdvisorRoleSelection,
resolveModelRoleValue,
} from "../../config/model-resolver";
import { getRoleInfo } from "../../config/model-roles";
import { settings } from "../../config/settings";
import { disableProvider, enableProvider } from "../../discovery";
Expand Down Expand Up @@ -688,8 +693,30 @@ export class SelectorController {
},
onPick: async (model, selector) => {
try {
// Resolve configured thinking level from settings roles if it matches this model
const availableModels = this.ctx.session.modelRegistry.getAvailable();
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().

const resolved = resolveModelRoleValue(roleModelStr, availableModels, {
settings: this.ctx.settings,
matchPreferences,
});
if (
resolved.model &&
resolved.model.provider === model.provider &&
resolved.model.id === model.id
) {
if (resolved.explicitThinkingLevel && resolved.thinkingLevel !== undefined) {
resolvedThinkingLevel = resolved.thinkingLevel;
break;
}
}
}

// Session-only: update agent state but don't persist the model to settings.
await this.ctx.session.setModelTemporary(model);
await this.ctx.session.setModelTemporary(model, resolvedThinkingLevel);
this.ctx.statusLine.invalidate();
this.ctx.updateEditorBorderColor();
const roleSelectorHint = this.ctx.keybindings.getKeys("app.model.select")[0] ?? "Alt+M";
Expand Down