fix(model-switch): mark bare-'custom' active row as current in picker#22473
Closed
wesleysimplicio wants to merge 2 commits into
Closed
fix(model-switch): mark bare-'custom' active row as current in picker#22473wesleysimplicio wants to merge 2 commits into
wesleysimplicio wants to merge 2 commits into
Conversation
When config.yaml's active provider is bare "custom" (e.g. pointing at a local Ollama / llama-swap instance), list_authenticated_providers resolves its slug to "custom:<name>", but the is_current check at emit time used "slug == current_provider" — "custom:foo" == "custom" is False, so the actual active provider was rendered without the current marker and a different provider (often the first built-in) carried the '● current' indicator instead. Fix: track in the group dict whether its endpoint matched the active current_base_url (already computed for slug resolution) and OR that flag into is_current at emit time. Direct slug equality still wins for the canonical custom:<name> form, so existing rows are unaffected. Closes NousResearch#20810
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the /model provider picker’s “current” marker when the configured active provider is the bare string "custom", ensuring the matching custom endpoint row is correctly marked current (per #20810).
Changes:
- Track whether a grouped custom provider endpoint matches
current_base_url(endpoint_is_current) when building Section 4 groups. - Use
endpoint_is_currentas a fallback foris_currentwhen slug equality (slug == current_provider) doesn’t work for bare"custom". - Add regression tests covering matching vs non-matching custom endpoints for bare
"custom".
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
hermes_cli/model_switch.py |
Adds endpoint_is_current tracking for custom provider groups and ORs it into is_current when emitting picker rows. |
tests/hermes_cli/test_model_switch_bare_custom_is_current.py |
Adds regression coverage for bare "custom" current-provider behavior (match + non-match cases). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1702
to
+1705
| "is_current": ( | ||
| slug == current_provider | ||
| or bool(grp.get("endpoint_is_current")) | ||
| ), |
13 tasks
Collaborator
Contributor
Author
|
Closing in favor of #20824 per @alt-glitch's note — same is_current URL-based fallback for bare 'custom' provider in model picker. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When config.yaml's active provider is bare
"custom"(e.g. pointing at a local Ollama / llama-swap instance),list_authenticated_providersresolves its slug to"custom:<name>", but theis_currentcheck at emit time usedslug == current_provider—"custom:foo" == "custom"isFalse, so the actual active provider was rendered without the current marker and a different provider (often the first built-in) carried the● currentindicator instead.Fix
Track in the group dict whether its endpoint matched the active
current_base_url(already computed for slug resolution) and OR that flag intois_currentat emit time. Direct slug equality still wins for the canonicalcustom:<name>form, so existing rows are unaffected.Changes
hermes_cli/model_switch.py— storeendpoint_is_currenton the section-4 group dict; OR it withslug == current_providerat emit time.tests/hermes_cli/test_model_switch_bare_custom_is_current.py— new file:"custom"current_providerwith matchingcurrent_base_urlmarks the matching custom row as current and only one row total.Test plan
./scripts/run_tests.sh tests/hermes_cli/test_model_switch_bare_custom_is_current.py -v— both pass with fix.git stash push hermes_cli/model_switch.py→ primary test fails on the assertion that exactly one row is marked current.git stash poprestores fix.tests/hermes_cli/test_model_switch_custom_providers.pyandtest_list_picker_providers.pyreproduce onorigin/main(live Ollama leak in tests, unrelated to this change).Closes #20810
Closes #20811
🤖 Generated with Claude Code