fix(picker): remove max_models=50 cap in interactive model pickers#48611
Conversation
The interactive model pickers (Desktop REST API, TUI model.options, CLI /model) were hard-capped at max_models=50, which truncated large provider catalogs like Kilo Gateway (336 models) to just 50 entries. This made most models undiscoverable via the picker search box. Changes: - Change build_models_payload() default from max_models=50 to None (unlimited) - Change list_authenticated_providers() default from max_models=8 to None - Change list_picker_providers() default from max_models=8 to None - Fix all [:max_models] slicing to handle None as 'no limit' - Remove max_models=50 from 5 interactive picker callers: * web_server.py: get_model_options (Desktop /api/model/options) * web_server.py: get_recommended_default_model * model_switch.py: prewarm_picker_cache_async * tui_gateway/server.py: model.options JSON-RPC * cli.py: HermesCLI model picker - Telegram/Discord inline keyboard picker (gateway/slash_commands.py) still passes max_models=50 explicitly — unchanged behavior. The total_models field was already in the response payload and is now meaningful since models.length == total_models for interactive pickers. Fixes #48279
…ntics Follow-up to the cap-removal salvage. The contributor guarded the new unlimited default with `[:max_models] if max_models else ...`, which conflates max_models=0 (used by slug-only callers that want an empty model list) with None (unlimited). Tighten to `is not None` at all five slicing sites in list_authenticated_providers / list_picker_providers, and add a regression test asserting the three-way contract: None=full, 0=empty, N=first N.
🔎 Lint report:
|
|
Related: #48297 (@islam666's original, cherry-picked here with authorship preserved), #48279 (the Kilo Gateway bug report this Fixes), and the earlier cap-removal attempts #35446, #35447, #40765, #42496, #27914, #41029. This is the authoritative salvage that supersedes the cluster — it removes the |
Summary
The interactive model pickers no longer cap at 50 models — large provider catalogs (e.g. Kilo Gateway's 336) are now fully searchable. Searching for a model that existed in cache but ranked past the first 50 previously returned zero results.
Salvages #48297 by @islam666 (cherry-picked, authorship preserved) plus a follow-up correctness fix on top.
Changes
build_models_payload()/list_authenticated_providers()/list_picker_providers(): defaultmax_models→None(unlimited)max_models=50from the 5 interactive picker callers: Desktop/api/model/options, Desktop recommended-default, picker prewarm, TUImodel.options, CLI/modelif max_modelstoif max_models is not Noneat all 5 sites, somax_models=0keeps its "empty model list" meaning for the slug-only callers instead of being conflated with unlimitedValidation
max_modelsNone0NRegression tests: contributor's
test_build_models_payload_no_max_models_returns_full_list(None=unlimited) + newtest_picker_max_models_cap_semanticslocking the three-way contract (None=full, 0=empty, N=first N) on the real slicing path.tests/hermes_cli/(7130) andtests/tui_gateway/(148) all green.Test plan
scripts/run_tests.sh tests/hermes_cli tests/tui_gateway→ all passedSupersedes the duplicate cluster: #35446, #35447, #40765, #42496, #27914, #41029.
Infographic