Skip to content

Commit 9a046f5

Browse files
fix(server): ignore a late Antigravity Google link after authentication
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent cbf6477 commit 9a046f5

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,23 @@ it.layer(NodeServices.layer)("AntigravityAuth", (it) => {
330330
}),
331331
);
332332

333+
it.effect("ignores a late duplicate Google link once sign-in authenticates", () =>
334+
Effect.gen(function* () {
335+
const harness = yield* makeHarness();
336+
yield* harness.auth.controller.start(owner);
337+
yield* phase(harness.auth, "waiting");
338+
yield* Deferred.succeed(harness.authenticated, undefined);
339+
yield* Deferred.await(harness.sessionRequested);
340+
341+
yield* harness.receiveAuthorizationUrl(authorizationUrl);
342+
const current = yield* harness.auth.controller
343+
.subscribe(owner)
344+
.pipe(Stream.runHead, Effect.map(Option.getOrThrow));
345+
assert.equal(current.phase, "verifying");
346+
assert.isNull(current.authorizationUrl);
347+
}),
348+
);
349+
333350
it.effect("does not call a completed Google sign-in expired when no session opens", () =>
334351
Effect.gen(function* () {
335352
const harness = yield* makeHarness();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* <
253253
Effect.flatMap((authorization) =>
254254
lock.withPermits(1)(
255255
Effect.gen(function* () {
256-
if (activeFlow !== flow || operation !== "auth") return;
256+
if (activeFlow !== flow || operation !== "auth" || flow.authenticated) return;
257257
if (flow.pending) {
258258
if (flow.pending.authorizationUrl === authorization.authorizationUrl) return;
259259
return yield* new AcpErrors.AcpTransportError({

0 commit comments

Comments
 (0)