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.
This commit is contained in:
can1357
2026-05-31 06:48:30 +02:00
parent 1f82d0eedd
commit d767bd2b75
@@ -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, {