Skip to content

Commit ef554ff

Browse files
fix(server): Antigravity sign-in no longer blames the network when the agent never starts
Sign-in said Antigravity had not reached Google, and later could not reach it, whenever the flow was still starting. On an Intel Mac the runtime hangs before it answers ACP initialize, so T3 blamed the network and IPv6 for a local process hang. runSignIn now awaits initialize before start and records it on the flow. Until the agent answers, the 30 second hint and the timeout say the runtime may be stuck on this machine; afterwards the network messages are unchanged. The real runtime caches initialize, and the test harness now does too. Fixes #29039 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 562c9ef commit ef554ff

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

‎apps/server/src/provider/AntigravityAuth.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,21 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* (
8282
yield* Deferred.succeed(closed, undefined);
8383
}),
8484
);
85-
const initialize = () =>
85+
// Cached like the real AcpSessionRuntime, so start() reuses an earlier initialize.
86+
const initialize = yield* Effect.cached(
8687
Effect.gen(function* () {
8788
events.push("initialize");
8889
yield* options.beforeInitialize ?? Effect.void;
8990
return options.supportsLogout === false
9091
? { ...initialized, agentCapabilities: {} }
9192
: initialized;
92-
});
93+
}),
94+
);
9395
return {
94-
initialize,
96+
initialize: () => initialize,
9597
start: () =>
9698
Effect.gen(function* () {
97-
yield* initialize();
99+
yield* initialize;
98100
events.push("authenticate");
99101
yield* Deferred.succeed(authenticateCalled, undefined);
100102
if (options.interactive !== false && input.onAuthorizationUrl) {

‎apps/server/src/provider/AntigravityAuth.ts‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ import type { ProviderAuthController } from "./ProviderAuthService.ts";
3333
const AUTH_TIMEOUT_MS = 300_000;
3434
// A healthy agent shows the Google link or finishes within seconds. Its bundled Python has no
3535
// IPv4 fallback race, so a host with broken IPv6 waits about two minutes per Google request.
36+
// An agent that never answers initialize is hung locally, so the network is not to blame.
3637
const NO_RESPONSE_HINT_MS = 30_000;
38+
const NOT_STARTED_MESSAGE =
39+
"Antigravity has not responded after 30 seconds. Its runtime may be stuck starting on this machine.";
40+
const NOT_RESPONDING_MESSAGE =
41+
"Antigravity did not respond. Its runtime may not run on this machine.";
3742
const NO_RESPONSE_MESSAGE =
3843
"Antigravity has not reached Google after 30 seconds. Check this machine's network connection. Broken IPv6 is a common cause.";
3944
const UNREACHABLE_MESSAGE =
@@ -53,6 +58,7 @@ interface AuthFlow {
5358
readonly expiresAtMillis: number;
5459
state: ProviderAuthState;
5560
pending: AntigravityAuthorizationUrl | undefined;
61+
initialized: boolean;
5662
callbackSent: boolean;
5763
fiber: Fiber.Fiber<void> | undefined;
5864
forwarding: Fiber.Fiber<void, ProviderSetupError> | undefined;
@@ -276,7 +282,10 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
276282
lock.withPermits(1)(
277283
Effect.gen(function* () {
278284
if (activeFlow !== flow || flow.state.phase !== "starting") return;
279-
yield* publishFlow(flow, { ...flow.state, message: NO_RESPONSE_MESSAGE });
285+
yield* publishFlow(flow, {
286+
...flow.state,
287+
message: flow.initialized ? NO_RESPONSE_MESSAGE : NOT_STARTED_MESSAGE,
288+
});
280289
}),
281290
),
282291
),
@@ -285,6 +294,8 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
285294
const runtime = yield* options.makeRuntime({
286295
onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url),
287296
});
297+
yield* runtime.initialize();
298+
flow.initialized = true;
288299
const started = yield* runtime.start();
289300
yield* lock.withPermits(1)(
290301
Effect.gen(function* () {
@@ -309,9 +320,11 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
309320
Effect.fail(
310321
setupError(
311322
"start",
312-
flow.state.phase === "starting"
313-
? UNREACHABLE_MESSAGE
314-
: "Google sign-in expired. Start sign-in again.",
323+
flow.state.phase !== "starting"
324+
? "Google sign-in expired. Start sign-in again."
325+
: flow.initialized
326+
? UNREACHABLE_MESSAGE
327+
: NOT_RESPONDING_MESSAGE,
315328
),
316329
),
317330
}),
@@ -398,6 +411,7 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
398411
expiresAtMillis,
399412
state,
400413
pending: undefined,
414+
initialized: false,
401415
callbackSent: false,
402416
fiber: undefined,
403417
forwarding: undefined,

0 commit comments

Comments
 (0)