Skip to content

fix(auth): set active_provider after hermes auth add google-gemini-cli - #37579

Closed
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/google-gemini-cli-active-provider
Closed

fix(auth): set active_provider after hermes auth add google-gemini-cli#37579
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/google-gemini-cli-active-provider

Conversation

@AhmetArif0

Copy link
Copy Markdown
Contributor

Problem

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.

Root cause

Same pattern as openai-codex (fixed in #37517) and xai-oauth (fixed in
#37576): pool.add_entry() only writes the credential-pool entry; it doesn't
touch providers[provider] or active_provider in auth.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() in hermes_cli/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().

The pool.add_entry() call is kept so hermes auth list continues to show the
entry. Runtime resolution continues to use agent.google_oauth directly; the
auth.json singleton is only used for provider detection.

Test plan

  • New test test_auth_add_google_gemini_cli_sets_active_provider passes
  • All 47 test_auth_commands tests pass (46 upstream + 1 new)

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).
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools provider/gemini Google Gemini (AI Studio, Cloud Code) P3 Low — cosmetic, nice to have labels Jun 2, 2026
@AhmetArif0 AhmetArif0 closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have provider/gemini Google Gemini (AI Studio, Cloud Code) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants