fix: clear llmConfig when all LLM presets are deactivated#490
Merged
nashsu merged 1 commit intoJun 28, 2026
Merged
Conversation
When the last active preset is toggled off, persist() only saved activePresetId=null but never updated llmConfig. Background queues (ingest, dedup, sweep) call hasUsableLlm(llmConfig), which still saw the previous provider's config and continued running. Add an else branch that resets provider/apiKey to a state where hasUsableLlm() returns false, pausing all queue processing. resolveConfig() on re-enable reads from providerConfigs[], so the cleared values do not corrupt the user's saved per-provider settings.
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.
Problem
When the user toggles off the last active LLM preset,
toggleActive()setsactivePresetIdtonulland callspersist(providerConfigs, null). Insidepersist(), theif (newActive)block is skipped, sosetLlmConfig()andsaveLlmConfig()are never called.The result:
llmConfigin the store still holds the previous provider's config. Background queues (ingest-queue,dedup-queue,sweep-reviews,clip-watcher) all guard themselves withhasUsableLlm(llmConfig), which reads from the un-updatedllmConfigand continues to returntrue— so processing carries on even though the user explicitly disabled all providers.This is most visible with keyless providers (Claude Code CLI, Codex CLI, Ollama): turning them off has no observable effect on ingest.
Fix
Add an
elsebranch topersist()that, whennewActive === null, writesllmConfigto a state wherehasUsableLlm()returnsfalse:Setting
providerto"openai"(a keyed provider) and clearingapiKeymakeshasUsableLlm()returnfalseregardless of what the previous provider was — including keyless local CLI providers thathasUsableLlmwould otherwise always pass.resolveConfig()is safe: on re-enable it readsproviderandapiKeyfromproviderConfigs[newActive](the user's saved per-preset settings), not fromllmConfig, so the cleared values here do not affect the user's stored configuration.Testing
activePresetIdbecomesnull.