Skip to content

fix(app): exclude hidden models from recent and favorites in model selector - #60919

Open
wellparth wants to merge 2 commits into
anomalyco:devfrom
wellparth:fix/desktop-picker-hidden-models
Open

wellparth wants to merge 2 commits into
anomalyco:devfrom
wellparth:fix/desktop-picker-hidden-models

Conversation

@wellparth

Copy link
Copy Markdown

Issue for this PR

Closes #60911

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

In createModelSelectorController (packages/app/src/providers/models/select-dialog.tsx), provider groups were filtered by model.visible(...), but favorites and recent lists were returned directly without checking model visibility. Consequently, models turned off in Settings → Models still leaked into the Recent and Favorites sections of the model picker dialog.

This change filters both favorites and recent with model.visible({ modelID: item.id, providerID: item.provider.id }) in createModelSelectorController so that hidden models are excluded from all sections of the picker dialog and drawer.

How did you verify your code works?

  • Added regression tests in packages/app/test-browser/select-dialog.test.ts checking that createModelSelectorController:
    1. Excludes models marked hidden from both recent() and favorites().
    2. Dynamically updates when model visibility changes.
    3. Filters correctly when scoped to a specific provider.
  • Verified all browser tests pass: bun run test:browser (305 passed across 55 files).
  • Verified unit tests pass: bun run test:unit (948 passed across 128 files).
  • Verified typechecking passes across all 35 workspace packages: bun run typecheck.
  • Ran root bun run lint:changed (0 problems).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…lector

Filter recent and favorites with model.visible in createModelSelectorController so hidden models do not leak into the picker.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks correct. The Recent and Favorites lists now use the same model.visible(...) filter the provider groups already use, so models hidden in Settings → Models no longer show up there. I couldn't run the issue's browser reproduction (no Chromium here). Instead I ran your new tests against the base with only the export added: both fail there and pass with this change. tsc -b in packages/app passes. I checked whether cycle() in selection.tsx could still land on hidden recent models; it doesn't matter here, because nothing in the app calls the model cycle.

Public API: unchanged. Exporting createModelSelectorController affects only the app package.

The tests are large for a two-line filter; see the inline comment.

})

test("createModelSelectorController filters recent and favorites by provider and visibility together", () => {
createRoot((dispose) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both tests repeat the same ~30-line fake ModelSelection to check two filters. Could you cut this down to one small test, for example one fake shared through a helper, with one hidden recent entry, one hidden favorite and the provider scope? Then the file shows the fixed behaviour without the repeated setup.

Simplify test setup into a single focused test checking visibility filtering in both unscoped and provider-scoped controllers.
@wellparth

Copy link
Copy Markdown
Author

Updated in 5f7117c. Consolidated into a single concise test that covers hidden recent and favorite models, both unscoped and with provider filtering, removing the repeated setup.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are now one small test covering hidden recent and favorite entries plus the provider scope, which addresses my earlier comment. The test fails on the base and passes with this change, and tsc -b in packages/app passes. I still couldn't run the issue's browser reproduction here (no Chromium). The fix itself is unchanged and looks correct.

Public API: unchanged.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

desktop: hidden models still appear in the model picker's Recent section

1 participant