fix: use get_env_value() for base_url_env_var resolution#18908
Closed
zons-zhaozhy wants to merge 1 commit into
Closed
fix: use get_env_value() for base_url_env_var resolution#18908zons-zhaozhy wants to merge 1 commit into
zons-zhaozhy wants to merge 1 commit into
Conversation
…h#18757) resolve_api_key_provider_credentials() and related functions used os.getenv() for base_url_env_var, which does NOT read ~/.hermes/.env. This caused providers with custom base URLs stored only in .env to hit the wrong endpoint (falling back to inference_base_url). API key resolution already correctly uses get_env_value() — this was an inconsistency where keys were found but base URLs were not. Fixed 5 occurrences across 2 files: - auth.py: get_api_key_provider_status() - auth.py: get_external_process_provider_status() - auth.py: resolve_api_key_provider_credentials() - auth.py: resolve_external_process_provider_credentials() - runtime_provider.py: _resolve_explicit_runtime() Same bug class as NousResearch#15914 (PR NousResearch#16101) and NousResearch#17140 (PR NousResearch#17434), where os.getenv was replaced with get_env_value for API key resolution. Fixes NousResearch#18757
Collaborator
Collaborator
|
Duplicate of #18797 |
Author
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
resolve_api_key_provider_credentials()and related functions usedos.getenv()forbase_url_env_var, which does NOT read~/.hermes/.env. Providers with custom base URLs stored only in .env
hit the wrong endpoint.
Root Cause
API key resolution already correctly uses
get_env_value()— this wasan inconsistency where keys were found but base URLs were not.
Fix
Replace
os.getenv()withget_env_value()at all 5 occurrences:get_api_key_provider_status()get_external_process_provider_status()resolve_api_key_provider_credentials()resolve_external_process_provider_credentials()_resolve_explicit_runtime()Same Bug Class
The
base_url_env_varresolution was missed in both prior fixes.Scope
os.environFixes #18757