fix(cli): match bare 'custom' provider as current via URL fallback in picker#20824
fix(cli): match bare 'custom' provider as current via URL fallback in picker#20824liuhao1024 wants to merge 3 commits into
Conversation
…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
|
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. |
|
Closing as superseded by #28860. Triage notes (high confidence): 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.) |
Summary
When
current_provideris the bare"custom"string (e.g. pointing to a local Ollama/llama-swap instance), the/modelpicker 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 theis_currentcheck only doesslug == current_provider. Whencurrent_provider = "custom"and the slug is"custom:ollama", the comparison fails.Additionally, the CLI and TUI callers of
list_authenticated_providers()did not passcurrent_base_url, so the existing URL-matching logic in section 4 (which could have set the slug tocurrent_provider) was never triggered.Fix
hermes_cli/model_switch.py— Add URL-based fallback foris_current: whenslug != current_provider, also check if the custom endpoint'sbase_urlmatchescurrent_base_url(case-insensitive, trailing-slash-normalized).cli.py— Passcurrent_base_url=self.base_url or ""tolist_authenticated_providers()so the URL fallback works in the CLI picker.tui_gateway/server.py— Passcurrent_base_url=getattr(agent, "base_url", "") or ""tolist_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 whencurrent_provider="custom"andcurrent_base_urlmatchestest_is_current_bare_custom_without_base_url_not_false_positive— verifies no false positive whencurrent_base_urlis emptytest_is_current_url_match_is_case_insensitive— verifies case-insensitive URL comparisonTesting
Fixes Fix:
is_currentcheck fails for bare 'custom' provider in custom endpoints section #20811