Skip to content

fix(tui): show models in provider section even when in recents/favorites#15025

Open
agopalareddy wants to merge 6 commits intoanomalyco:devfrom
agopalareddy:fix/model-picker-dedup
Open

fix(tui): show models in provider section even when in recents/favorites#15025
agopalareddy wants to merge 6 commits intoanomalyco:devfrom
agopalareddy:fix/model-picker-dedup

Conversation

@agopalareddy
Copy link
Copy Markdown

@agopalareddy agopalareddy commented Feb 25, 2026

Issue for this PR

Closes #3874

Type of change

  • Bug fix

What does this PR do?

Fix 1 — Models disappear from provider section when added to Favorites/Recent

When a model was added to Favorites or Recent it was filtered out of its provider section in the model picker. Removed the filter in providerOptions so models now appear in all relevant sections simultaneously.

Fix 2 — Navigation jumps to Favorites/Recent when arrowing through provider list

dialog-select uses JSON.stringify(value) as the DOM id for scroll targeting. When a model appeared in both a section (Favorites/Recent) and its provider group, duplicate ids caused moveTo() to always scroll to the section entry, making provider-list entries appear invisible when navigating with the keyboard. Added a section discriminator to values returned by buildSectionOptions so every item has a unique id. onSelect and toggleFavorite handlers strip the field before calling local.model.set.

Extraction

Pulled the pure helpers into dialog-model-utils.ts so they can be unit tested without spinning up the full TUI.

How did you verify your code works?

Added 8 unit tests in packages/opencode/test/cli/tui/dialog-model.test.ts covering: models in recents/favorites still appear in provider groups, section values carry unique discriminators, all composed values produce unique JSON.stringify ids (no duplicate DOM ids), empty recents/favorites, deprecated model exclusion, and provider ordering.

Screenshots / recordings

Screen-recording:
https://github.com/user-attachments/assets/edec6c0f-3ab5-40bc-b931-9f191629dd00

Checklist

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

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Feb 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

…s.ts

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
dialog-select uses JSON.stringify(value) as the DOM id for scroll
targeting. When a model appears in both a section (Favorites/Recent)
and its provider group, duplicate ids caused moveTo() to always scroll
to the section entry instead of the provider entry.

Add a `section` discriminator to values returned by buildSectionOptions
so each item has a unique identity. onSelect handlers strip the field
before calling local.model.set.
@agopalareddy agopalareddy force-pushed the fix/model-picker-dedup branch from 25b68c3 to 7347061 Compare February 25, 2026 07:30
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.

[FEATURE]: Have Recents Seperate From The Model Lists

2 participants