gemini-cli: support Login with Google (oauth-personal), mirroring codex auth.json The…
- User
gemini-cli: support Login with Google (oauth-personal), mirroring codex auth.json The
codexagent injects a cached OAuth credential (~/.codex/auth.json) so runs can use a login instead of an API key (CODEX_AUTH_JSON_PATH/CODEX_FORCE_AUTH_JSON), andclaude-codeacceptsCLAUDE_CODE_OAUTH_TOKEN(#173).gemini-clihas no equivalent — it only wiresGEMINI_API_KEY/ Vertex env, so users with a "Login with Google" session (~/.gemini/oauth_creds.json) must keep a separate API key for runs.Proposal: add the same opt-in OAuth-credential injection to the
gemini-cliagent, mirroring the codex pattern —GEMINI_OAUTH_CREDS_PATH/GEMINI_FORCE_OAUTH, default behavior unchanged (fully backward-compatible).I have a working implementation that mirrors the codex auth flow (
_resolve_oauth_creds_path→ upload → chown →~/.gemini) with tests ported 1:1 fromtest_codex_auth.py, verified end-to-end (gemini-cli --ae GEMINI_FORCE_OAUTH=truecompleted hello-world, reward 1.0). Happy to open the PR or hand it off — whichever you prefer.Interface
No new interfaces are introduced.
- Assistant
I’ll inspect the existing Codex authentication flow and Gemini agent/tests, then mirror the behavior with focused tests and run the repository-required checks.
- Assistant
rgisn’t installed in this workspace, so I’m usingfind/grepfor the same read-only inspection. - Assistant
The Codex path has three important compatibility properties I’m preserving: explicit path takes priority, the home credential is only used when force is truthy, and invalid/missing opt-in values fail clearly. Gemini’s default API-key/Vertex behavior will remain untouched when neither option is set.
- Assistant
The implementation and ported tests are in place. I’m now validating the resolver edge cases, upload/chown/symlink behavior, unchanged default path, and then the project-wide formatting/lint/type requirements.
- Assistant
Focused Gemini tests pass (39/39), and Ruff plus type checking are clean. I’m running the full unit suite now, as required by the repository guidance, to catch cross-agent regressions.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.