Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(antigravity): hand the Google sign-in URL to T3 through a browser preload #9550

Closedshootingallday(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/9550/headopened View on GitHub

On Windows, Antigravity Google sign-in stays on its starting state and never shows the link. #9425 started reading the browser-helper marker from stderr, but the helper never runs: the agent's Python 3.10 webbrowser runs the whole BROWSER value as one executable with the URL as its only argument, so the quoted node -e ... -- %s command cannot start. Python then logs "Could not open a browser automatically", and the agent's own stdout copy of the URL sits in a block-buffered print() that only flushes at exit. T3 has no path to the URL, and the flow expires.

Reproduced against the packaged agent (agy_acp_server.exe, PyInstaller Python 3.10.4) on Windows 11 with the installed nightly 0.0.39-nightly.20260903. Reports in #9405 (closed by #9425) say sign-in still fails on the current nightly, which matches.

Fix

  • Sign-in launches set BROWSER to the bare T3 runtime executable, which Python can run, and add NODE_OPTIONS=--require <profile>/antigravity-acp/t3-browser-preload.cjs. Node resolves the URL argument as a path before preloads run, so the preload rebuilds the URL from <cwd>/https:/host/path, posts it to a per-sign-in loopback sink (T3_ANTIGRAVITY_AUTH_SINK, random token, 127.0.0.1, 204 only for POST /<token>), and exits 0. With no sink it writes the existing stderr marker, which the preflight check uses.
  • Only the sign-in launch carries NODE_OPTIONS, the runtime BROWSER, and the sink, so turn subprocesses never inherit them. Other launches keep the unrunnable BROWSER value so no browser opens.
  • The preload is written before the preflight helper runs, and the preflight now spawns the helper the way Python does: one executable, one URL argument.
  • Existing stdout and stderr URL paths stay as fallbacks; #9425's same-URL dedup handles duplicate delivery.

Verified end to end on Windows with the real packaged agent: the sink receives the URL about 100 ms after authenticate, no browser window opens, and a rebuilt server bundle in the installed nightly completes sign-in.

Tests

  • New: only the sign-in launch is routed through the preload and sink; the sign-in URL reaches the sink from a real spawn of the preload; the profile is not created when the helper cannot start.
  • Focused server suites (antigravityAuthSupport, AntigravityAuth, AntigravityAcpSupport, AntigravityProvider): 97 passed.
  • Server typecheck, targeted lint, and format check pass.

Built with Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code


Note

Medium Risk Touches OAuth sign-in, loopback HTTP, and subprocess environment wiring; scope is limited to Antigravity personal/business browser auth with existing URL validation and sign-in-only env isolation.

Overview Fixes Antigravity OAuth on Windows (and similar hosts) where Python 3.10’s webbrowser runs BROWSER as a single executable with the URL as its only argument, so the old quoted node -e helper never runs and the auth link stays stuck in block-buffered agent stdout.

Sign-in-only path: When onAuthorizationUrl is set, the driver starts serveAntigravityAuthorizationUrlSink and passes its URL into buildAntigravityAcpSpawnInput. That launch sets BROWSER to the bare T3 runtime, adds NODE_OPTIONS=--require <profile>/t3-browser-preload.cjs, and T3_ANTIGRAVITY_AUTH_SINK. The preload rebuilds the URL from Node’s path-mangled argv, POSTs it to the one-shot 127.0.0.1 listener (random token, size cap), then exits 0. Normal ACP sessions keep the non-runnable BROWSER string and no preload/sink so subprocesses do not inherit sign-in env.

Profile prep: Writes t3-browser-preload.cjs before verification; browser preflight now spawns the runtime with a URL argument (matching Python), not -e inline script. AntigravityProfile gains browserHelperPath and browserPreloadPath. Stdout/stderr URL parsing remains as fallbacks.

Tests cover env split (sign-in vs session), end-to-end preload→sink delivery, and updated installation validation mocks for URL-as-first-arg.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 35d2ecc886ca0218a747a1af540aeac96f707bf7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Route Google sign-in URL to T3 via browser preload and loopback sink in Antigravity

  • Sign-in ACP launches now set BROWSER to the profile's runtime executable and append a generated CommonJS preload to NODE_OPTIONS; ordinary ACP launches keep the configured browser command
  • The preload reconstructs an HTTPS URL from the Node entry argument and POSTs it to a loopback sink (or falls back to the existing stdout marker when no sink is set), then exits
  • serveAntigravityAuthorizationUrlSink starts a scoped loopback HTTP server on an ephemeral port with a tokenized POST path; invalid routes return 404 and oversized bodies return 413
  • prepareAntigravityProfile writes the preload file into the ACP profile and rejects profile paths containing a double quote to avoid preload-path injection
  • AntigravityDriver.create starts a loopback sink when the runtime input supplies an auth-URL callback and passes the sink endpoint into the ACP spawn config
  • Behavioral Change: antigravityEnvironment now strips the auth-sink env var from inherited environment keys; only explicitly supplied sign-in launches receive it. Profiles with quoted preload paths now fail preparation with an auth-support error
Macroscope summarized 35d2ecc.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. Closing; this did not follow the contribution process in CONTRIBUTING.md.

    3. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — The PR changes the production Google OAuth flow by adding a browser preload, loopback HTTP URL sink, and sign-in-specific subprocess environment wiring. It also adds a static-analysis diagnostic suppression, so the authentication and tooling implications warrant human review.

      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.