fix provider switch not presistingin session (#903)

* fix provider switch not presistingin session

* fix broken tests
This commit is contained in:
Kevin Codex
2026-04-26 11:15:25 +08:00
committed by GitHub
parent af9a3caa4d
commit d9ae56bc58
7 changed files with 134 additions and 39 deletions

View File

@@ -77,6 +77,7 @@ import {
import { notifyCommandLifecycle } from './utils/commandLifecycle.js'
import { headlessProfilerCheckpoint } from './utils/headlessProfiler.js'
import {
getDefaultMainLoopModelSetting,
getRuntimeMainLoopModel,
renderModelName,
} from './utils/model/model.js'
@@ -604,9 +605,13 @@ async function* queryLoop(
const appState = toolUseContext.getAppState()
const permissionMode = appState.toolPermissionContext.mode
const appStateMainLoopModel =
appState.mainLoopModelForSession ??
appState.mainLoopModel ??
getDefaultMainLoopModelSetting()
let currentModel = getRuntimeMainLoopModel({
permissionMode,
mainLoopModel: toolUseContext.options.mainLoopModel,
mainLoopModel: appStateMainLoopModel,
exceeds200kTokens:
permissionMode === 'plan' &&
doesMostRecentAssistantMessageExceed200k(messagesForQuery),