Skip to content

fix(picker): remove max_models=50 cap in interactive model pickers#48297

Closed
Elshayib wants to merge 1 commit into
NousResearch:mainfrom
Elshayib:fix/kilo-picker-model-cap-48279
Closed

fix(picker): remove max_models=50 cap in interactive model pickers#48297
Elshayib wants to merge 1 commit into
NousResearch:mainfrom
Elshayib:fix/kilo-picker-model-cap-48279

Conversation

@Elshayib

Copy link
Copy Markdown
Contributor

Summary

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 — searching for a known model returned zero results even though it existed in the local cache.

The total_models field was already present in the response payload but was never rendered by the Desktop UI, so users had no indication that the cap existed.

Root Cause

build_models_payload() defaulted to max_models=50 and list_authenticated_providers() defaulted to max_models=8. All 5 interactive picker callers passed max_models=50 explicitly, truncating the model list before the picker ever saw the data.

Changes

  • build_models_payload(): default changed from max_models=50 to max_models=None (unlimited)
  • list_authenticated_providers(): default changed from max_models=8 to max_models=None
  • list_picker_providers(): default changed from max_models=8 to max_models=None
  • All [:max_models] slicing updated to [:max_models] if max_models else model_ids to handle None as "no limit"
  • Removed max_models=50 from 5 interactive picker callers:
    • hermes_cli/web_server.py:get_model_options — Desktop /api/model/options
    • hermes_cli/web_server.py:get_recommended_default_model — Desktop recommended model endpoint
    • hermes_cli/model_switch.py:prewarm_picker_cache_async — picker cache prewarm
    • tui_gateway/server.py:model.options — TUI JSON-RPC handler
    • cli.py:HermesCLI — CLI /model picker
  • Telegram/Discord inline keyboard picker (gateway/slash_commands.py) still passes max_models=50 explicitly — unchanged behavior (inline keyboards need a cap)
  • Added regression test test_build_models_payload_no_max_models_returns_full_list

Testing

  • All existing tests pass: test_inventory.py (31 tests), test_list_picker_providers.py (10 tests), test_model_catalog.py (28 tests)
  • New test verifies that omitting max_models returns the full 100-model list

What platforms did you test on?

Linux (Ubuntu 26.04). The changes are in shared Python backend code — no platform-specific behavior.

Fixes #48279

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 NousResearch#48279
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #35447 — identical mechanism. Both change build_models_payload() default to max_models=None (unlimited), make list_authenticated_providers()/list_picker_providers() skip the [:max_models] slice when None, and remove the max_models=50 cap from the same set of interactive picker callers (cli.py, model_switch.py, web_server.py, tui_gateway/server.py). #35447 is the earlier open PR using this remove-the-cap-entirely approach.

Related: #48279 (the Kilo Gateway issue this fixes), #40747 (open competing fix that bumps the cap 50→200 instead of removing it), #40601/#42270/#35443 (issue cluster for the same picker cap).

@Elshayib

Copy link
Copy Markdown
Contributor Author

Appreciate the heads-up. Yes, #35447 and this PR address the same root cause (the hard-coded max_models=50 cap). Here's how they compare:

This PR is a strict superset — it fixes every interactive picker path, not just the ones in #35447. I'd suggest we merge this one and close #35447. If maintainers disagree I'm happy to rebase on top.

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor

Acknowledged: noted competing PR(s) #35447, #35447, #48279, #40747, #40601, #42270, #35443. My approach differs and is complementary, not mutually exclusive. Open to consolidating if reviewers prefer one direction.

@teknium1

Copy link
Copy Markdown
Contributor

Merged to main via PR #48611 (rebase-merge, commit 3042045) — your commit was cherry-picked with authorship preserved in git history. Thank you!

We added one follow-up on top: tightened the slicing guard from if max_models to if max_models is not None so max_models=0 (used by the slug-only callers that want an empty model list) stays distinct from None/unlimited, plus a regression test locking the three-way cap contract (None=full, 0=empty, N=first N).

#48611

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Kilo Gateway picker hides 286 of 336 catalog models — search returns nothing for cached models beyond position 50

4 participants