fix(desktop): disabling a provider's last model no longer re-enables all toggles - #44170
Closed
xxxigm wants to merge 2 commits into
Closed
fix(desktop): disabling a provider's last model no longer re-enables all toggles#44170xxxigm wants to merge 2 commits into
xxxigm wants to merge 2 commits into
Conversation
The model-visibility dialog re-seeded a provider's default models whenever the stored set had zero keys for that provider. That heuristic exists to surface genuinely new providers by default, but it could not distinguish a new provider from one the user had intentionally emptied — so disabling the last enabled model of a provider (e.g. the final Anthropic model) snapped every toggle back on. Track the providers the user has already customized in a separate `$knownProviders` set. `effectiveVisibleKeys` now only seeds defaults for a zero-key provider when it is NOT known; a known provider that drops to zero visible models stays empty. New providers (absent from the known set) are still seeded so they appear by default after an update adds them.
Add regression coverage for the empty-provider case: a known provider whose last model was hidden stays empty, a brand-new provider absent from the known set is still seeded visible, and setVisibleModels unions known provider slugs across customizations (so a partial provider list never drops a known slug).
Collaborator
Collaborator
|
Closing as superseded by #50100 (merged: commit 8ca38d3), which fixes the same cross-provider model-visibility snap-back. This PR targets the pre-#43496 code and takes a heavier approach (a new $knownProviders store plus signature changes to effectiveVisibleKeys/setVisibleModels); the merged fix builds on the #43496 sentinel design with a smaller, contained change. Thanks for the report and the effort on this bug class. |
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
In the desktop Models visibility dialog, disabling the last enabled model of a provider (e.g. the final Anthropic model) made every toggle for that provider snap back on. As reported, this happens for any provider — emptying one resets it to all-visible.
Root cause
effectiveVisibleKeysre-seeds a provider's curated defaults whenever the stored visible-set has zero keys for that provider:That heuristic exists for a good reason — to surface a genuinely new provider by default after an update adds it. But it can't tell a new provider apart from one the user intentionally emptied: both look like "zero stored keys." So hiding a provider's last model drops it to zero keys → next render re-seeds all of its defaults → every toggle flips back on.
Fix
Track the providers the user has already customized in a new
$knownProvidersset (persisted alongside the visible set, unioned so a partial/transient provider list never drops a slug).effectiveVisibleKeysnow seeds a zero-key provider's defaults only when it is not known:The dialog and the status-bar model menu both pass the known set through; the toggle handler records the on-screen providers as known on every customization.
Test plan
apps/desktop/src/store/model-visibility.test.ts(run via repo-rootvitest):setVisibleModelsunions known provider slugs across customizations.