Skip to content

fix: use get_env_value() for base_url_env_var resolution#18908

Closed
zons-zhaozhy wants to merge 1 commit into
NousResearch:mainfrom
zons-zhaozhy:fix/get_env_value-base_url-resolution
Closed

fix: use get_env_value() for base_url_env_var resolution#18908
zons-zhaozhy wants to merge 1 commit into
NousResearch:mainfrom
zons-zhaozhy:fix/get_env_value-base_url-resolution

Conversation

@zons-zhaozhy

Copy link
Copy Markdown

Summary

resolve_api_key_provider_credentials() and related functions used
os.getenv() for base_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 was
an inconsistency where keys were found but base URLs were not.

Fix

Replace os.getenv() with get_env_value() at all 5 occurrences:

File Function
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

The base_url_env_var resolution was missed in both prior fixes.

Scope

  • 2 files, +14 / -5 lines
  • No behavioral change for env vars already in os.environ
  • Purely fixes the .env file reading gap

Fixes #18757

…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
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools area/config Config system, migrations, profiles labels May 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #18797 — both fix os.getenv() → get_env_value() for base_url_env_var in auth.py and runtime_provider.py. Same issue #18757.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #18797

@zons-zhaozhy

Copy link
Copy Markdown
Author

Duplicate of #18797 (submitted 6 hours earlier, same issue #18757, identical fix). Closing in favor of the existing PR.

@zons-zhaozhy zons-zhaozhy deleted the fix/get_env_value-base_url-resolution branch May 4, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: resolve_api_key_provider_credentials() uses os.getenv for base_url_env_var — misses ~/.hermes/.env values

3 participants