Skip to content

fix(model-picker): hydrate truncated provider model lists#27914

Closed
xz-dev wants to merge 1 commit into
NousResearch:mainfrom
xz-dev:fix/model-picker-hydrate-truncated
Closed

fix(model-picker): hydrate truncated provider model lists#27914
xz-dev wants to merge 1 commit into
NousResearch:mainfrom
xz-dev:fix/model-picker-hydrate-truncated

Conversation

@xz-dev

@xz-dev xz-dev commented May 18, 2026

Copy link
Copy Markdown

Summary

Fix two related interactive CLI /model picker issues that show up with providers exposing more models than the top-level picker embeds (for example LiteLLM Proxy showing 134 models):

  1. Hydrate truncated provider model lists on selection.
    build_models_payload(ctx, max_models=50) intentionally keeps provider rows small by including only the first 50 model IDs while preserving the full count in total_models. The top-level picker therefore correctly shows providers like LiteLLM Proxy (134 models), but the second-stage picker reused the truncated provider_data["models"] list directly and only fetched live models when that list was empty. The result was that users could only select the first 50 models even though the provider advertised many more.

    This changes provider selection to call provider_model_ids(provider_slug) when total_models > len(models), while preserving the existing behavior for complete curated lists.

  2. Preserve model row indentation for long slash-delimited model IDs.
    textwrap.wrap() drops leading whitespace by default. Passing a row as " " + model_id can strip the two-space indent for a long unbroken model ID near the wrap boundary, rendering │ model instead of │ model. The picker now wraps the raw model ID and adds the selection/indent prefix afterwards so row alignment stays stable.

Tests

  • PYTHONPATH=. venv/bin/python3 -m pytest tests/hermes_cli/test_cli_model_picker.py -q -o 'addopts='
  • PYTHONPATH=. venv/bin/python3 -m pytest tests/test_tui_gateway_server.py::test_model_options_does_not_overwrite_curated_models -q -o 'addopts='
  • PYTHONPATH=. venv/bin/python3 -m py_compile cli.py

@teknium1

teknium1 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for the focused fix — I verified the classic prompt_toolkit CLI bug is still present on current main.

Problems

  • The same capped-list path appears to remain in the TS TUI picker. tui_gateway/server.py:8798 builds model.options with max_models=50, ui-tui/src/components/modelPicker.tsx:99 derives allModels directly from provider?.models, and ui-tui/src/components/modelPicker.tsx:320 enters the model stage without hydrating when total_models > models.length. This PR fixes the classic CLI path in cli.py, but the TUI picker would still only show the embedded capped slice.

Suggested changes

  • Add a TUI/gateway hydration path, or otherwise fetch/return the full model list for the selected provider before the TS picker enters model selection.
  • Add a TUI regression test mirroring the CLI case: provider row has models.length < total_models, then selecting it exposes the full hydrated list.

The current CLI premise is real: cli.py:6880 uses build_models_payload(ctx, max_models=50), while provider selection on main only falls back to provider_model_ids() when model_list is empty at cli.py:6767-6771. The patch also applies cleanly with offsets via gh pr diff 27914 --patch | git apply --check --verbose -.

Automated hermes-sweeper review.

@teknium1

Copy link
Copy Markdown
Contributor

Fixed on main via PR #48611 — the interactive model pickers no longer cap at 50 models; large provider catalogs are fully searchable.

This was one of several PRs targeting the same picker cap. We merged @islam666's #48297 as the implementation (cleanest scope — it correctly keeps the Telegram/Discord inline-keyboard cap, which genuinely needs a bound) plus a follow-up tightening max_models=0 semantics and a regression test. Closing this as a duplicate — thanks for the contribution and for flagging the issue.

#48611

@teknium1 teknium1 closed this Jun 18, 2026
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 P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants