fix(doctor): read env vars from .env and default to China DashScope endpoint#18910
Closed
zons-zhaozhy wants to merge 2 commits into
Closed
fix(doctor): read env vars from .env and default to China DashScope endpoint#18910zons-zhaozhy wants to merge 2 commits into
zons-zhaozhy wants to merge 2 commits into
Conversation
When DASHSCOPE_BASE_URL is not set and the first /models probe returns 401, automatically retry against the other region endpoint before declaring the key invalid. - China default: dashscope.aliyuncs.com - Fallback: dashscope-intl.aliyuncs.com (and vice versa) - If the key works on the fallback, prints a hint to set DASHSCOPE_BASE_URL - get_env_value() is used for key/base_url lookup (respects .env file) Fixes NousResearch#18910
6b651a8 to
9ad0bf7
Compare
- Revert default URL to dashscope-intl.aliyuncs.com (matches provider registry in auth.py — running agent and doctor now probe the same endpoint by default). - Move get_env_value import to module level (alongside other hermes_cli.config imports). No circular-import risk. - Fallback hint now shows the exact DASHSCOPE_BASE_URL value the user should set, instead of a vague message.
This was referenced May 2, 2026
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
hermes doctorAPI-key health checks had two bugs:Bug 1: env vars from .env invisible to doctor
os.getenv()does not read~/.hermes/.env. Keys and base URLsstored only in .env (not exported to the shell) were invisible to all
16 api-key provider health checks.
Fix: Replace
os.getenv()withget_env_value()for both API keyand base URL resolution.
Bug 2: DashScope default URL is international-only
The default health-check URL was
dashscope-intl.aliyuncs.com(international). China-region keys —the vast majority of DashScope users — are valid only on
dashscope.aliyuncs.com. Doctor reported these as invalid.Fix: Default to
dashscope.aliyuncs.com(China). Users withDASHSCOPE_BASE_URLset are unaffected.Same Bug Class
Testing
23 existing doctor tests: all pass, zero regression.
Scope
hermes_cli/doctor.py(+5 / -4)Fixes #18904