Skip to content

fix(auth): use get_env_value for base_url_env_var instead of os.getenv (#18757)#18797

Closed
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/get-env-value-base-url
Closed

fix(auth): use get_env_value for base_url_env_var instead of os.getenv (#18757)#18797
shellybotmoyer wants to merge 1 commit into
NousResearch:mainfrom
shellybotmoyer:fix/get-env-value-base-url

Conversation

@shellybotmoyer

Copy link
Copy Markdown
Contributor

Fix #18757: Use get_env_value() for base_url_env_var instead of os.getenv()

Problem

resolve_api_key_provider_credentials() in hermes_cli/auth.py resolves base_url_env_var using os.getenv(), which does not read from ~/.hermes/.env. Providers with a custom base URL stored only in .env (not exported in the shell environment) silently fall back to the wrong endpoint — the default inference_base_url from PROVIDER_REGISTRY.

Fix

  • Replace os.getenv() with get_env_value() for base_url_env_var in auth.py (4 sites) and runtime_provider.py (1 site)
  • This ensures custom base URLs stored in ~/.hermes/.env are properly resolved

Testing

  • Verified that providers with base_url_env_var set in ~/.hermes/.env now correctly resolve their custom endpoints
  • get_env_value() already handles both os.environ and .env file lookups

…v (issue NousResearch#18757)

os.getenv() does not read ~/.hermes/.env, causing providers with custom base URLs stored only in .env to fall back to incorrect registry defaults. Now consistent with api_key resolution which already uses get_env_value().

Fixes NousResearch#18757
@shellybotmoyer

Copy link
Copy Markdown
Contributor Author

Superseded by #23352 (rebased + expanded to also fix doctor.py). Closing to keep the PR list clean.

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

2 participants