Repository navigation
fix(tui): keep model search responsive with large catalogs - #66346
LyleLiu666 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
The fix works. I ran the reproduction from #66326 from source (two providers with 1,000 generated models each, typing gatewaya model 512 one key at a time). On the base, each key took 0.9–1.8 s, about 25 s for the 18 keys. With this PR, each key took 16–312 ms, about 1.8 s in total. The picker also opened faster (2.8 s instead of 3.6 s), and the search result was the same. The new test and typecheck:tsc pass. The other TUI component and UI tests pass apart from two shell-output timeouts, and those fail on the base too.
I also checked that DialogSelect hides descriptions exactly as before, in grouped and flat mode. In the model picker, the per-provider list, the not-connected list and the favorites/recents sections come out the same, and search labels match with and without the new designs.
The public API is unchanged: the change is internal to the TUI.
No blocking concerns.
Related: #65179
|
#66370 covers both bottlenecks here: it reuses the model options and keeps rows mounted while they still match. With the same two-model #66370 tests row identity in the generic list. Would you accept trimming this PR to a picker-level regression that asserts typing, backspacing, and clearing do not recheck model eligibility? That would be a test-only change on top of |


Issue for this PR
Closes #66326
Type of change
What does this PR do?
The TUI rebuilt and sorted the entire model catalog after every key. It also scanned the catalog to resolve each model's speed and remounted rows that still matched. Index models by provider and ID, build picker options when the catalog changes, and keep matching rows mounted as the search narrows.
How did you verify your code works?
The regression uses the actual TUI picker. It verifies that typing does no catalog-wide speed checks and that a matching row stays mounted when search starts and narrows. With two fixture providers, the old picker performed 36,000 speed checks for 18 keys at 2,000 models. The candidate performed zero at 2,000 and 6,000 models.
In one paired 2,000-model run, the second broad keystroke went from 633 ms to 19 ms and clearing went from 511 ms to 193 ms. Backspace broadened results, clearing restored the list, and Enter selected the correct provider even when model IDs were shared. At 6,000 models, clearing still took 356 ms in the candidate sample.
bun run check,bun run typecheck:tsc, and the affected TUI and CLI unit suites passed locally on macOS. The full local matrix hit a baseline Electron failure and Server test timeouts. GitHub's Linux checks and live provider catalogs are pending.Screenshots / recordings
Performance only. The comparison used the TUI test renderer with fixture catalogs.
Checklist
Added by the opencode bot (AI-generated).
Related: #65179