fix: warn and clear stale OPENAI_BASE_URL on provider switch#7601
Closed
kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
Closed
fix: warn and clear stale OPENAI_BASE_URL on provider switch#7601kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
kshitijk4poor wants to merge 1 commit intoNousResearch:mainfrom
Conversation
This was referenced Apr 11, 2026
Closed
9703b60 to
e81b4df
Compare
Contributor
|
Merged via #7647. Your commit was cherry-picked onto current main with your authorship preserved in git log. Thanks @kshitijk4poor! |
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.
Problem
When users switch from a custom endpoint (e.g. local Ollama/vLLM) to a named provider (e.g. OpenRouter) via
hermes model,OPENAI_BASE_URLpersists in~/.hermes/.env. The main inference client usesconfig.yamlcorrectly, but auxiliary clients (compression, vision, delegation) withprovider:autopick up the stale env var and route requests to the old custom endpoint.Fixes #5161
Solution
Two-pronged fix:
1. Startup warning in auxiliary client (
agent/auxiliary_client.py)_resolve_auto(), detect whenOPENAI_BASE_URLis set butconfig.yaml model.provideris a named provider (notcustom)_stale_base_url_warnedflag to avoid spamming2. Proactive cleanup on provider switch (
hermes_cli/main.py)_clear_stale_openai_base_url()helper called after every provider flow inselect_provider_and_model()OPENAI_BASE_URLis still set in.envand clears itcustom,cancel,remove-custom, andcustom:*providersTests
4 new tests in
tests/agent/test_auxiliary_client.py::TestStaleBaseUrlWarning:custom(OPENAI_BASE_URL is expected)4 new tests in
tests/hermes_cli/test_clear_stale_base_url.py:customAll 8 tests pass. Pre-existing test failures are unrelated.