authorgravatar for maria@kuuro.netmaria <maria@kuuro.net> 2026-09-05 14:45:16-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 14:45:16-04:00
log6349a0e68a958cc51b7b5198683c1d1db88b8d28
tree22fa9431abd4776d9365a570f0c89508118c2be2
parent89bd6376de0ca3513f9d9942a42ffc6e1ac1d7c1
signature Signed by PGP key B5690EEEBB952194

fix(antigravity): distinguish session initialization auth failures (#9919)


2 files changed, 31 insertions(+), 1 deletions(-)

apps/server/src/provider/AntigravityAuth.test.ts+28-1
...@@ -61,7 +61,7 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* (...@@ -61,7 +61,7 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* (
61 } = {},61 } = {},
62) {62) {
63 const authenticated = yield* Deferred.make<void, AcpErrors.AcpError>();63 const authenticated = yield* Deferred.make<void, AcpErrors.AcpError>();
64 const discovered = yield* Deferred.make<void>();64 const discovered = yield* Deferred.make<void, AcpErrors.AcpError>();
65 const closed = yield* Deferred.make<void>();65 const closed = yield* Deferred.make<void>();
66 const events: string[] = [];66 const events: string[] = [];
67 let receiveAuthorizationUrl:67 let receiveAuthorizationUrl:
...@@ -224,6 +224,33 @@ it.layer(NodeServices.layer)("AntigravityAuth", (it) => {...@@ -224,6 +224,33 @@ it.layer(NodeServices.layer)("AntigravityAuth", (it) => {
224 }),224 }),
225 );225 );
226226
227 it.effect(
228 "distinguishes a post-authentication session failure without exposing its payload",
229 () =>
230 Effect.gen(function* () {
231 const harness = yield* makeHarness();
232 yield* harness.auth.controller.start(owner);
233 yield* phase(harness.auth, "waiting");
234 yield* Deferred.succeed(harness.authenticated, undefined);
235 yield* Deferred.fail(
236 harness.discovered,
237 new AcpErrors.AcpRequestError({
238 code: -32603,
239 errorMessage: `Internal error ${callbackUrl}`,
240 method: "session/new",
241 }),
242 );
243 const failed = yield* phase(harness.auth, "failed");
244 assert.equal(
245 failed.message,
246 "Antigravity authenticated, but could not initialize a session or load models.",
247 );
248 assert.isNull(failed.authorizationUrl);
249 assert.deepEqual(harness.catalog(), ["previous-account-model"]);
250 yield* Deferred.await(harness.closed);
251 }),
252 );
253
227 it.effect("does not call callback HTTP success a successful Google sign-in", () =>254 it.effect("does not call callback HTTP success a successful Google sign-in", () =>
228 Effect.gen(function* () {255 Effect.gen(function* () {
229 const harness = yield* makeHarness();256 const harness = yield* makeHarness();
apps/server/src/provider/AntigravityAuth.ts+3
...@@ -114,6 +114,9 @@ function safeAuthFailure(cause: Cause.Cause<unknown>, usesBrowser: boolean): str...@@ -114,6 +114,9 @@ function safeAuthFailure(cause: Cause.Cause<unknown>, usesBrowser: boolean): str
114 if (/access_denied|denied access|cancelled/i.test(error.value.errorMessage)) {114 if (/access_denied|denied access|cancelled/i.test(error.value.errorMessage)) {
115 return "Google sign-in was not approved. Start sign-in again.";115 return "Google sign-in was not approved. Start sign-in again.";
116 }116 }
117 if (error.value.method === "session/new" && error.value.code === -32603) {
118 return "Antigravity authenticated, but could not initialize a session or load models.";
119 }
117 if (!usesBrowser && error.value.code === -32602) {120 if (!usesBrowser && error.value.code === -32602) {
118 return "Antigravity rejected the configured credentials. Check the provider settings.";121 return "Antigravity rejected the configured credentials. Check the provider settings.";
119 }122 }