Skip to content

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage #47450) - #50100

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/model-visibility-cross-provider-47450
Jun 21, 2026
Merged

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage #47450)#50100
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/model-visibility-cross-provider-47450

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Emptying every model for a provider in the Edit Models dialog now stays empty when you touch a different provider — the cross-provider gap left by #43496 (which only fixed the single-provider case of #43485).

Root cause: effectiveVisibleKeys() strips all hide-all sentinels (correct for display), but the dialog's toggle() seeded its working set from effectiveVisibleKeys() and then persisted it — so every toggle silently discarded every other provider's sentinel. On the next render those providers looked "never customized" and had their curated defaults re-added.

Salvage of #47450 by @cyb0rgk1tty (David Doan), cherry-picked onto current main with authorship preserved, plus a follow-up hardening commit by me.

Changes

  • model-visibility.ts (contributor): split resolveVisibleKeys(stored, providers) — the canonical working set with sentinels preserved — from effectiveVisibleKeys() (display, sentinels stripped, contract unchanged). Extract the dialog's toggle logic into a pure toggleModelVisibility() seeded from resolveVisibleKeys(), so sibling sentinels survive the persist.
  • model-visibility-dialog.tsx (contributor): dialog now just calls setVisibleModels(toggleModelVisibility(...)).
  • follow-up (mine): extract expandProviderDefaults() so the curated-default expansion rule lives in one place (was duplicated between defaultVisibleKeys and resolveVisibleKeys); drop a redundant new Set() wrap; document the intentional re-enable-restores-only-that-model behavior; tighten JSDoc; add 7 hardening tests (round-trip re-hide, empty-non-null stored, single toggle-off from defaults, zero-model provider, direct resolveVisibleKeys null/empty asserts).

Validation

Before (main) After
Hide-all provider A, toggle provider B A snaps back on ❌ A stays hidden ✓
effectiveVisibleKeys display contract unchanged ✓
  • Bug reproduced on main by replaying the old inline toggle logic (cross-provider snap-back confirmed).
  • npx vitest run --environment jsdom src/store/model-visibility.test.ts18 passed (11 original + 7 new).
  • Full src/store/ suite → 192 passed (20 files), no regressions.
  • npm run typecheck clean. eslint clean on all changed files.

Follow-up to #43496; completes the fix for #43485 (cross-provider case). Closes #47450 (salvaged here with authorship preserved). Supersedes the stale #44170, which targets the same bug class against pre-#43496 code with a heavier $knownProviders-store approach.

David Doan and others added 2 commits June 21, 2026 15:42
…dialog

NousResearch#43496 added a per-provider hide-all sentinel ('provider::') so emptying a provider in the Edit Models dialog stopped re-expanding its defaults. That fixed the single-provider case, but the dialog's toggle handler seeds its working set from effectiveVisibleKeys(), which strips ALL sentinels before returning. So persisting after any toggle silently dropped every OTHER provider's hide-all sentinel; those providers then looked 'never customized' and re-enabled all their models on the next render.

Split resolution into two functions:

- resolveVisibleKeys(): stored keys + curated default expansion, with hide-all sentinels PRESERVED — the canonical working set the toggle handler mutates and persists.

- effectiveVisibleKeys(): resolveVisibleKeys() then strips sentinels, for display only (unchanged contract).

Move the toggle set-computation into a pure, unit-tested toggleModelVisibility() that seeds from resolveVisibleKeys(), so sibling sentinels survive the persist. Add regression tests that drive the real toggle handler across multiple providers.

Follow-up to NousResearch#43496; completes the fix for NousResearch#43485 (cross-provider case).
Follow-up to the salvaged NousResearch#47450 fix:
- Extract expandProviderDefaults() so the curated-default expansion rule
  lives in one place (was duplicated between defaultVisibleKeys and
  resolveVisibleKeys).
- Drop the redundant new Set() wrap in toggleModelVisibility (resolveVisibleKeys
  already returns a fresh Set; effectiveVisibleKeys already relied on this).
- Document the intentional re-enable behavior (re-enabling one model of a
  hidden-all provider restores only that model, not the curated defaults) and
  tighten the toggleModelVisibility JSDoc.
- Add 7 hardening tests: re-enable-restores-only-that-model, full hide/re-enable
  round-trip, empty-non-null stored, single toggle-off from null defaults,
  zero-model provider, and direct resolveVisibleKeys null/empty assertions.
@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists labels Jun 21, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related: #47450 (the predecessor this salvages, by @cyb0rgk1tty), #43496 (merged fix for the single-provider case), #43485 (original bug report). This PR extends the fix to the cross-provider case that #43496 left open, with authorship preserved plus a follow-up hardening commit.

@kshitijk4poor
kshitijk4poor enabled auto-merge June 21, 2026 10:24
@kshitijk4poor
kshitijk4poor merged commit 8ca38d3 into NousResearch:main Jun 21, 2026
35 checks passed
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…l-visibility-cross-provider-47450

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage NousResearch#47450)
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…l-visibility-cross-provider-47450

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage NousResearch#47450)
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…l-visibility-cross-provider-47450

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage NousResearch#47450)
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…l-visibility-cross-provider-47450

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage NousResearch#47450)
@kshitijk4poor
kshitijk4poor deleted the salvage/model-visibility-cross-provider-47450 branch August 5, 2026 07:09
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…l-visibility-cross-provider-47450

fix(desktop): preserve other providers' hide-all in model visibility dialog (salvage NousResearch#47450)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants