Skip to content

fix(doctor): suppress stale direct-key issues when oauth is healthy (salvage of #26704)#26853

Merged
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/doctor-oauth-fallback-26704
May 16, 2026
Merged

fix(doctor): suppress stale direct-key issues when oauth is healthy (salvage of #26704)#26853
kshitijk4poor merged 2 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/doctor-oauth-fallback-26704

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Closes #26693
Salvages #26704 by @worlldz.

Why a salvage PR

#26704 was branched one commit before c4bda3f27 ("fix(doctor): generate config from defaults when template file is missing") landed on main. As a result, its diff against current main would have silently reverted the new DEFAULT_CONFIG fallback in the config.yaml not found branch back to the old manual_issues.append(...) behavior.

Plain git cherry-pick 6fdeb9965 onto current origin/main auto-merges cleanly — git's 3-way merge recognises c4bda3f27 is already present and applies only the new helper + summary-suppression hunk. The resulting tree has both fixes: the DEFAULT_CONFIG fallback AND the OAuth-aware summary gate. Author attribution is preserved.

What this PR does

When hermes doctor runs and a direct provider API-key probe fails (HTTP 401), but the matching OAuth path for that provider family is already healthy, the failed row stays visible in the API Connectivity section but is no longer promoted into the final blocking summary.

Covered cases:

  • Gemini OAuth + invalid direct Gemini key
  • MiniMax OAuth + invalid direct MiniMax key

Verification

Pytest:

bash scripts/run_tests.sh tests/hermes_cli/test_doctor.py -q
# 40 passed in 8.08s

E2E matrix (subprocess pinned to this branch, faked httpx + auth helpers):

Scenario API Connectivity row Summary issue
Gemini OAuth healthy + bad GOOGLE_API_KEY ✗ (invalid API key) suppressed
MiniMax OAuth healthy + bad MINIMAX_API_KEY ✗ (invalid API key) suppressed
No OAuth + bad GOOGLE_API_KEY (control) ✗ (invalid API key) still fires

Negative control confirms the gate only fires when an OAuth fallback exists for the same family — providers without an OAuth path are unaffected.

Ruff: All checks passed! on the 3 touched files.

Commits

worlldz and others added 2 commits May 16, 2026 14:46
Fixes NousResearch#26693

`hermes doctor` currently promotes invalid direct API keys into the final
summary even when the matching OAuth path is already healthy. That makes
the setup look more broken than it really is.

This change keeps the failed API Connectivity row visible but stops
treating it as a blocking summary issue when a healthy OAuth fallback
already exists for the same provider family.

Covered cases:
- Gemini OAuth + invalid direct Gemini key
- MiniMax OAuth + invalid direct MiniMax key

Based on NousResearch#26704 by @worlldz.
@kshitijk4poor kshitijk4poor merged commit 7bb97b9 into NousResearch:main May 16, 2026
12 of 13 checks passed
@kshitijk4poor kshitijk4poor deleted the salvage/doctor-oauth-fallback-26704 branch May 16, 2026 09:22
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 16, 2026
teknium1 pushed a commit that referenced this pull request May 17, 2026
_has_healthy_oauth_fallback_for_apikey_provider() covers Gemini and
MiniMax (added by #26853) but omits xAI. The xAI provider profile
(plugins/model-providers/xai/__init__.py) has auth_type="api_key" and
env_vars=("XAI_API_KEY",), so it enters the generic API-key
connectivity loop. When XAI_API_KEY fails a 401 probe but xAI OAuth
is healthy, the failure is promoted to the blocking summary even though
xAI works fine via OAuth — the same false-positive #26853 fixed for
Gemini and MiniMax.

Fix: import get_xai_oauth_auth_status alongside the existing two
helpers and add the "xai" branch. get_xai_oauth_auth_status() already
exists in hermes_cli/auth.py and returns {"logged_in": True} when a
valid OAuth token is present.

Symmetric with the Gemini and MiniMax branches introduced in #26853.
No behavior change for providers without an OAuth path.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
_has_healthy_oauth_fallback_for_apikey_provider() covers Gemini and
MiniMax (added by NousResearch#26853) but omits xAI. The xAI provider profile
(plugins/model-providers/xai/__init__.py) has auth_type="api_key" and
env_vars=("XAI_API_KEY",), so it enters the generic API-key
connectivity loop. When XAI_API_KEY fails a 401 probe but xAI OAuth
is healthy, the failure is promoted to the blocking summary even though
xAI works fine via OAuth — the same false-positive NousResearch#26853 fixed for
Gemini and MiniMax.

Fix: import get_xai_oauth_auth_status alongside the existing two
helpers and add the "xai" branch. get_xai_oauth_auth_status() already
exists in hermes_cli/auth.py and returns {"logged_in": True} when a
valid OAuth token is present.

Symmetric with the Gemini and MiniMax branches introduced in NousResearch#26853.
No behavior change for providers without an OAuth path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: hermes doctor promotes invalid direct API keys into the final summary even when OAuth fallback is already healthy

3 participants