Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-sol· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION gemini-cli: support Login with Google (oauth-personal), mirroring…

  1. User

    ISSUE DESCRIPTION

    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.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /harbor, current file: none) bash-$

  2. Assistant

    I’ll first map the agent/auth structure and locate the Codex implementation and tests, then mirror its established behavior for Gemini with the requested opt-in variables. After editing, I’ll run the focused tests and relevant broader suite, inspect the diff, and explicitly evaluate each checklist item before submission.

  3. Assistant

    The repository has a direct Codex reference implementation in src/harbor/agents/installed/codex.py plus focused auth tests. I’ll now compare Codex’s resolver/run integration against Gemini’s constructor and execution flow, and inspect helper APIs so the port preserves precedence, validation, ownership, and default behavior exactly.

  4. Assistant

    The resolver semantics are clear: an explicit path has priority, extra_env participates through _get_env, invalid/missing opted-in credentials fail early, and no opt-in returns None. I need the untruncated run setup and Gemini’s complete run method to place upload/chown/setup correctly and avoid disturbing API-key/Vertex behavior.

  5. Assistant

    Gemini currently reads auth variables directly from os.environ, unlike newer agent code that uses _get_env; OAuth should follow the requested Codex pattern without changing those defaults. The credential must ultimately be at Gemini CLI’s fixed ~/.gemini/oauth_creds.json location. I’ll check repository history/remotes for any existing issue implementation and inspect environment upload semantics before choosing a safe staging path versus direct home upload.

  6. Assistant

    There is no alternate branch to recover, so I’ll implement the minimal Codex-style design: resolve locally; create Gemini’s config directory as the agent; upload to a fixed temporary secrets path; chown when a default user exists; and symlink that staged file to ~/.gemini/oauth_creds.json. This avoids relying on unknown container home paths, works across environment backends that do not expand ~ in upload targets, and preserves the credential filename expected by Gemini. Explicit-path precedence and strict boolean parsing will match Codex.

  7. Assistant

    The source edit succeeded; only the global ruff executable was absent (the repository’s virtual environment contains it). I’ll format with .venv/bin/ruff, inspect the resulting diff, then create a temporary (non-repository-test) parity check to exercise resolver and run wiring before running existing tests.

  8. Assistant

    The diff is isolated and backward-compatible: absent opt-in variables, no upload or extra command occurs. One subtle point is credential readability when default_user=None; this intentionally mirrors Codex by skipping chown, while typical upload permissions remain readable. I’ll now run a temporary script covering default/explicit/forced/invalid resolution, extra_env precedence, upload destination, chown, symlink, and the no-auth path, then remove it.

  9. Assistant

    The reproduction/parity script passed all targeted behaviors, including a run that previously had no way to inject OAuth credentials and now uploads and links them correctly. Next I’ll run Gemini’s existing unit tests, the Codex auth tests whose pattern was mirrored, and static lint/type checks on the changed file.

  10. Assistant

    All 40 focused tests and Ruff passed. The type checker found one real edge case: default_user may be an integer UID as well as a string. Converting it to str before shell quoting supports both declared forms safely. I’ll apply that correction, rerun formatting/static checks and the focused tests, then inspect the full diff and repository status.

  11. Assistant

    A final semantic review identified an important “force” edge case: if host API-key/Vertex variables are forwarded alongside injected OAuth credentials, Gemini CLI may select environment auth instead of oauth-personal. Codex avoids forwarding its API key when auth JSON is selected. I’ll align Gemini with that behavior: resolve OAuth first and only forward existing API-key/Vertex variables in the no-OAuth branch. This leaves default behavior unchanged while making the opt-in deterministic.

  12. Assistant

    The branch now mirrors Codex at the explicit environment dictionary level. I’ll verify whether exec_as_agent automatically merges all extra_env values; if it does, control-only variables (and possibly API keys supplied via --ae) could still leak into the container or defeat force semantics, requiring filtering consistent with the framework’s conventions.

  13. Assistant

    exec_as_agent merges extra_env, exactly as in Codex, so control variables passed through --ae remain visible in-container; I will not alter that framework-wide convention. Host API variables, however, are now correctly omitted during OAuth. I’ll validate that specific conflict case and run the entire installed-agent unit test directory for broader regression coverage, plus final static checks.

  14. Assistant

    The broad suite passed all 582 installed-agent tests, Ruff, and type checking. My ad hoc conflict assertion itself had a test-script bug because some mocked exec calls legitimately have env=None; this did not affect repository tests, but I’ll rerun the corrected assertion. I’ll also inspect Codex cleanup behavior and decide whether Gemini should remove staged secrets after execution without breaking trajectory collection.

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