fix(server): Antigravity Google sign-in works again on hosts without a display #38386
main fromrefs/pull/38386/head·opened View on GitHubProblem#
On a host with no display (a headless Linux server, WSL without GUI apps), Antigravity Google sign-in from Settings → Providers always fails with "Google sign-in failed. Start sign-in again." The native CLI 1.5.x answers ACP authenticate with:
-32603 No browser is available here (no graphical display is available to open a browser). Run `agy acp --login` in a terminal on this machine, then retry; or use a Gemini API key.
It no longer calls T3's BROWSER helper, so T3 never receives a Google link. Running agy acp --login in a terminal does not help either: without --gemini-dir it stores the sign-in in ~/.gemini/antigravity-cli, which T3's instance profile never reads. This is the no-display half of #36034. #36037 makes the status show "sign-in required" in that case; this PR makes the sign-in itself work.
Fix#
CLI 1.5.x ships a sign-in made for this case: agy acp --login prints a Google link that returns to https://antigravity.google/oauth-callback, which shows a code, and then reads that code from stdin. (With clientCapabilities.auth.terminal it also advertises this as the ACP terminal method terminal-login, "works over SSH".)
When authenticate fails with the no-browser error and the method is the Google account:
- Server:
AntigravityAuthrunsagy acp --gemini-dir <instance profile> --app-data-dir antigravity-acp --loginwith the same environment as the ACP runtime, publishes its Google link, and asks for the code through the existingcredentialsinteraction (field "Code from the Antigravity page"). The code, or the full page address, is checked (the address must match the link'sstateand Antigravity's callback page) and written to the process's stdin. After it exits 0, sign-in continues as before: a fresh ACP process authenticates with the stored sign-in and publishes the catalog. - Clients: no change. Web and mobile already render the link (Open browser, copy) and
credentialsfields, so this reaches every surface without new contracts. - Unchanged: sign-in on a host with a display, the 127.0.0.1 redirect flow, Gemini Enterprise, and the API key methods.
The case where a display exists but nobody is watching it (1.5.x runs xdg-open on the server) is not covered here.
Verification#
- Real sign-in: I ran this branch's dev server on a headless arm64 Linux host (no
DISPLAY/WAYLAND_DISPLAY) with managed CLI 1.5.10, reached it over the tailnet from another computer, and signed in with a Google account through Settings → Providers → Antigravity. Logs from the run:- ACP
authenticate("oauth-personal") failed: No browser is available here … acp-login-…log:consumerOAuth: token acquired,authentication completed successfully- new ACP process:
ChainedAuth: authenticated via keyring - server trace:
AntigravityAuth.startSessionfailure (no browser) →AntigravityDriver.terminalLogin→AntigravityAuth.sendResponse→AntigravityAuth.startSessionsuccess →AntigravityAuth.runSignInsuccess. The provider then showed Authenticated · Google account with 9 models.
- ACP
- Tests: new cases in
AntigravityAuth.test.ts(fallback flow, code checks, process order),antigravityAuthSupport.test.ts(terminal link parsing) andantigravityCallback.test.ts(Antigravity callback page). All 3 fail onmainand pass here. vp run check:changed --concurrency 1: format, lint, knip, graphql, typecheck (3 packages), tests (5 files) pass.
| Before (nightly, headless host) | Code step | After |
|---|---|---|
![]() | ![]() | ![]() |
In the code step, the web client shows its fixed "Enter your credentials below." text for credentials interactions, not the server's message.
Fixes the in-app sign-in part of #36034. Related: #36037, upstream google-antigravity/antigravity-cli#1580.
Written with Claude Opus 5.5 in Claude Code (run from T3 Code).
🤖 Generated with Claude Code
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
3b79fb1Macroscope's review found this PR approvable — Restores Antigravity Google sign-in on headless hosts using the CLI’s code-entry flow. The fallback is narrowly triggered and retains sign-in ownership, expiry and callback validation safeguards.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
Sign in to join this conversation.



Closing: RVZO6 already has 3 or more open PRs here, which is the limit for contributors who are not vouched.
Once one of them is merged or closed, open this again. See the open PR limit.