fix: "No chat model selected" error on startup#11672
Open
Conversation
Three fixes for the model selection bugs reported in #11656 and 12+ related issues: 1. Fix loadConfig() init ordering: await isInitialized before checking currentProfile, consistent with getSerializedConfig(). Prevents returning config: undefined during initialization race. 2. Avoid full config reload on model selection: The config/updateSelectedModel handler now updates the model in the cached config in-place instead of doing a full reloadConfig(). This eliminates the window where selectedModelByRole.chat is null during reload, and prevents the configUpdate from core overwriting the GUI's optimistic selection. 3. Guard against undefined config in GUI: handleConfigUpdate now also checks !configResult.config alongside configLoadInterrupted, preventing EMPTY_CONFIG (with chat: null) from being applied.
Two fixes for the "No chat model selected" error reported in #11656 and 12+ related issues across all providers: 1. Fix loadConfig() init ordering (ConfigHandler.ts): Move `await this.isInitialized` before the `!this.currentProfile` check, matching the pattern already used in getSerializedConfig(). Without this, loadConfig() called during initialization returns config: undefined because currentProfile hasn't been set yet. 2. Guard against undefined config in GUI (ParallelListeners.tsx): handleConfigUpdate now also checks `!configResult.config` alongside configLoadInterrupted, preventing EMPTY_CONFIG (with selectedModelByRole.chat: null) from being applied.
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.
Race condition during initialization:
loadConfig()checkedthis.currentProfilebeforeawait this.isInitialized, returningconfig: undefinedbefore the profile was set. The GUI then appliedEMPTY_CONFIGwithselectedModelByRole.chat: null.loadConfig()to await init before checking profile (matchesgetSerializedConfig())!configResult.configin GUI'shandleConfigUpdateFixes #11636
Fixes #11656
Fixes #11661
Fixes #11591
Fixes #11627
Fixes #11605
Fixes #11614
Fixes #11572
Fixes #11512
Fixes #11533
Fixes #11520
Fixes #11515
Fixes #11514