Description
Searching in the TUI model picker returns matches in release-date order instead of relevance order, so an exact match can sit at the bottom of the list below models that only share a few scattered letters with the query.
Searching luna against an OpenRouter catalogue:
inclusionai/ling-3.0-flash ← top result, selected
inclusionai/ling-3.0-flash-fin
inclusionai/ling-3.0-flash-fin:free
...
openai/gpt-5.6-luna
openai/gpt-5.6-luna-pro
...
poolside/laguna-s-2.1
~openai/gpt-luna-latest ← exact match, last
inclusionai/ling-3.0-flash matches because fuzzysort finds l-u-n-a in order inside "incLUsioNAi". That fuzzy match is fine on its own — the problem is that it outranks names that literally contain luna, and pressing Enter picks it.
Cause
A regression from #33558 ("sort model picker by release date"). In packages/tui/src/component/dialog-model.tsx the search branch became:
...sortModelOptions(
fuzzysort.go(needle, providerOptions, { keys: ["title", "category"] }).map((x) => x.obj),
false,
),
fuzzysort.go returns results best-first; sortModelOptions(…, false) then re-sorts them free-first, newest-first, discarding the relevance order. Before #33558 the search results were passed through unsorted. The release-date ordering makes sense for the unfiltered picker, but not for search results.
model-options.test.ts covers sortModelOptions itself, not the search path, which is why nothing caught it.
Steps to reproduce
- Configure a provider with a large catalogue (OpenRouter shows it well).
- Open
/models and type luna.
- The first, pre-selected result is
inclusionai/ling-3.0-flash, not a luna model.
Operating System
Linux x86_64 (WSL2)
Terminal
Windows Terminal
Description
Searching in the TUI model picker returns matches in release-date order instead of relevance order, so an exact match can sit at the bottom of the list below models that only share a few scattered letters with the query.
Searching
lunaagainst an OpenRouter catalogue:inclusionai/ling-3.0-flashmatches because fuzzysort finds l-u-n-a in order inside "incLUsioNAi". That fuzzy match is fine on its own — the problem is that it outranks names that literally containluna, and pressing Enter picks it.Cause
A regression from #33558 ("sort model picker by release date"). In
packages/tui/src/component/dialog-model.tsxthe search branch became:fuzzysort.goreturns results best-first;sortModelOptions(…, false)then re-sorts them free-first, newest-first, discarding the relevance order. Before #33558 the search results were passed through unsorted. The release-date ordering makes sense for the unfiltered picker, but not for search results.model-options.test.tscoverssortModelOptionsitself, not the search path, which is why nothing caught it.Steps to reproduce
/modelsand typeluna.inclusionai/ling-3.0-flash, not alunamodel.Operating System
Linux x86_64 (WSL2)
Terminal
Windows Terminal