Skip to content

fix(gemini_cli): pre-select auth method for headless API-key/Vertex runs#1794

Merged
RyanMarten merged 1 commit into
harbor-framework:mainfrom
bleonard:gemini-cli-headless-auth
Jun 3, 2026
Merged

fix(gemini_cli): pre-select auth method for headless API-key/Vertex runs#1794
RyanMarten merged 1 commit into
harbor-framework:mainfrom
bleonard:gemini-cli-headless-auth

Conversation

@bleonard

@bleonard bleonard commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Headless gemini --prompt cannot show the auth-method dialog and exits with "Invalid auth method selected" unless a method is pre-selected in settings.json. The agent only wrote security.auth.selectedType for the OAuth path, so API-key and Vertex runs relied on gemini-cli auto-detection -- which also breaks when a custom GOOGLE_GEMINI_BASE_URL (e.g. a proxy) is set.

Resolve the auth method from the env credentials in use (GEMINI_API_KEY/GOOGLE_API_KEY -> gemini-api-key, GOOGLE_GENAI_USE_VERTEXAI -> vertex-ai) and pin it in settings.json. The settings builder now takes a single auth_type ("oauth-personal", "gemini-api-key", or "vertex-ai") instead of an OAuth-only boolean.

Headless `gemini --prompt` cannot show the auth-method dialog and exits
with "Invalid auth method selected" unless a method is pre-selected in
settings.json. The agent only wrote security.auth.selectedType for the
OAuth path, so API-key and Vertex runs relied on gemini-cli auto-detection
-- which also breaks when a custom GOOGLE_GEMINI_BASE_URL (e.g. a proxy) is
set.

Resolve the auth method from the env credentials in use
(GEMINI_API_KEY/GOOGLE_API_KEY -> gemini-api-key, GOOGLE_GENAI_USE_VERTEXAI
-> vertex-ai) and pin it in settings.json. The settings builder now takes a
single auth_type ("oauth-personal", "gemini-api-key", or "vertex-ai")
instead of an OAuth-only boolean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Enjoy a better diff viewing experience by clicking one of these URLs:

@bleonard

bleonard commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

I can't imagine this openhands test is related. Is it known to be intermittent?

 +  where False = exists()
 +    where exists = PosixPath('/tmp/pytest-of-runner/pytest-1/popen-gw1/test_openhands_with_determinis0/trials/hello-world__d5AdeAi/agent/trajectory.json').exists
 +      where PosixPath('/tmp/pytest-of-runner/pytest-1/popen-gw1/test_openhands_with_determinis0/trials/hello-world__d5AdeAi/agent/trajectory.json') = Path(PosixPath('/tmp/pytest-of-runner/pytest-1/popen-gw1/test_openhands_with_determinis0/trials/hello-world__d5AdeAi/agent/trajectory.json'))
=================== 1 failed, 14 passed in 339.32s (0:05:39) ===================

@RyanMarten RyanMarten left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing!

@RyanMarten
RyanMarten merged commit 700972a into harbor-framework:main Jun 3, 2026
6 of 7 checks passed
Messimeimei added a commit to Messimeimei/bitfun-harbor that referenced this pull request Jul 7, 2026
700972a fix(gemini_cli): pre-select auth method for headless API-key/Vertex runs (harbor-framework#1794)
590f4f7 Fix installed agent ATIF exports (harbor-framework#1812)
9f65643 Update Islo SDK integration (harbor-framework#1824)
6cd496d fix(job): disable Rich stdout/stderr redirect to avoid deadlocks (harbor-framework#1829)
66cffed Suppress litellm debug output unless --debug is enabled (harbor-framework#1828)
48a577a Open PR diff links in a new tab. (harbor-framework#1831)
ae938b8 feat: GKE multi-container support via privileged DinD compose (harbor-framework#1773)
e1066b5 Add use.computer environment (harbor-framework#1834)
0f08f40 fix(pi): Reduce logging footprint (harbor-framework#1826)
9801da1 Update mini_swe_agent.py (harbor-framework#1837)
918a791 fix(check): accept all Claude auth methods, preferring the free subscription (harbor-framework#1766)
13f9692 fix(env): tar-based directory transfers for Modal, Daytona, and GKE (harbor-framework#1838)
8cfac6a Add Docker Compose support to Novita (harbor-framework#1830)
c978013 harbor-langsmith: persist run tags (top-level) and dataset metadata (under extra) (harbor-framework#1808)
a56546f Support wildcard network allowlist hosts (harbor-framework#1840)
6cd263a feat: add LangSmith sandbox environment (harbor-framework#1610)
e75ecc0 rewardkit: add REWARDKIT_MODEL override for agent judges (harbor-framework#1778)
9c78b85 Update Claude Code bootstrap installer URL (harbor-framework#1852)
6a21701 Added cline v2 and ATIF Trajectory support (harbor-framework#1495)
6996f65 feat(claude_code): support CLAUDE_FORCE_OAUTH to bill the subscription on harbor run (harbor-framework#1846)
904b323 Add built-in LangGraph agent (harbor-framework#1807)
b8976c9 Add GPU support to the Daytona environment (harbor-framework#1731)
2922220 Preserve tagged Docker images on delete (harbor-framework#1861)
c2c5796 Improve use.computer environment (harbor-framework#1853)
3de07a0 add session-id header (harbor-framework#1855)
3f941bd ci: fix ai-review fork-PR checkout for claude-code-action@v1 (harbor-framework#1874)
cdee965 Add network policy docs page under Tasks
253c546 Document environment support for network modes, phases, and capabilities
8d3384a Add Novita network policy support (harbor-framework#1867)
5270111 add procps to prevent process crashes when claude-code call tree-kill (harbor-framework#1864)
4195631 Add generic ACP registry agent support (harbor-framework#1464)
96eaf6b v0.13.2

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants