fix(coding-agent): fixed alt-m default over context

Decoupled default-role persistence from live model switching when the selected model is below the current session context window.

Updated the model selector regression coverage so the Alt+M Default action remains selectable and advances to thinking selection.

Fixes #3708
This commit is contained in:
roboomp
2026-06-28 07:04:31 +00:00
parent da07a3ac5f
commit 3765d80cbc
6 changed files with 62 additions and 61 deletions
@@ -540,19 +540,28 @@ export class SelectorController {
done();
this.ctx.ui.requestRender();
} else if (role === "default") {
// Default: update agent state and persist
const contextWindow = model.contextWindow ?? 0;
const switchActiveModel =
currentContextTokens <= 0 || contextWindow <= 0 || currentContextTokens <= contextWindow;
await this.ctx.session.setModel(model, role, {
selector,
thinkingLevel: concreteThinking,
persist: true,
switchActiveModel,
});
if (isAuto) {
this.ctx.session.setThinkingLevel(AUTO_THINKING, true);
} else if (concreteThinking && concreteThinking !== ThinkingLevel.Inherit) {
if (switchActiveModel) {
this.ctx.session.setThinkingLevel(AUTO_THINKING, true);
} else {
this.ctx.settings.set("defaultThinkingLevel", AUTO_THINKING);
}
} else if (switchActiveModel && concreteThinking && concreteThinking !== ThinkingLevel.Inherit) {
this.ctx.session.setThinkingLevel(concreteThinking);
}
this.ctx.statusLine.invalidate();
this.ctx.updateEditorBorderColor();
if (switchActiveModel) {
this.ctx.statusLine.invalidate();
this.ctx.updateEditorBorderColor();
}
this.ctx.showStatus(`Default model: ${selector ?? model.id}`);
// Don't call done() - selector stays open for role assignment
} else {