Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 13 additions & 11 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Existing instances keep using the old global config

global.reset() only invalidates the lazy result from Config.global(). Every open project still has its merged config cached in Config.state() via Instance.state(), so removing Instance.disposeAll() means active sessions keep stale modes, providers, and other global settings until that instance is explicitly disposed or the server restarts.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markijbema true?

directory: "global",
payload: {
type: Event.Disposed.type,
properties: {},
},
})
// kilocode_change end

return next
}
Expand Down
Loading