Skip to content
TheChatArchiveThe Chat Archive
xiaomi/mimo-v2.5-pro· unknownHugging 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 start by exploring the repository structure to understand the codebase and locate the relevant files. Let's first check the current directory.

  3. Assistant

    Let me explore the repository structure to understand the codebase better. I need to find:

    1. The gemini-cli agent implementation
    2. The codex auth implementation to mirror3. Existing tests
  4. Assistant

    Let me look at the src directory structure to find the gemini-cli agent implementation.

  5. Assistant

    Let me explore the structure more.

  6. Assistant

    Let me examine both the codex and gemini-cli agent implementations to understand the pattern.

  7. Assistant

    Let me search for the auth-related functions in codex.py.

  8. Assistant

    Let me see the _resolve_auth_json_path function in detail:

  9. Assistant

    I need to use the goto command or just use sed/cat to view specific lines.

  10. Assistant

    Now let me look at the gemini_cli.py file to understand its structure:

  11. Assistant

    Let me read the gemini_cli.py file to understand its current structure.

  12. Assistant

    Let me continue reading the gemini_cli.py file to see the rest of the implementation.

  13. Assistant

    Let me continue reading to find the run method.

  14. Assistant

    Let me continue reading to find the run method:

  15. Assistant

    Now let me look at the test files to understand the existing test structure and see if there are tests for the codex auth feature:

  16. Assistant

    Let me examine the codex auth test file to understand the testing pattern:

  17. Assistant

    Let me continue reading the test file to see all the tests.

  18. Assistant

    Now let me look at the existing gemini_cli test files:

  19. Assistant

    Let me check the base agent class to understand the _get_env method and other utilities:

  20. Assistant

    Let me check the parse_bool_env_value utility:

  21. Assistant

    Let me look at the parse_bool_env_value function to understand how it works:

  22. Assistant

    Now let me check how the _get_env method works in the base class to understand how extra_env is handled:

  23. Assistant

    Now let me also check the conftest.py for test fixtures:

  24. Assistant

    Let me check the conftest to understand the temp_dir fixture.

  25. Assistant

    Let me look at the full conftest.py to understand the fixtures: up to 60 lines.

  26. Assistant

    Let me look at the conftest.py to understand the temp_dir fixture.

  27. Assistant

    Now I have a good understanding of the codebase. Let me plan the implementation:

    1. In gemini_cli.py, I need to:

      • Add _resolve_oauth_creds_path method mirroring codex's _resolve_auth_json_path
      • Add _REMOTE_GEMINI_HOME and _REMOTE_GEMINI_SECRETS_DIR class constants
      • Modify the run method to handle OAuth credentials injection
      • Import parse_bool_env_value and PurePosixPath and EnvironmentPaths
    2. Create tests in a new file test_gemini_cli_oauth.py mirroring test_codex_auth.py

    Let me first check existing imports in gemini_cli.py more carefully, and also look at how codex handles the _REMOTE paths and session management:

  28. Assistant

    Let me look at the imports section and the existing run method more carefully:

  29. Assistant

    Now let me look at the EnvironmentPaths to understand the path constants:

  30. Assistant

    Let me look at the EnvironmentPaths class to understand the paths:

  31. Assistant

    Let me look at the EnvironmentPaths class:

  32. Assistant

    Now let me look at the full gemini_cli run method carefully:

  33. Assistant

    Now I have a clear understanding of the codebase. Let me implement the OAuth credential injection for gemini-cli, mirroring the codex pattern. First, let me add the imports needed:

  34. Assistant

    Now I need to add the import for parse_bool_env_value:

  35. Assistant

    I see the edit duplicated the imports. Let me fix this by removing the duplicate lines:

  36. Assistant

    Let me fix the duplicated imports by removing lines 29-54:

  37. Assistant

    Good, the imports are clean now. Now I need to add the class constants and the _resolve_oauth_creds_path() method. Let me first add the class constants:

  38. Assistant

    I see there's a duplicate name() method and I also need to add PurePosixPath import. Let me fix both issues:

  39. Assistant

    Now let me remove the duplicate name() method:

  40. Assistant

    Good. Now I need to add the _resolve_oauth_creds_path() method. Let me add it after the name() method:

  41. Assistant

    Good. Now I need to modify the run() method to inject the OAuth credentials. Let me find and view the run method:

  42. Assistant

    Let me view the run method now:

  43. Assistant

    Now I need to modify the run() method to add OAuth credential injection. Let me replace the entire run method:

  44. Assistant

    Let me verify the rest of the file looks good:

  45. Assistant

    Good. Now let me verify the full file is syntactically correct by running a quick syntax check:

  46. Assistant

    Now let me create the test file for the OAuth creds functionality. I'll mirror the codex auth tests:

  47. Assistant

    Now let me write the test file:

  48. Assistant

    Good. Now let me run the tests to make sure they pass:

  49. Assistant

    Let me check how tests are run in this project:

  50. Assistant

    I see - we need asyncio_mode = "auto" but it's complaining about unknown config option. Let me check if there's a pytest-asyncio installed and try with the venv Python:

  51. Assistant

    All 18 tests pass. Now let me also run the existing gemini_cli tests to make sure I haven't broken anything:

  52. Assistant

    All tests pass. Let me also run the existing codex auth tests to make sure those still pass too:

  53. Assistant

    All tests pass. Let me verify the final state of my changes by looking at the diff:

  54. Assistant

    Let me check the git status to see all changes:

  55. Assistant

    Let me view the full diff:

  56. Assistant

    Let me also run the existing MCP test to make sure it still passes:

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