fix(doctor): use get_env_value for API keys and base URLs instead of os.getenv#23352
Closed
shellybotmoyer wants to merge 1 commit into
Closed
fix(doctor): use get_env_value for API keys and base URLs instead of os.getenv#23352shellybotmoyer wants to merge 1 commit into
shellybotmoyer wants to merge 1 commit into
Conversation
…os.getenv os.getenv() only reads os.environ, missing values stored in ~/.hermes/.env. Same pattern as NousResearch#18757 (auth.py).
This was referenced May 11, 2026
Contributor
|
Automated hermes-sweeper review: this looks implemented on current main by the broader doctor startup env-load path. Evidence:
Thanks for the clear report and for connecting it to the earlier |
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.
fix(doctor): use get_env_value for API keys and base URLs instead of os.getenv
Problem
hermes_cli/doctor.pyusesos.getenv()to read API keys and base URL env vars.os.getenv()only reads fromos.environ, so values stored in~/.hermes/.env(the standard location for API keys) are silently missed.This causes:
hermes doctorreports keys as "not configured" when they exist only in~/.hermes/.envBASE_URLin.env(likeDASHSCOPE_BASE_URL) fall back to wrong registry defaults, causing false "invalid key" reportsSame pattern as #18757 (fixed in
auth.py) — theos.getenv()vsget_env_value()inconsistency.Fix
Replace
os.getenv()withget_env_value()(withos.getenv()fallback) at 3 call sites:_probe_openrouter):os.getenv("OPENROUTER_API_KEY")→get_env_value("OPENROUTER_API_KEY") or os.getenv(...)_probe_apikey_providerkey loop):os.getenv(ev, "")→get_env_value(ev) or os.getenv(ev, "")_probe_apikey_providerbase URL):os.getenv(base_env, "")→get_env_value(base_env) or os.getenv(base_env, "")Also imports
get_env_valueat the top of the file alongside existinghermes_cli.configimports.Related
auth.pyandruntime_provider.pySupersedes #18989 (rebased onto current origin/main, avoiding the stale DIRTY branch).