From 7d776b9dcd6f4d58dcbf46905ab4d96d553eb89d Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Mon, 20 Apr 2026 09:40:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dsettings.json=E5=86=85?= =?UTF-8?q?=E5=AD=98=E7=8A=B6=E6=80=81=E6=BA=A2=E5=87=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/state/onChangeAppState.ts | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/state/onChangeAppState.ts b/src/state/onChangeAppState.ts index a84d98da0..2d94830b6 100644 --- a/src/state/onChangeAppState.ts +++ b/src/state/onChangeAppState.ts @@ -17,7 +17,6 @@ import { notifySessionMetadataChanged, type SessionExternalMetadata, } from '../utils/sessionState.js' -import { updateSettingsForSource } from '../utils/settings/settings.js' import type { AppState } from './AppStateStore.js' // Inverse of the push below — restore on worker restart. @@ -91,23 +90,11 @@ export function onChangeAppState({ notifyPermissionModeChanged(newMode) } - // mainLoopModel: remove it from settings? - if ( - newState.mainLoopModel !== oldState.mainLoopModel && - newState.mainLoopModel === null - ) { - // Remove from settings - updateSettingsForSource('userSettings', { model: undefined }) - setMainLoopModelOverride(null) - } - - // mainLoopModel: add it to settings? - if ( - newState.mainLoopModel !== oldState.mainLoopModel && - newState.mainLoopModel !== null - ) { - // Save to settings - updateSettingsForSource('userSettings', { model: newState.mainLoopModel }) + // mainLoopModel: session-scoped only (do NOT persist to userSettings). + // Writing to settings.json would leak model changes into other running + // sessions (anthropics/claude-code#37596). Each process keeps its own + // model override in memory via setMainLoopModelOverride. + if (newState.mainLoopModel !== oldState.mainLoopModel) { setMainLoopModelOverride(newState.mainLoopModel) }