Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

gemini-cli: support Login with Google (oauth-personal), mirroring codex auth.json The…

  1. User

    gemini-cli: support Login with Google (oauth-personal), mirroring codex auth.json The codex agent 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), and claude-code accepts CLAUDE_CODE_OAUTH_TOKEN (#173). gemini-cli has no equivalent — it only wires GEMINI_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-cli agent, 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 from test_codex_auth.py, verified end-to-end (gemini-cli --ae GEMINI_FORCE_OAUTH=true completed hello-world, reward 1.0). Happy to open the PR or hand it off — whichever you prefer.

    Interface

    No new interfaces are introduced.

  2. Assistant

    I'll mirror the codex OAuth credential injection for gemini-cli. First I'm reviewing how codex handles auth.json and how the gemini agent is wired today.

  3. Assistant

    Implementing OAuth credential injection for gemini-cli, mirroring the codex pattern.

  4. Assistant

    Implemented OAuth credential injection for gemini-cli, mirroring the codex auth.json pattern.

    Changes

    src/harbor/agents/installed/gemini_cli.py

    • Added _resolve_oauth_creds_path() with opt-in resolution:
      • GEMINI_OAUTH_CREDS_PATH → explicit file path
      • GEMINI_FORCE_OAUTH → ~/.gemini/oauth_creds.json
      • Default → None (unchanged API-key/Vertex behavior)
    • In run(): when OAuth creds are resolved, upload to /tmp/gemini-secrets/oauth_creds.json, chown for the agent user, symlink to ~/.gemini/oauth_creds.json, and skip GEMINI_API_KEY injection
    • When no OAuth creds: existing GEMINI_API_KEY / Vertex env var passthrough is unchanged

    tests/unit/agents/installed/test_gemini_oauth_auth.py

    • 18 unit tests ported from test_codex_auth.py (resolution priority, upload/chown wiring, API-key skip when OAuth is active)

    Usage

    # Use local Login with Google session
    harbor run ... --agent gemini-cli --ae GEMINI_FORCE_OAUTH=true
    
    # Or point at a specific creds file
    harbor run ... --agent gemini-cli --ae GEMINI_OAUTH_CREDS_PATH=/path/to/oauth_creds.json
    

    All 18 new tests pass; ruff and ty check are clean. I can open a PR if you want.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.