fix(doctor): validate Gemini keys with Google auth#21490
Closed
thisisryanswift wants to merge 1 commit into
Closed
fix(doctor): validate Gemini keys with Google auth#21490thisisryanswift wants to merge 1 commit into
thisisryanswift wants to merge 1 commit into
Conversation
Collaborator
This was referenced May 10, 2026
3 tasks
Contributor
|
Closing as already fixed on Triage notes (high confidence): If you still see this on the latest version, please reopen with reproduction steps. (Bulk-closed during a CLI triage sweep.) |
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.
What does this PR do?
Fixes a false-positive in
hermes doctorwhere valid Google AI Studio / Gemini API keys were reported as invalid.The doctor API connectivity check dynamically includes the
geminiAPI-key provider, but previously sent the key as an OpenAI-compatible bearer token. Google AI Studio Gemini API keys require Google-style API-key auth, so this PR adds a narrow Gemini-specific doctor health check that probes/modelswithx-goog-api-key.It also updates the
.envprovider-config detector soGOOGLE_API_KEY,GEMINI_API_KEY, andGEMINI_BASE_URLcount as configured provider settings.This differs from #20204 by fixing the existing dynamic
geminiprovider health-check path directly, so doctor no longer emits the old bearer-authgemini (invalid API key)result.Related Issue
Fixes #21058
Fixes #21481
Type of Change
Changes Made
hermes_cli/doctor.py: add a Gemini-specific API connectivity path that usesx-goog-api-keyagainst{base}/modelsinstead ofAuthorization: Bearer.hermes_cli/doctor.py: supportGEMINI_BASE_URLfor the doctor Gemini probe, defaulting tohttps://generativelanguage.googleapis.com/v1beta.hermes_cli/doctor.py: report Gemini auth failures with a Google-key-specific issue message.hermes_cli/doctor.py: recognizeGOOGLE_API_KEY,GEMINI_API_KEY, andGEMINI_BASE_URLas provider configuration in.envdetection.tests/hermes_cli/test_doctor.py: add regression coverage for Gemini env detection, Google-style auth, and auth-failure reporting.How to Test
GOOGLE_API_KEYand use Gemini as the provider.hermes chat -Q -q "Reply with exactly: hermes-ok" --max-turns 3and confirm it returnshermes-ok.hermes doctorand confirm API Connectivity reports✓ geminiinstead ofgemini (invalid API key).scripts/run_tests.sh tests/hermes_cli/test_doctor.py -v.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AFor New Skills
N/A
Screenshots / Logs
Before:
After running the patched command with a real Google AI Studio key:
Test run: