fix(server): deliver Antigravity sign-in URLs without stderr #10704
main fromrefs/pull/10704/head·opened View on GitHubAntigravity sign-in can remain stuck when Python's Windows browser subprocess loses the helper's stderr, leaving T3 without the Google authorization URL (#9624; transport investigation in #9690).
Send the existing browser helper's URL to a tokenized 127.0.0.1 listener scoped to explicit sign-in. The listener validates the URL and passes it to the existing auth controller, preserving client ownership and remote callback handling. Rejected or failed listener delivery falls back to the existing stderr marker. The helper still exits successfully if cancellation closes both the listener and stderr, preventing a fallback browser launch on the server. Ambient listener variables are removed before configuring each process.
Validation on Windows:
- 52 focused auth/support tests passed, including actual helper execution with all stdio discarded, listener cleanup, invalid/oversized requests, and environment isolation. Eight existing shell-based driver tests are skipped on Windows.
- Server typecheck, targeted lint, and formatting passed.
- Python 3.10
webbrowsersuccessfully delivered a synthetic URL through the new listener. The standalone probe preserved stderr before the change, so it did not independently reproduce the reported failure; the regression test explicitly discards stdio. No full Google OAuth or client UI session was performed.
Fixes #9624.
Model: GPT-6. Harness: Codex.
Note
Deliver Antigravity sign-in URLs via loopback HTTP listener instead of stderr#
- Adds
serveAntigravityAuthorizationUrlSink, a scoped loopback HTTP listener with a random 32-byte token in the path that accepts one POST, forwards the parsed authorization URL to the supplied callback, and returns 204 on success. - The generated browser-helper now posts the authorization URL to the configured sink with a 5-second timeout, falling back to the stderr marker path when no sink is set.
buildAntigravityAcpSpawnInputwrites the sink URL to the canonical environment variable only when supplied, andremovedEnvironmentKeysstrips inherited sink values so stale values are not carried forward.AntigravityDriver.createstarts the listener when an authorization callback is provided and passes the resulting URL into the ACP spawn configuration.- Risk: stale
ANTIGRAVITY_AUTHORIZATION_SINKaliases in the environment are silently dropped; only the canonical variable name is emitted, so any external tooling relying on the old alias will stop receiving the sink URL.
📊 Macroscope summarized 8422493. 2 files reviewed, 2 issues evaluated, 1 issue filtered, 1 comment posted
🗂️ Filtered Issues#
apps/server/src/provider/Drivers/AntigravityDriver.ts — 0 comments posted, 1 evaluated, 1 filtered
- line 158:
makeRuntimeprepares the profile before it creates/passes the authorization sink.prepareAntigravityProfileexecutes the new browser helper with an environment that stripsT3_ANTIGRAVITY_AUTH_SINK; the helper evaluates(undefined).then(...)when that variable is absent, throws, and never emits the stderr preflight marker that profile preparation requires. Consequently every Antigravity runtime setup fails before ACP starts, including explicit sign-in flows. [ Cross-file consolidated ]
Summary by CodeRabbit#
New Features
- Authorization URLs can now be delivered directly during Antigravity authentication flows.
- Authentication continues to support fallback URL delivery when direct delivery is unavailable.
- Authorization requests are validated and limited to the active authentication flow.
Bug Fixes
- Improved authentication handling when standard input/output channels are unavailable.
- Added request-size limits and clearer handling of invalid authorization requests.
- Prevented stale authentication connection settings from interfering with new login attempts.
- 1
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:M
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
545b9d17-3e43-4583-ae63-afa50090d2be📥 Commits
Reviewing files that changed from the base of the PR and between 7ad9a7b8d8e308bb7945fd66b10e24ade79dc16a and 991fd6d3656cc289c7050222a085587ea50ae1e7.
📒 Files selected for processing (2)
apps/server/src/provider/antigravityAuthSupport.test.tsapps/server/src/provider/antigravityAuthSupport.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough#
The Antigravity authentication flow now uses a loopback HTTP sink to deliver authorization URLs. The browser helper posts the URL to the sink, and the server forwards valid requests to the runtime callback. Tests cover validation, cleanup, shutdown, and end-to-end delivery.
Changes#
Antigravity authentication handoff
Layer / File(s) Summary Loopback authorization sink
apps/server/src/provider/antigravityAuthSupport.tsAdds a loopback HTTP listener with tokenized paths, POST validation, URL parsing, body-size limits, scoped shutdown, and error handling. Helper and runtime wiring
apps/server/src/provider/antigravityAuthSupport.ts,apps/server/src/provider/Drivers/AntigravityDriver.tsThe browser helper posts authorization URLs to the sink. The driver creates the sink when onAuthorizationUrlis available and passes its URL into the spawned environment.Integration coverage
apps/server/src/provider/antigravityAuthSupport.test.tsTests environment cleanup, request rejection, URL delivery, error handling, listener shutdown, and successful helper completion. Priority: ➖ Normal — Impact reflects medium issue severity.
Estimated code review effort: 3 (Moderate) | ~20 minutes
Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to
84224Antigravity sign-in URLs are delivered through a scoped local listener with the existing stderr marker retained as a fallback. The covered failure and shutdown paths leave no concrete current-head merge-blocking risk.
Sequence Diagram(s)#
sequenceDiagram participant BrowserHelper participant AuthorizationSink participant AntigravityAuthCallback BrowserHelper->>AuthorizationSink: POST authorization URL AuthorizationSink->>AntigravityAuthCallback: forward validated URL AntigravityAuthCallback-->>AuthorizationSink: complete or failSuggested reviewers:
t3dotgg,wellyngtonf🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation Linked Issues check ✅ Passed The changes address issue #9624by adding a scoped loopback listener for Antigravity authorization URLs, preserving stderr fallback behavior, and forwarding the URL to the existing authentication cont…Out of Scope Changes check ✅ Passed The changes are limited to Antigravity authorization URL transport, environment isolation, listener validation, fallback behavior, and focused tests. No unrelated code changes are identified. Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Title check ✅ Passed The title clearly and concisely describes the main change: delivering Antigravity sign-in URLs without relying on stderr. Description check ✅ Passed The description clearly explains what changed, why it changed, the fallback behavior, validation performed, and known verification limits. It does not use the template headings or checklist, but the r… ✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
Comment `@coderabbitai help` to get the list of available commands.Addressed the review findings in 991fd6d36:
- CodeRabbit's delivery-failure concern was valid: a rejected fetch or non-success HTTP response previously exited without preserving the URL. The helper now falls back to the existing stderr marker in both cases, while retaining exit code 0 if stderr is closed after cancellation. Added actual subprocess coverage for absent, rejecting, and closed listeners.
- The
undefined.thenwarning in CodeRabbit's linked-issue check and Macroscope's filtered summary is a false positive. In the original expression,.then(...)is part of the right-hand operand of&&:(sink && fetch(...).then(...)) || report(). With no sink, neither fetch nor.thenruns. The existing preflight already exercised this, and the new test explicitly verifies no-sink marker delivery and exit code 0. - Macroscope's correctness check passed. Its approvability result requests human review of the auth transport and the Node HTTP diagnostic suppression; that is not a correctness finding. The suppression remains scoped to the Node HTTP factory used by the Effect-managed listener. This change does not claim or bypass human approval.
Validation: 52 focused auth/support tests passed. After replacing the new test's JSON encoder with the repository's Schema helper, all 33 support tests passed again. Server typecheck, targeted lint, formatting, and diff checks passed. Full Google OAuth/client verification remains unperformed as documented in the PR.
Bugbot is paused — on-demand spend limit reached
Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.
A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.
Independent Linux report in support of this fix.
On Omarchy 4.0.4-1 with T3 Code 0.0.42-2 and the managed
agy_acp_server_1.1.1, Antigravity reached the same state described in #9624:Google sign-in failed. Start sign-in again., with no sign-in action or copyable URL in the provider UI. The system URL handler and keyring were both working.A controlled desktop restart recovered the provider. Its cached state moved from
error/ unknown authentication toready/oauth-personal, and T3 exposed 11 Antigravity models after sign-in. I also used a persistent, disk-backedTMPDIR; the ACP bundle is large enough that a small tmpfs can cause a separate installation or health-check failure.So there are two distinct failure modes worth keeping separate:
- ACP extraction or health checks failing because temporary storage is constrained.
- A valid Google authorization URL not reaching the T3 UI/browser path.
The restart is a practical recovery for the first/stuck-session state, but it does not provide the missing URL fallback. This PR addresses the second problem directly and would help Linux users as well as the Windows reproduction in #9624.
juliusmarminge added labelsmacroscope-review
- @@ -55,4 +65,6 @@5565 // Keep this source free of both colons and semicolons. EPIPE must still exit 05666 // so Python does not fall back to an OS browser after cancellation.5767 const browserHelperSource =58- `process.stderr.on("error",()=>process.exit(0)).write(` +68+ `(report=>(process.env.T3_ANTIGRAVITY_AUTH_SINK&&fetch(process.env.T3_ANTIGRAVITY_AUTH_SINK,` +69+ `Object.fromEntries([["method","POST"],["body",process.argv[1]],` +70+ `["signal",AbortSignal.timeout(5000)]])).then(response=>response.ok&&process.exit(0)||report(),report))||report())` +
🟠 High
provider/antigravityAuthSupport.ts:70When
T3_ANTIGRAVITY_AUTH_SINKis absent, the generated browser helper throws while evaluating.then(...)instead of writing the stderr preflight marker, soprepareAntigravityProfilefails every sinkless setup, including explicit sign-in flows. Make the promise continuation optional so the helper reaches its fallbackreport()path.- `["signal",AbortSignal.timeout(5000)]])).then(response=>response.ok&&process.exit(0)||report(),report))||report())` + + `["signal",AbortSignal.timeout(5000)]))?.then(response=>response.ok&&process.exit(0)||report(),report))||report())` +Also found in 1 other location(s)
apps/server/src/provider/Drivers/AntigravityDriver.ts:158makeRuntimeprepares the profile before it creates/passes the authorization sink.prepareAntigravityProfileexecutes the new browser helper with an environment that stripsT3_ANTIGRAVITY_AUTH_SINK; the helper evaluates(undefined).then(...)when that variable is absent, throws, and never emits the stderr preflight marker that profile preparation requires. Consequently every Antigravity runtime setup fails before ACP starts, including explicit sign-in flows.🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/provider/antigravityAuthSupport.ts around line 70: When `T3_ANTIGRAVITY_AUTH_SINK` is absent, the generated browser helper throws while evaluating `.then(...)` instead of writing the stderr preflight marker, so `prepareAntigravityProfile` fails every sinkless setup, including explicit sign-in flows. Make the promise continuation optional so the helper reaches its fallback `report()` path. Also found in 1 other location(s): - apps/server/src/provider/Drivers/AntigravityDriver.ts:158 -- `makeRuntime` prepares the profile before it creates/passes the authorization sink. `prepareAntigravityProfile` executes the new browser helper with an environment that strips `T3_ANTIGRAVITY_AUTH_SINK`; the helper evaluates `(undefined).then(...)` when that variable is absent, throws, and never emits the stderr preflight marker that profile preparation requires. Consequently every Antigravity runtime setup fails before ACP starts, including explicit sign-in flows.I independently checked the generated helper at
8422493in real Node 22 subprocesses. All seven cases passed, including an absent or empty sink, HTTP failure, and a closed listener; the missing-sink cases exit 0 and emit the expected stderr marker..then(...)is inside the right-hand operand of&&, so an absent sink short-circuits before the call. A control with.thenoutside the conditional reproduces the TypeError. The no-sink failure reported here is a false positive at this head. I have not verified a complete OAuth login or native Windows integration. Note
Written by
claude-opus-5-5on behalf of MariaHi! We are cleaning up open PRs, and this one appears to have been created with an older model (
gpt-6). If this change is really important, we recommend rebuilding the PR with a newer model if possible.maria-rcks closed this
Fresh technical follow-up after today's closure: I compared current
main(ed0f7b9) with this PR's helper at8422493in an isolated Linux checkout.Nine real Node subprocess checks passed. With stderr captured, current main emits the URL marker. With every stdio stream discarded, it has no loopback delivery path. This PR's unchanged generated helper delivered the exact synthetic URL to a local listener with all stdio discarded; absent/empty sinks, HTTP rejection, and a closed listener retained the documented fallback and exit behavior. The no-sink
undefined.thenfinding remains a false positive at this head.This is a controlled transport regression, not a reproduction of the original Windows launch path or a complete Google OAuth/client test. No credentials or actual authorization URLs were used. I did not run the whole server suite or rebase this branch.
Current main still has the stderr-only helper. #14969 improves provider-error reporting and is useful, but does not add this URL delivery path. Would a current-main rebase retaining the focused transport regression be useful for reconsideration? The transport evidence still seems relevant independently of the newer diagnostics work.
Fresh Windows reproduction related to #9624:
- T3 Code desktop and local server: 0.1.5
- OS: Windows x64, build 10.0.26300
- Antigravity runtime shown in Provider settings: v1.4.1
In Settings > Providers > Antigravity, clicking Google-account sign-in leaves the UI at “Starting Google sign-in.” with Cancel. No browser opens, and no Open browser or Copy sign-in link controls appear.
The server trace records
provider.auth.startat 2026-10-29 18:49:36.763Z (8.1 ms) and an auth subscription lasting about 19 seconds. The retained desktop trace has no external-browser open record.A follow-up network check on the same PC found that
accounts.google.comresolves to both IPv4 and IPv6; TCP 443 succeeds over IPv4 and fails over IPv6. T3 v0.1.5 mentions broken IPv6 as a possible cause of delayed Google sign-in. This may explain the delay, but does not confirm that this PR’s URL-transport issue is the cause.Investigated with GPT-6 in Codex.
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This authentication fix introduces a new loopback HTTP delivery path and changes how the browser helper communicates with the server during sign-in. It also adds a production static-analysis suppression directive, so the change warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).