fix(auth): set active_provider after hermes auth add google-gemini-cli - #37579
Closed
AhmetArif0 wants to merge 1 commit into
Closed
fix(auth): set active_provider after hermes auth add google-gemini-cli#37579AhmetArif0 wants to merge 1 commit into
AhmetArif0 wants to merge 1 commit into
Conversation
hermes auth add google-gemini-cli called pool.add_entry() but never wrote to providers["google-gemini-cli"] or set active_provider in auth.json. _model_section_has_credentials() checks get_active_provider() first; with active_provider unset and no api_key_env_vars configured for an oauth_external provider, the setup wizard reported "No inference provider configured" even after a successful OAuth login. Add _save_google_gemini_cli_tokens() in auth.py that writes a minimal provider-state singleton and calls _save_provider_state() (which sets active_provider). Call it in auth_commands before pool.add_entry(). Runtime credential resolution continues to use agent.google_oauth directly; the auth.json singleton is only used for provider detection by setup and status. Mirrors the fix applied to openai-codex (NousResearch#37517) and xai-oauth (NousResearch#37576).
2 tasks
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.
Problem
hermes auth add google-gemini-clicalledpool.add_entry()but never wroteto
providers["google-gemini-cli"]or setactive_providerinauth.json._model_section_has_credentials()checksget_active_provider()first. Withactive_providerunset and noapi_key_env_varsconfigured for anoauth_externalprovider, the setup wizard reported "No inference providerconfigured" even after a successful OAuth login.
Root cause
Same pattern as
openai-codex(fixed in #37517) andxai-oauth(fixed in#37576):
pool.add_entry()only writes the credential-pool entry; it doesn'ttouch
providers[provider]oractive_providerinauth.json.Runtime credential resolution for google-gemini-cli reads tokens directly from
the Google OAuth credential file via
agent.google_oauth.get_valid_access_token().So the agent itself worked fine — only the setup-wizard detection was broken.
Fix
Add
_save_google_gemini_cli_tokens()inhermes_cli/auth.pythat writes aminimal provider-state singleton and calls
_save_provider_state(), which setsactive_provider. Call it inauth_commandsbeforepool.add_entry().The
pool.add_entry()call is kept sohermes auth listcontinues to show theentry. Runtime resolution continues to use
agent.google_oauthdirectly; theauth.jsonsingleton is only used for provider detection.Test plan
test_auth_add_google_gemini_cli_sets_active_providerpassestest_auth_commandstests pass (46 upstream + 1 new)