Skip to content

fix(desktop): disabling a provider's last model no longer re-enables all toggles - #44170

Closed
xxxigm wants to merge 2 commits into
NousResearch:mainfrom
xxxigm:fix/model-visibility-last-toggle-snapback
Closed

fix(desktop): disabling a provider's last model no longer re-enables all toggles#44170
xxxigm wants to merge 2 commits into
NousResearch:mainfrom
xxxigm:fix/model-visibility-last-toggle-snapback

Conversation

@xxxigm

@xxxigm xxxigm commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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

effectiveVisibleKeys re-seeds a provider's curated defaults whenever the stored visible-set has zero keys for that provider:

const hasStoredProvider = [...stored].some(key => key.startsWith(providerPrefix))
if (hasStoredProvider) continue
// ...seed this provider's default models...

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 $knownProviders set (persisted alongside the visible set, unioned so a partial/transient provider list never drops a slug). effectiveVisibleKeys now seeds a zero-key provider's defaults only when it is not known:

  • Known provider with zero visible keys → user deliberately hid everything → stays empty (the bug).
  • New provider absent from the known set → still seeded visible (feature preserved).

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-root vitest):

  • Existing: new provider with stale stored choices stays visible.
  • Existing: a provider with stored choices isn't re-seeded.
  • New: a known provider whose last model was hidden stays empty (no snap-back).
  • New: a brand-new provider absent from the known set is still seeded visible.
  • New: setVisibleModels unions known provider slugs across customizations.
vitest run --config apps/desktop/vite.config.ts apps/desktop/src/store/model-visibility.test.ts
# Test Files 1 passed (1) — Tests 5 passed (5)
tsc --noEmit -p apps/desktop/tsconfig.json   # 0 errors

xxxigm added 2 commits June 11, 2026 16:38
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).
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #43496 (same root cause/fix for #43485 — distinguish a user-emptied provider from a genuinely new one). #43496 is the earlier open canonical; #43492/#43542 already closed as dupes of it. Non-core desktop UX.

@kshitijk4poor

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants