fix(vscode): stop config update loop from flooding SSE and killing server - #7172
Merged
Conversation
Config.updateGlobal() was calling Instance.disposeAll() on every config change, which destroyed all session state, MCP connections, and in-flight operations across every project. This meant that any config change (e.g. removing a mode in VS Code) would effectively kill all running CLI instances. The global.reset() call already clears the config cache so consumers will pick up the new config on their next read. The disposeAll() was unnecessary overkill.
markijbema
force-pushed
the
mark/fix-global-config-dispose-all
branch
from
March 17, 2026 11:22
b004c16 to
13ff40c
Compare
Kobalte's Select fires onChange when the options list changes (even if the selected value is the same), which triggers updateConfig → PATCH /global/config → global.disposed → configLoaded → new options array → onChange again, creating an infinite loop that floods SSE with events and kills the server. Add guards to all three settings Select components to skip updateConfig when the new value equals the current config value.
markijbema
marked this pull request as ready for review
March 17, 2026 11:59
| // 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", { |
Contributor
There was a problem hiding this comment.
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.
Contributor
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)No additional issues found outside the diff. Files Reviewed (4 files)
Reviewed by gpt-5.4-20260305 · 491,849 tokens |
chrarnoldus
approved these changes
Mar 17, 2026
This was referenced Mar 17, 2026
jliounis
pushed a commit
to jliounis/kilocode
that referenced
this pull request
May 18, 2026
…-dispose-all fix(vscode): stop config update loop from flooding SSE and killing server
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
…-dispose-all fix(vscode): stop config update loop from flooding SSE and killing server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two fixes for the settings panel flooding the server with events and killing it:
Stop
Instance.disposeAll()from being called on every global config update. Previously,Config.updateGlobal()would nuke all running CLI instances (destroying session state, MCP connections, and in-flight operations across every project) whenever any global config changed. Theglobal.reset()call already clears the config cache so consumers pick up the new config on their next read. ThedisposeAll()was unnecessary overkill.Break infinite loop caused by Kobalte Select firing
onChangeon options list changes. Kobalte'sSelecthas an internalcreateEffectthat re-filters selected keys wheneverflattenOptionKeyschanges. When aglobal.disposedorserver.instance.disposedSSE event arrives, the extension re-fetches config and pushesconfigLoadedto the webview. Solid creates new array references for the options, Kobalte detects the change, firesonChangewith the same value, which callsupdateConfig→ PATCH/global/config→ emitsglobal.disposed→ loop. WithallowDuplicateSelectionEvents: true(Kobalte's default), this fires even when the value hasn't changed.The loop
Fix
Instance.disposeAll()fromupdateGlobal()(separate correctness fix — this was collateral damage on each loop iteration, not the cause)SelectonSelecthandlers to skipupdateConfigwhen the new value equals the current config value, breaking the loop