From d767bd2b752b6039db81f2b37098cbbbb11314f3 Mon Sep 17 00:00:00 2001 From: can1357 Date: Sun, 31 May 2026 06:48:30 +0200 Subject: [PATCH] fix(coding-agent): defaulted approval slider to `default` tier - Previously the slider started at the current cycle index, so execution would inherit whichever model drove planning. - Now finds the `default` role in the cycle and anchors the slider there, falling back to `currentIndex` if no default exists. - Explicit `executionModel` is set whenever the chosen tier differs from the restored cycle position, covering the case where the slider stays on `default` but planning ran on another model. --- .../coding-agent/src/modes/interactive-mode.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/coding-agent/src/modes/interactive-mode.ts b/packages/coding-agent/src/modes/interactive-mode.ts index 383217c15..508157328 100644 --- a/packages/coding-agent/src/modes/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive-mode.ts @@ -2040,16 +2040,20 @@ export class InteractiveMode implements InteractiveModeContext { : "Approve and keep context"; // Model-tier slider: let the operator pick which configured role model - // (smol/default/slow/…) executes the approved plan. Left/right move it from - // any list position. Hidden when fewer than two role models resolve — a lone - // tier is no choice. `selectedTierIndex` tracks the live slider position. + // (smol/default/slow/…) executes the approved plan. The slider always starts + // on the `default` tier so execution defaults to the default model no matter + // which model drove the planning conversation. Left/right move it from there; + // hidden when fewer than two role models resolve — a lone tier is no choice. + // `selectedTierIndex` tracks the live slider position. const cycle = this.session.getRoleModelCycle(this.session.settings.get("cycleOrder")); - let selectedTierIndex = cycle?.currentIndex ?? 0; + const defaultTierIndex = cycle ? cycle.models.findIndex(entry => entry.role === "default") : -1; + const startTierIndex = defaultTierIndex >= 0 ? defaultTierIndex : (cycle?.currentIndex ?? 0); + let selectedTierIndex = startTierIndex; const slider: HookSelectorSlider | undefined = cycle && cycle.models.length > 1 ? { caption: "continue with", - index: cycle.currentIndex, + index: startTierIndex, segments: cycle.models.map(entry => ({ label: entry.role, color: MODEL_ROLES[entry.role as ModelRole]?.color, @@ -2086,6 +2090,9 @@ export class InteractiveMode implements InteractiveModeContext { // applying the slider choice any earlier would be silently reverted — // the bug that made "continue with slow" keep executing on the default // model. Deferred application also survives newSession()/compaction. + // `cycle.currentIndex` is exactly that restored model, so any chosen tier + // differing from it needs an explicit executionModel — this also covers + // leaving the slider on its `default` anchor while planning ran elsewhere. const executionModel = cycle && selectedTierIndex !== cycle.currentIndex ? cycle.models[selectedTierIndex] : undefined; await this.#approvePlan(latestPlanContent, {