fix(model-picker): add saved-model pre-menu and preserve list order - #24829
fix(model-picker): add saved-model pre-menu and preserve list order#24829imnotdev25 wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the model-picker ordering concern. The order-preserving deduplication remains relevant on current main, but the saved-model flow needs rework.
Problems
- The new default “Use saved model” path returns before probing (
hermes_cli/main.py:3621-3647in this PR). Current main deliberately probes saved-model custom providers inhermes_cli/model_setup_flows.py:1427-1431, andtests/hermes_cli/test_custom_provider_model_switch.py:119-142requires that call. - The pre-menu adds
simple_term_menuathermes_cli/main.py:3590;AGENTS.md:1221-1226requires new interactive menus to usehermes_cli/curses_ui.py. - The two-file diff adds no regression tests for ordering or the new interaction.
Suggested changes
- Port only the order-preserving deduplication to current
hermes_cli/auth.pywith a picker-order regression test. - If retaining a saved-model choice, adapt it in
hermes_cli/model_setup_flows.pywithout bypassing the endpoint probe, and usecurses_radiolist.
Automated hermes-sweeper review.
| return | ||
| if pre_idx == 0: | ||
| model_name = saved_model | ||
| # Activate immediately without probing |
There was a problem hiding this comment.
This early activation skips the probe at lines 3651-3655. Current main has a regression contract requiring saved-model custom providers to call fetch_api_models (tests/hermes_cli/test_custom_provider_model_switch.py:119-142); retain that probe rather than returning here.
| " Cancel", | ||
| ] | ||
| try: | ||
| from simple_term_menu import TerminalMenu |
There was a problem hiding this comment.
Please use hermes_cli.curses_ui.curses_radiolist instead. AGENTS.md:1221-1226 prohibits introducing new simple_term_menu usage because of terminal rendering and key-handling failures.
`_prompt_model_selection` hoisted `current_model` to index 0 and left the cursor there. Two problems (NousResearch#5248): - The provider's natural order (probe order / catalog order) was hidden, so users could not find models where they expected them. - The cursor sat on the already-active model, so ENTER was a silent no-op re-selection of the model the user opened the picker to change away from. Keep the caller's order and only deduplicate. `current_model` still gets its "← currently in use" marker wherever it naturally lands, and the cursor now starts at the top of the list. The companion issue — named custom providers auto-selecting a saved model without probing — is already fixed on main: `_model_flow_named_custom` in `hermes_cli/model_setup_flows.py` always probes and renders the picker via `curses_radiolist`. No change needed there. Adds `tests/hermes_cli/test_model_picker_order.py` covering picker order, deduplication, cursor position, and index-to-model mapping. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
9bd8789 to
e862dab
Compare
|
Thanks for the review — all three points addressed. The branch was based on a main that had drifted ~9.4k commits, which is what produced both the conflict and the stale file references. Rebased onto current main and re-scoped. Probe bypass / Order-preserving deduplication — ported to Regression tests — added The diff is now one file plus tests. 257 tests pass across every suite that touches 🤖 Generated with Claude Code |
What does this PR do?
Fixes two behavioral issues in
hermes modelthat prevented users from seeing the full model probe list and making an informed model selection for custom providers.Related Issue
Fixes #5248
Type of Change
Changes Made
hermes_cli/main.py—_model_flow_named_custom()Before: If
saved_modelexisted, immediately called_save_model_choice()and returned — no probing, no picker.After: When a saved model exists, the user sees a choice menu:
_prompt_model_selection, with the saved model marked← currently in useThis delegates model selection to the shared
_prompt_model_selectionhelper instead of using an inlinesimple_term_menu, ensuring consistent UX across all providers.hermes_cli/auth.py—_prompt_model_selection()Before: Reordered model list to put
current_modelat index 0, cursor on it:After: Preserves original list order, only deduplicates:
The current model still gets the
← currently in usemarker wherever it naturally appears — it's just no longer moved to the front.How to Test
~/.hermes/config.yaml:hermes modeland select "My Local LLM"hermes modeland select any provider with models (e.g. OpenRouter) → verify model list is in its natural order with cursor at position 0, current model marked in-placeChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — or N/A