Skip to content

fix(cli): match bare 'custom' provider as current via URL fallback in picker#20824

Closed
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/issue-20811-is-current-bare-custom
Closed

fix(cli): match bare 'custom' provider as current via URL fallback in picker#20824
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/issue-20811-is-current-bare-custom

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

Summary

When current_provider is the bare "custom" string (e.g. pointing to a local Ollama/llama-swap instance), the /model picker fails to highlight the active custom endpoint as current.

Root Cause

In list_authenticated_providers() section 4 (custom providers), the slug is resolved to "custom:<name>" form (e.g. "custom:ollama"), but the is_current check only does slug == current_provider. When current_provider = "custom" and the slug is "custom:ollama", the comparison fails.

Additionally, the CLI and TUI callers of list_authenticated_providers() did not pass current_base_url, so the existing URL-matching logic in section 4 (which could have set the slug to current_provider) was never triggered.

Fix

  1. hermes_cli/model_switch.py — Add URL-based fallback for is_current: when slug != current_provider, also check if the custom endpoint's base_url matches current_base_url (case-insensitive, trailing-slash-normalized).

  2. cli.py — Pass current_base_url=self.base_url or "" to list_authenticated_providers() so the URL fallback works in the CLI picker.

  3. tui_gateway/server.py — Pass current_base_url=getattr(agent, "base_url", "") or "" to list_authenticated_providers() so the URL fallback works in the TUI picker.

Regression Coverage

Three new tests in tests/hermes_cli/test_model_switch_custom_providers.py:

  • test_is_current_matches_bare_custom_via_base_url — verifies the URL fallback highlights the correct endpoint when current_provider="custom" and current_base_url matches
  • test_is_current_bare_custom_without_base_url_not_false_positive — verifies no false positive when current_base_url is empty
  • test_is_current_url_match_is_case_insensitive — verifies case-insensitive URL comparison

Testing

43 passed in 12.86s (hermetic, scripts/run_tests.sh)

Fixes Fix: is_current check fails for bare 'custom' provider in custom endpoints section #20811

liuhao1024 and others added 3 commits April 24, 2026 22:14
…INSTALL_TIMEOUT

Increase the default npm install timeout for WhatsApp bridge from 60s
to 300s (5 minutes) to accommodate slower systems like Unraid NAS.
Make it configurable via WHATSAPP_NPM_INSTALL_TIMEOUT environment variable
for users who need even longer timeouts.

Closes NousResearch#14980
- Add 'path', 'old_string', 'new_string', and 'patch' to required list
- Update description to clarify mode-specific parameter requirements
- This addresses issue where LLMs would omit these parameters because
  they were not marked as required in the schema, even though they
  are required depending on the mode

Fixes NousResearch#15524
… picker

When current_provider is the bare 'custom' string but the custom endpoint's
slug resolves to 'custom:<name>', the /model picker failed to highlight the
active endpoint as current because the slug comparison didn't match.

Fix by adding a URL-based fallback: when slug != current_provider, also check
if the custom endpoint's base_url matches current_base_url (case-insensitive).

Also pass current_base_url from CLI and TUI callers so the fallback works
in all picker contexts, not just the gateway.

Fixes NousResearch#20811
@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 comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels May 6, 2026
@wesleysimplicio

Copy link
Copy Markdown
Contributor

Closed my competing PR (#22473) in favor of this one — same is_current URL-based fallback for bare 'custom' provider. It's been ~8 days without an update; if main has drifted enough to need a rebase, happy to send a small rebase PR pointed at your branch so this can keep moving.

@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #28860.

Triage notes (high confidence):
Main hermes_cli/model_switch.py already implements the URL-fallback is_current for grouped custom providers; cli.py:7320/7362/7405 and tui_gateway/server.py:5458/5536 pass current_base_url. Merged PR #28860 'fix(model-switch): mark bare custom provider as current' did this.

Thanks for the contribution — the underlying problem this PR addresses has been resolved by the linked PR on current main. If you believe this was closed in error, please comment and we'll reopen.

(Bulk-closed during a CLI PR triage sweep.)

@teknium1 teknium1 closed this May 24, 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 comp/tui Terminal UI (ui-tui/ + tui_gateway/) 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.

4 participants