fix(coding-agent): preserve session thinking for scoped model cycling

closes #1789
This commit is contained in:
Mario Zechner 2026-03-04 19:51:55 +01:00
parent 4cb1a56b53
commit e64cd15c25
6 changed files with 22 additions and 17 deletions

View file

@ -15,7 +15,6 @@ import { listModels } from "./cli/list-models.js";
import { selectSession } from "./cli/session-picker.js";
import { APP_NAME, getAgentDir, getModelsPath, VERSION } from "./config.js";
import { AuthStorage } from "./core/auth-storage.js";
import { DEFAULT_THINKING_LEVEL } from "./core/defaults.js";
import { exportFromFile } from "./core/export-html/index.js";
import type { LoadExtensionsResult } from "./core/extensions/index.js";
import { KeybindingsManager } from "./core/keybindings.js";
@ -488,12 +487,13 @@ function buildSessionOptions(
options.thinkingLevel = parsed.thinking;
}
// Scoped models for Ctrl+P cycling - fill in default thinking level for models without explicit level
// Scoped models for Ctrl+P cycling
// Keep thinking level undefined when not explicitly set in the model pattern.
// Undefined means "inherit current session thinking level" during cycling.
if (scopedModels.length > 0) {
const defaultThinkingLevel = settingsManager.getDefaultThinkingLevel() ?? DEFAULT_THINKING_LEVEL;
options.scopedModels = scopedModels.map((sm) => ({
model: sm.model,
thinkingLevel: sm.thinkingLevel ?? defaultThinkingLevel,
thinkingLevel: sm.thinkingLevel,
}));
}