diff --git a/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx b/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx index ada39f81c6e..8d555b0cff9 100644 --- a/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/settings/AgentBehaviourTab.tsx @@ -239,7 +239,12 @@ const AgentBehaviourTab: Component = () => { current={defaultAgentOptions().find((o) => o.value === (config().default_agent ?? ""))} value={(o) => o.value} label={(o) => o.label} - onSelect={(o) => o && updateConfig({ default_agent: o.value || undefined })} + onSelect={(o) => { + if (!o) return + const next = o.value || undefined + if (next === (config().default_agent ?? undefined)) return + updateConfig({ default_agent: next }) + }} variant="secondary" size="small" triggerVariant="settings" diff --git a/packages/kilo-vscode/webview-ui/src/components/settings/DisplayTab.tsx b/packages/kilo-vscode/webview-ui/src/components/settings/DisplayTab.tsx index 9ba75d67b3c..812209e7c91 100644 --- a/packages/kilo-vscode/webview-ui/src/components/settings/DisplayTab.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/settings/DisplayTab.tsx @@ -46,7 +46,12 @@ const DisplayTab: Component = () => { current={LAYOUT_OPTIONS.find((o) => o.value === (config().layout ?? "auto"))} value={(o) => o.value} label={(o) => language.t(o.labelKey)} - onSelect={(o) => o && updateConfig({ layout: o.value as "auto" | "stretch" })} + onSelect={(o) => { + if (!o) return + const next = o.value as "auto" | "stretch" + if (next === (config().layout ?? "auto")) return + updateConfig({ layout: next }) + }} variant="secondary" size="small" triggerVariant="settings" diff --git a/packages/kilo-vscode/webview-ui/src/components/settings/ExperimentalTab.tsx b/packages/kilo-vscode/webview-ui/src/components/settings/ExperimentalTab.tsx index 94d0ec10b18..4f060d2e0df 100644 --- a/packages/kilo-vscode/webview-ui/src/components/settings/ExperimentalTab.tsx +++ b/packages/kilo-vscode/webview-ui/src/components/settings/ExperimentalTab.tsx @@ -43,7 +43,12 @@ const ExperimentalTab: Component = () => { current={SHARE_OPTIONS.find((o) => o.value === (config().share ?? "manual"))} value={(o) => o.value} label={(o) => language.t(o.labelKey)} - onSelect={(o) => o && updateConfig({ share: o.value as "manual" | "auto" | "disabled" })} + onSelect={(o) => { + if (!o) return + const next = o.value as "manual" | "auto" | "disabled" + if (next === (config().share ?? "manual")) return + updateConfig({ share: next }) + }} variant="secondary" size="small" triggerVariant="settings" diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 540e9976db1..b86631ad398 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -1553,17 +1553,19 @@ export namespace Config { global.reset() - void Instance.disposeAll() - .catch(() => undefined) - .finally(() => { - GlobalBus.emit("event", { - directory: "global", - payload: { - type: Event.Disposed.type, - properties: {}, - }, - }) - }) + // kilocode_change start - only reset config cache, don't dispose all instances. + // Instance.disposeAll() was destroying all session state, MCP connections, and + // in-flight operations across every project whenever any global config changed + // (e.g. removing a mode). The cache reset above is sufficient — consumers will + // pick up the new config on their next read. + GlobalBus.emit("event", { + directory: "global", + payload: { + type: Event.Disposed.type, + properties: {}, + }, + }) + // kilocode_change end return next }