Skip to content

fix(model-switch): mark bare-'custom' active row as current in picker#22473

Closed
wesleysimplicio wants to merge 2 commits into
NousResearch:mainfrom
wesleysimplicio:fix/model-switch-custom-is-current
Closed

fix(model-switch): mark bare-'custom' active row as current in picker#22473
wesleysimplicio wants to merge 2 commits into
NousResearch:mainfrom
wesleysimplicio:fix/model-switch-custom-is-current

Conversation

@wesleysimplicio

@wesleysimplicio wesleysimplicio commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

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.

Changes

  • hermes_cli/model_switch.py — store endpoint_is_current on the section-4 group dict; OR it with slug == current_provider at emit time.
  • tests/hermes_cli/test_model_switch_bare_custom_is_current.py — new file:
    • bare-"custom" current_provider with matching current_base_url marks the matching custom row as current and only one row total.
    • non-matching endpoint stays unmarked.

Test plan

  • ./scripts/run_tests.sh tests/hermes_cli/test_model_switch_bare_custom_is_current.py -v — both pass with fix.
  • Stash-verify: git stash push hermes_cli/model_switch.py → primary test fails on the assertion that exactly one row is marked current. git stash pop restores fix.
  • Pre-existing 4 failures in tests/hermes_cli/test_model_switch_custom_providers.py and test_list_picker_providers.py reproduce on origin/main (live Ollama leak in tests, unrelated to this change).

Closes #20810
Closes #20811

🤖 Generated with Claude Code

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
Copilot AI review requested due to automatic review settings May 9, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_current as a fallback for is_current when 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"))
),
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 11, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #20824 — same is_current URL-based fallback fix for bare 'custom' provider in model picker. Closes same issues (#20810, #20811).

@wesleysimplicio

Copy link
Copy Markdown
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.

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 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.

Fix: is_current check fails for bare 'custom' provider in custom endpoints section Bugs

3 participants