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 while the runtime starts (#30079)
Co-authored-by: wenshen <wlum0002@student.monash.edu> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
wenshen18643 committed
Nov 4, 2026 at 07:45 UTC
d075bed70f7b8cee456f06d299a11e99ea19673c
2 files changed
+58
-14
apps/server/src/provider/AntigravityAuth.test.ts
+49
-9
@@ -84,17 +84,21 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* (
84
yield* Deferred.succeed(closed, undefined);
85
}),
86
);
87
+ // Like AcpSessionRuntime, `start` reuses one memoized initialize handshake.
88
+ const initialize = yield* Effect.cached(
89
+ Effect.gen(function* () {
90
+ events.push("initialize");
91
+ yield* options.beforeInitialize ?? Effect.void;
92
+ return options.supportsLogout === false
93
+ ? { ...initialized, agentCapabilities: {} }
94
+ : initialized;
95
+ }),
96
+ );
97
return {
88
- initialize: () =>
89
- Effect.gen(function* () {
90
- events.push("initialize");
91
- yield* options.beforeInitialize ?? Effect.void;
92
- return options.supportsLogout === false
93
- ? { ...initialized, agentCapabilities: {} }
94
- : initialized;
95
- }),
98
+ initialize: () => initialize,
99
start: () =>
100
Effect.gen(function* () {
101
+ yield* initialize;
102
events.push("authenticate");
103
yield* Deferred.succeed(authenticateCalled, undefined);
104
if (options.interactive !== false && input.onAuthorizationUrl) {
@@ -280,6 +284,42 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("AntigravityAuth"
284
}),
285
);
286
287
+ it.effect("does not blame the network while the runtime is still starting", () =>
288
+ Effect.gen(function* () {
289
+ const initializing = yield* Deferred.make<void>();
290
+ const ready = yield* Deferred.make<void>();
291
+ const harness = yield* makeHarness({
292
+ interactive: false,
293
+ beforeInitialize: Deferred.succeed(initializing, undefined).pipe(
294
+ Effect.andThen(Deferred.await(ready)),
295
+ ),
296
+ });
297
+ const hasHint = harness.auth.controller.subscribe(owner).pipe(
298
+ Stream.runHead,
299
+ Effect.map((state) => Option.getOrThrow(state).message?.includes("Broken IPv6") === true),
300
+ );
301
+ yield* harness.auth.controller.start(owner);
302
+ yield* Deferred.await(initializing);
303
+
304
+ // A one-file runtime can take about a minute to unpack before it answers initialize.
305
+ yield* TestClock.adjust("60 seconds");
306
+ assert.isFalse(yield* hasHint);
307
+
308
+ yield* Deferred.succeed(ready, undefined);
309
+ yield* Deferred.await(harness.authenticateCalled);
310
+ yield* TestClock.adjust("29 seconds");
311
+ assert.isFalse(yield* hasHint);
312
+
313
+ yield* TestClock.adjust("1 second");
314
+ const stalled = yield* harness.auth.controller.subscribe(owner).pipe(
315
+ Stream.filter((state) => state.message?.includes("Broken IPv6") === true),
316
+ Stream.runHead,
317
+ Effect.map(Option.getOrThrow),
318
+ );
319
+ assert.equal(stalled.phase, "starting");
320
+ }),
321
+ );
322
+
323
it.effect("keeps the expired message once the Google link was shown", () =>
324
Effect.gen(function* () {
325
const harness = yield* makeHarness();
@@ -385,7 +425,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("AntigravityAuth"
425
assert.isTrue(Exit.isFailure(competing));
426
const resumed = yield* phase(harness.auth, "waiting");
427
assert.equal(resumed.flowId, first.flowId);
388
- assert.deepEqual(harness.events, ["process-open", "authenticate"]);
428
+ assert.deepEqual(harness.events, ["process-open", "initialize", "authenticate"]);
429
yield* harness.auth.controller.cancel(owner, first.flowId!);
430
}),
431
);
apps/server/src/provider/AntigravityAuth.ts
+9
-5
@@ -31,8 +31,10 @@ import {
31
import type { ProviderAuthController } from "./ProviderAuthService.ts";
32
33
const AUTH_TIMEOUT_MS = 300_000;
34
-// A healthy agent shows the Google link or finishes within seconds. Its bundled Python has no
35
-// IPv4 fallback race, so a host with broken IPv6 waits about two minutes per Google request.
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.
38
const NO_RESPONSE_HINT_MS = 30_000;
39
const NO_RESPONSE_MESSAGE =
40
"Antigravity has not reached Google after 30 seconds. Check this machine's network connection. Broken IPv6 is a common cause.";
@@ -271,6 +273,11 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
273
const runSignIn = Effect.fn("AntigravityAuth.runSignIn")(
274
function* (flow: AuthFlow, stopSessions: Effect.Effect<void, ProviderSetupError>) {
275
yield* stopSessions.pipe(Effect.ensuring(stopOwnedProcesses));
276
+ const runtime = yield* options.makeRuntime({
277
+ onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url),
278
+ });
279
+ // `start` reuses this memoized handshake.
280
+ yield* runtime.initialize();
281
yield* Effect.sleep(NO_RESPONSE_HINT_MS).pipe(
282
Effect.andThen(
283
lock.withPermits(1)(
@@ -282,9 +289,6 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
289
),
290
Effect.forkScoped,
291
);
285
- const runtime = yield* options.makeRuntime({
286
- onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url),
287
- });
292
const started = yield* runtime.start();
293
yield* lock.withPermits(1)(
294
Effect.gen(function* () {