@devries-cameron20 / t3code-1 / commits / 6e8851cc43
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): Antigravity sign-in no longer blames the network when the runtime never starts (#29057)

Julius Marminge committed Nov 11, 2026 at 15:32 UTC 6e8851cc43f7876cf556969195abcad435418531
2 files changed +61 -18
apps/server/src/provider/AntigravityAuth.test.ts
+29
@@ -320,6 +320,35 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("AntigravityAuth"
320 }),
321 );
322
323 + it.effect("does not blame the network when the runtime never answers initialize", () =>
324 + Effect.gen(function* () {
325 + const initializing = yield* Deferred.make<void>();
326 + const harness = yield* makeHarness({
327 + beforeInitialize: Deferred.succeed(initializing, undefined).pipe(
328 + Effect.andThen(Effect.never),
329 + ),
330 + });
331 + yield* harness.auth.controller.start(owner);
332 + yield* Deferred.await(initializing);
333 + const blamesNetwork = /reach(ed)? Google|network|ipv6/i;
334 +
335 + yield* TestClock.adjust("90 seconds");
336 + const stalled = yield* harness.auth.controller.subscribe(owner).pipe(
337 + Stream.filter((state) => state.message !== "Starting Google sign-in."),
338 + Stream.runHead,
339 + Effect.map(Option.getOrThrow),
340 + );
341 + assert.equal(stalled.phase, "starting");
342 + assert.notMatch(stalled.message ?? "", blamesNetwork);
343 + assert.match(stalled.message ?? "", /not started|stuck/i);
344 +
345 + yield* TestClock.adjust("210 seconds");
346 + const failed = yield* phase(harness.auth, "failed");
347 + assert.notMatch(failed.message ?? "", blamesNetwork);
348 + assert.match(failed.message ?? "", /not respond|may not run/i);
349 + }),
350 + );
351 +
352 it.effect("keeps the expired message once the Google link was shown", () =>
353 Effect.gen(function* () {
354 const harness = yield* makeHarness();
apps/server/src/provider/AntigravityAuth.ts
+32 -18
@@ -31,11 +31,15 @@ import {
31 import type { ProviderAuthController } from "./ProviderAuthService.ts";
32
33 const AUTH_TIMEOUT_MS = 300_000;
34 -// Once initialized, a healthy agent shows the Google link or finishes within seconds. Its bundled
35 -// Python has no IPv4 fallback race, so a host with broken IPv6 waits about two minutes per Google
36 -// request. The hint is timed from initialize, not spawn: the one-file runtime unpacks itself on
37 -// every launch, which can take about a minute on Windows before it answers at all.
34 +// Once initialized, a healthy agent shows the Google link within seconds; its bundled Python has no
35 +// IPv4 fallback, so broken IPv6 stalls each Google request. Startup is timed separately: the
36 +// one-file runtime unpacks on every launch (about a minute on Windows) before it answers initialize.
37 const NO_RESPONSE_HINT_MS = 30_000;
38 +const STARTUP_HINT_MS = 90_000;
39 +const NOT_STARTED_MESSAGE =
40 + "Antigravity has not started after 90 seconds. Its runtime may be stuck starting on this machine.";
41 +const NOT_RESPONDING_MESSAGE =
42 + "Antigravity did not respond. Its runtime may not run on this machine.";
43 const NO_RESPONSE_MESSAGE =
44 "Antigravity has not reached Google after 30 seconds. Check this machine's network connection. Broken IPv6 is a common cause.";
45 const UNREACHABLE_MESSAGE =
@@ -55,6 +59,7 @@ interface AuthFlow {
59 readonly expiresAtMillis: number;
60 state: ProviderAuthState;
61 pending: AntigravityAuthorizationUrl | undefined;
62 + initialized: boolean;
63 callbackSent: boolean;
64 fiber: Fiber.Fiber<void> | undefined;
65 forwarding: Fiber.Fiber<void, ProviderSetupError> | undefined;
@@ -270,25 +275,31 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
275 ),
276 );
277
278 + const publishStartingHint = (flow: AuthFlow, delayMs: number, message: string) =>
279 + Effect.sleep(delayMs).pipe(
280 + Effect.andThen(
281 + lock.withPermits(1)(
282 + Effect.gen(function* () {
283 + if (activeFlow !== flow || flow.state.phase !== "starting") return;
284 + yield* publishFlow(flow, { ...flow.state, message });
285 + }),
286 + ),
287 + ),
288 + Effect.forkScoped,
289 + );
290 +
291 const runSignIn = Effect.fn("AntigravityAuth.runSignIn")(
292 function* (flow: AuthFlow, stopSessions: Effect.Effect<void, ProviderSetupError>) {
293 yield* stopSessions.pipe(Effect.ensuring(stopOwnedProcesses));
294 const runtime = yield* options.makeRuntime({
295 onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url),
296 });
297 + const startupHint = yield* publishStartingHint(flow, STARTUP_HINT_MS, NOT_STARTED_MESSAGE);
298 // `start` reuses this memoized handshake.
299 yield* runtime.initialize();
281 - yield* Effect.sleep(NO_RESPONSE_HINT_MS).pipe(
282 - Effect.andThen(
283 - lock.withPermits(1)(
284 - Effect.gen(function* () {
285 - if (activeFlow !== flow || flow.state.phase !== "starting") return;
286 - yield* publishFlow(flow, { ...flow.state, message: NO_RESPONSE_MESSAGE });
287 - }),
288 - ),
289 - ),
290 - Effect.forkScoped,
291 - );
300 + flow.initialized = true;
301 + yield* Fiber.interrupt(startupHint);
302 + yield* publishStartingHint(flow, NO_RESPONSE_HINT_MS, NO_RESPONSE_MESSAGE);
303 const started = yield* runtime.start();
304 yield* lock.withPermits(1)(
305 Effect.gen(function* () {
@@ -313,9 +324,11 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
324 Effect.fail(
325 setupError(
326 "start",
316 - flow.state.phase === "starting"
317 - ? UNREACHABLE_MESSAGE
318 - : "Google sign-in expired. Start sign-in again.",
327 + flow.state.phase !== "starting"
328 + ? "Google sign-in expired. Start sign-in again."
329 + : flow.initialized
330 + ? UNREACHABLE_MESSAGE
331 + : NOT_RESPONDING_MESSAGE,
332 ),
333 ),
334 }),
@@ -402,6 +415,7 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
415 expiresAtMillis,
416 state,
417 pending: undefined,
418 + initialized: false,
419 callbackSent: false,
420 fiber: undefined,
421 forwarding: undefined,