Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(antigravity): harden the Google sign-in, sign-out and session setup (#6084)

Milind Sonic5917dcebb43
diff --git a/NOTICE b/NOTICE
index bd6682651d..24682ae610 100644
--- a/NOTICE
+++ b/NOTICE
@@ -6,8 +6,9 @@ Version 2.0, with the consent of all contributors whose copyright was
incorporated before the transition.
The Google Antigravity ACP integration adapts release, installation, profile,
-authentication, and runtime temporary-folder behavior from T3 Code, Copyright
-2026 T3 Tools Inc., used under the MIT License (third_party/t3-code/LICENSE).
+authentication, sign-out, session setup, and runtime temporary-folder behavior
+from T3 Code, Copyright 2026 T3 Tools Inc., used under the MIT License
+(third_party/t3-code/LICENSE).
Selected-text citation matching adapts T3 Code's assistant citation selection,
Copyright 2026 T3 Tools Inc., used under the MIT License.
diff --git a/server/contracts.ts b/server/contracts.ts
index a32afc7435..2fa5fd0064 100644
--- a/server/contracts.ts
+++ b/server/contracts.ts
@@ -470,7 +470,8 @@ export interface ProviderAuthenticationStart {
}
export interface ProviderAuthenticationStatus extends Omit<ProviderAuthenticationStart, "phase"> {
- phase: "waiting" | "succeeded" | "failed" | "expired" | "cancelled";
+ /** `verifying`: the person's part is done and the provider is finishing the sign-in. */
+ phase: "waiting" | "verifying" | "succeeded" | "failed" | "expired" | "cancelled";
/** Safe, actionable copy; never unfiltered CLI output or credentials. */
message?: string;
}
@@ -572,7 +573,8 @@ export interface ProviderInstance {
/** Optional first-party runtime installation and account setup. */
readonly installRuntime?: () => Promise<void>;
readonly startAuthentication?: () => Promise<ProviderAuthenticationStart>;
- readonly authenticationMethod?: "browser-pkce" | "browser";
+ /** Named when the calls an instance offers do not tell its sign-in apart; `callback-url` is a link plus a redirect URL pasted back. */
+ readonly authenticationMethod?: "browser-pkce" | "browser" | "callback-url";
readonly getAuthentication?: (flowId: string) => Promise<ProviderAuthenticationStatus>;
readonly completeAuthentication?: (flowId: string, callbackUrl: string) => Promise<void>;
readonly cancelAuthentication?: () => Promise<void>;
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index e7c78e7368..c3d80259ab 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -63,7 +63,7 @@ import { acpSessionOperationKey, acpShellRequest, answersAlone, permissionLaunch
import { openQuestionRequest, questionRequestFor, type AcpQuestionRequest } from "./question-requests.ts";
import { commandSummary, toolDetailPreview } from "../../tool-summary.ts";
import { acpToolEndEvents } from "./tool-items.ts";
-import { AcpHost } from "./host.ts";
+import { AcpHost } from "./host.ts"; import { SignInRequests, type AcpDriverHooks } from "./driver-hooks.ts";
import { exitDetail } from "./exit-report.ts";
import { endTurn, trackRunningTool, type AcpAskFinish, type AcpSession, type AcpTurn } from "./turn-state.ts";
import { recoveryPromptFor } from "../../resume-recovery.ts";
@@ -91,7 +91,7 @@ export interface AcpConfig {
}
/** Per-CLI specifics plugged into the shared ACP runtime; `askTool` is the native tool `questionRequests` come from. */
-export interface AcpSupport {
+export interface AcpSupport extends AcpDriverHooks {
questionRequests?: Readonly<Record<string, AcpQuestionRequest>>; askTool?: string;
/** Verified native catalog parameters, applied before both new and restored sessions. */
toolScopeSessionParams?(turn: SendTurnInput, initializeResult: unknown, hasMcp: boolean,
@@ -586,7 +586,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
}
};
- const hosts = new Set<AcpHost>();
+ const hosts = new Set<AcpHost>(), signIn = new SignInRequests(support, instanceId);
// Between turns nothing is brokered; the agent must never block on an unanswered request.
const refuse = (msg: any, send: (obj: unknown) => void) => {
const question = questionRequestFor(support.questionRequests, msg.method);
@@ -607,7 +607,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
if (running) return running;
const child = spawnCli(launch.command, argv, { cwd, env, stdio: ["pipe", "pipe", "pipe"], box: { allowEnv: instanceEnvNames(input.environment, env), botThreads: hostKey !== null, ro: launch.ro } }, "bot");
const host = new AcpHost(child, hostKey, { source: SOURCE, logMessage: nativeLogMessage, unrouted: refuse });
- hosts.add(host);
+ hosts.add(host); signIn.watch(host);
child.once("close", () => hosts.delete(host));
child.once("error", () => hosts.delete(host));
return host;
@@ -1079,7 +1079,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
idleMs?: number,
idleMessage?: string | (() => string),
): Promise<any> =>
- session.acp.request(method, params, timeoutMs, receive, idleMs, idleMessage);
+ signIn.refused(session.host) ?? session.acp.request(method, params, timeoutMs, receive, idleMs, idleMessage);
const state: AcpTurn["state"] = { settled: false, promptSent: false, text: "", textMessageId: null, producedItem: false, repliedText: false, startupActivity: false, stopped: false, usagePeak: null, usageLast: null, usageCompacted: false, cancelling: false };
let acknowledge = () => {};
@@ -1190,8 +1190,8 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
try {
await session.host.once("authenticate", () => request("authenticate", { methodId }, INIT_TIMEOUT));
session.authenticated = true;
- } catch {
- if (support.authFailure !== "continue") throw new Error(support.loginNote);
+ } catch (error) {
+ if (signIn.asked(error) || support.authFailure !== "continue") throw signIn.asked(error) ?? new Error(support.loginNote);
}
} else if (support.authFailure === "fail") {
throw new Error(support.loginNote);
@@ -1225,7 +1225,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
try {
await request(
support.resumeMethod === "resume" ? "session/resume" : "session/load",
- { sessionId: cursor, cwd, mcpServers: support.mcpServersFromLaunch ? [] : mcpServers, ...selectionParams },
+ { sessionId: cursor, cwd, mcpServers: support.mcpServersFromLaunch ? [] : mcpServers, ...selectionParams, ...support.sessionSetupParams?.(init) },
LOAD_SESSION_TIMEOUT,
(result) => {
if (result) {
@@ -1267,7 +1267,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
promptTurn = { ...turn, text: recovery.text };
rebuiltFromReplay = recovery.replayed;
}
- await request("session/new", { cwd, mcpServers: support.mcpServersFromLaunch ? [] : mcpServers, ...selectionParams }, NEW_SESSION_TIMEOUT, (result) => {
+ await request("session/new", { cwd, mcpServers: support.mcpServersFromLaunch ? [] : mcpServers, ...selectionParams, ...support.sessionSetupParams?.(init) }, NEW_SESSION_TIMEOUT, (result) => {
session.sessionId = typeof result?.sessionId === "string" ? result.sessionId : null;
session.sessionKey = sessionKey;
receiveModelVariants(result, true);
@@ -1463,7 +1463,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
});
settle(threadId, session, false, reason ?? "failed");
}
- } catch (e) {
+ } catch (raw) { const e = signIn.asked(raw) ?? raw;
if (pendingSplitReceipt && state.promptSent && state.usageCompacted) {
deletePromptSplitReceipt(DRIVER_KIND, pendingSplitReceipt.key);
}
@@ -1508,7 +1508,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
...((e as any)?.acpUsageLimit === true || (code === "quota_or_region_restriction" && LIMIT_WORDS.test(message)) ? support.limitFacts?.(message, cliTurn.model) ?? { limit: "engine" as const } : {}), // waited out, or the engine gave up: another AI can carry on
});
// Never replay an accepted prompt (it may have run tools); evict before listeners start the next turn.
- if (!needsAuth && !accountError && ((e as any)?.acpPromptStall === true || (e as any)?.acpUsageLimit === true || (e as any)?.acpSessionFailure === true
+ if (signIn.is(e)) closeSession(threadId, "sign-in-required"); else if (!needsAuth && !accountError && ((e as any)?.acpPromptStall === true || (e as any)?.acpUsageLimit === true || (e as any)?.acpSessionFailure === true
|| code === "upstream_outage") && session.child.exitCode === null && !session.closing) {
closeSession(threadId, (e as any)?.acpPromptStall === true ? "prompt-stall" : "rpc-failure");
} else if (approvalUnconfirmed && session.child.exitCode === null && !session.closing) {
diff --git a/server/drivers/acp/driver-hooks.ts b/server/drivers/acp/driver-hooks.ts
new file mode 100644
index 0000000000..ee2ccec607
--- /dev/null
+++ b/server/drivers/acp/driver-hooks.ts
@@ -0,0 +1,72 @@
+// What a driver may ask of the shared ACP runtime beyond its protocol answers. Only a driver that sets one of these
+// changes behaviour.
+import type { ChildProcess } from "node:child_process";
+
+import type { AcpHost } from "./host.ts";
+
+export interface AcpDriverHooks {
+ /** An agent that asks for a sign-in no turn can give. Its turns fail at once with `loginNote`, its process is closed
+ * and `required` is told, instead of the turn waiting on a sign-in nobody sees. */
+ signInRequest?: {
+ /** Whether a whole stderr line announces the request. */
+ stderrLine(line: string): boolean;
+ /** Whether a request's error means the same. */
+ rpcError(error: unknown): boolean;
+ required(instanceId: string): void;
+ };
+ /** Every agent process the driver starts for turns. */
+ processStarted?(child: ChildProcess, instanceId: string): void;
+ /** Extra session/new, session/load and session/resume parameters, from the agent's initialize answer. */
+ sessionSetupParams?(initializeResult: unknown): Record<string, unknown>;
+}
+
+const MAX_LINE_CHARS = 64 * 1024;
+
+export class SignInRequests {
+ readonly #asked = new WeakSet<AcpHost>();
+ readonly #support: AcpDriverHooks & { loginNote: string };
+ readonly #instanceId: string;
+
+ constructor(support: AcpDriverHooks & { loginNote: string }, instanceId: string) {
+ this.#support = support;
+ this.#instanceId = instanceId;
+ }
+
+ #error(): Error {
+ return Object.assign(new Error(this.#support.loginNote), { acpSignInRequired: true });
+ }
+
+ watch(host: AcpHost): void {
+ this.#support.processStarted?.(host.child, this.#instanceId);
+ const request = this.#support.signInRequest;
+ if (!request) return;
+ let partial = "";
+ host.child.stderr.on("data", (chunk: string | Buffer) => {
+ const lines = (partial + String(chunk)).split("\n");
+ partial = lines.pop() ?? "";
+ if (partial.length > MAX_LINE_CHARS) partial = "";
+ if (this.#asked.has(host) || !lines.some((line) => request.stderrLine(line.replace(/\r$/u, "")))) return;
+ this.#asked.add(host);
+ host.draining = true;
+ request.required(this.#instanceId);
+ for (const link of host.links) link.failAll(this.#error());
+ });
+ }
+
+ /** A rejection for any further request to a process that asked; null for every other process. */
+ refused(host: AcpHost): Promise<never> | null {
+ return this.#asked.has(host) ? Promise.reject(this.#error()) : null;
+ }
+
+ is(error: unknown): boolean {
+ return (error as { acpSignInRequired?: unknown } | null)?.acpSignInRequired === true;
+ }
+
+ /** The sign-in failure `error` stands for, or null when it is some other failure. */
+ asked(error: unknown): Error | null {
+ if (this.is(error)) return error as Error;
+ if (!this.#support.signInRequest?.rpcError(error)) return null;
+ this.#support.signInRequest.required(this.#instanceId);
+ return this.#error();
+ }
+}
diff --git a/server/drivers/antigravity-acp.ts b/server/drivers/antigravity-acp.ts
index b19fb57fb8..acf83e27cf 100644
--- a/server/drivers/antigravity-acp.ts
+++ b/server/drivers/antigravity-acp.ts
@@ -1,13 +1,29 @@
+// Google's Antigravity ACP server as a child process: its isolated profile and launch environment, the sign-in link it
+// announces, the redirect it waits for, and its model catalog.
+//
+// Adapted from pingdotgg/t3code@b9bc03869e, MIT License, Copyright (c) 2026
+// T3 Tools Inc. (full text in third_party/t3-code/LICENSE); modified:
+// - apps/server/src/provider/antigravityAuthSupport.ts:56-84, 196-233,
+// 336-411, 500-531 (the browser helper and its check, the launch
+// environment, the Linux certificate bundle, and the sign-in link's
+// validation);
+// - apps/server/src/provider/antigravityCallback.ts (the redirect's
+// validation and delivery);
+// - apps/server/src/provider/acp/AntigravityAcpSupport.ts:55-79, 108-121
+// (the session setup for releases that write a workflow skill file).
+// The temp folder stays one per instance, the redirect can go through a relay into a boxed runtime, and startup waits
+// while a Windows unpack is still growing.
+import { execFile } from "node:child_process";
import { createHash, randomUUID } from "node:crypto";
+import { existsSync, statSync } from "node:fs";
import { lstat, mkdir, mkdtemp, readFile, rm, stat } from "node:fs/promises";
import { request as httpRequest } from "node:http";
import { tmpdir } from "node:os";
-import { delimiter, join, resolve } from "node:path";
+import { delimiter, isAbsolute, join, resolve } from "node:path";
import { DATA_DIR, stripWorkspaceCredentialEnv } from "../config.ts";
import { writeFileAtomic } from "../atomic.ts";
import { killCliTree, spawnCli } from "../procs.ts";
-import { botBox } from "../bot-box/box.ts";
import type { BoxRelay } from "../bot-box/relay.ts";
import type { ModelCatalog } from "../contracts.ts";
import type { ChildProcess } from "node:child_process";
@@ -24,9 +40,8 @@ import {
// Printed on stderr by Google's server, not stdout.
export const ANTIGRAVITY_AUTH_PREFIX = "Open the following link to authenticate the ACP server: ";
-const AUTH_TIMEOUT_MS = 5 * 60_000;
// Google's packaged server can take tens of seconds to cold-start, especially on Windows.
-const STARTUP_TIMEOUT_MS = 90_000;
+export const STARTUP_TIMEOUT_MS = 90_000;
// The Windows runtime is silent while it unpacks ~1 GB into TEMP, which antivirus scanning can stretch past one window:
// startup gets another window while that folder grows, up to this cap.
const STARTUP_CAP_MS = 5 * 60_000;
@@ -65,6 +80,8 @@ const REMOVED_ENVIRONMENT_KEYS = new Set([
"BROWSER",
"PYTHONUNBUFFERED",
"ELECTRON_RUN_AS_NODE",
+ // An inherited pipe whose owner exited makes Electron-as-Node print Crashpad errors to stderr.
+ "CHROME_CRASHPAD_PIPE_NAME",
]);
const BROWSER_MARKER = "__OPENMAUS_ANTIGRAVITY_AUTH_URL__";
@@ -73,6 +90,54 @@ const browserHelperSource =
`"${BROWSER_MARKER}"+JSON.stringify(process.argv[1])+"\\n",` +
`()=>process.exit(0))`;
+const BROWSER_PREFLIGHT_URL = "https://example.invalid/openmaus-antigravity-browser-preflight";
+const BROWSER_PREFLIGHT_MS = 30_000;
+const verifiedBrowserHelpers = new Set<string>();
+
+/** Bundled Python may look for certificates at paths absent on this distribution. */
+const LINUX_CA_BUNDLES = [
+ "/etc/ssl/certs/ca-bundle.crt",
+ "/etc/ssl/certs/ca-certificates.crt",
+ "/etc/pki/tls/certs/ca-bundle.crt",
+ "/etc/ssl/cert.pem",
+];
+
+/** Absolute, since the runtime resolves a relative path against the bot's folder. */
+export function linuxCaBundle(env: NodeJS.ProcessEnv, exists: (path: string) => boolean = existsSync): string | undefined {
+ if (env.SSL_CERT_FILE !== undefined || env.SSL_CERT_DIR !== undefined) return undefined;
+ return [env.NIX_SSL_CERT_FILE, ...LINUX_CA_BUNDLES].find((candidate) => candidate && isAbsolute(candidate) && exists(candidate));
+}
+
+/** A sign-in must hand its link to the app and never open a browser on the server: run the helper once the way the
+ * runtime will, and refuse the sign-in unless it prints the marked link. Other stderr lines (a runtime warning) pass. */
+/** Why the helper fails the check, or null when it passes. The helper is a program started without a shell; one that
+ * cannot be started that way (Windows refuses a script with EINVAL) is a reason like any other. */
+export function antigravityBrowserHelperProblem(environment: NodeJS.ProcessEnv, helper: string): Promise<string | null> {
+ return new Promise((resolveRun) => {
+ try {
+ execFile(helper, ["-e", browserHelperSource, "--", BROWSER_PREFLIGHT_URL],
+ { env: environment, timeout: BROWSER_PREFLIGHT_MS, maxBuffer: 64 * 1024, windowsHide: true },
+ (error, _stdout, stderr) => {
+ if (error) return resolveRun(error.killed ? "it did not answer in 30 seconds" : typeof error.code === "string" ? "it could not be started" : "it stopped with an error");
+ const marked = String(stderr).split(/\r?\n/u).includes(`${BROWSER_MARKER}"${BROWSER_PREFLIGHT_URL}"`);
+ resolveRun(marked ? null : "it did not hand the sign-in link to the app");
+ }).once("error", () => resolveRun("it could not be started"));
+ } catch {
+ resolveRun("it could not be started");
+ }
+ });
+}
+
+export async function verifyAntigravityBrowserHelper(profile: AntigravityProfile, executable = process.execPath): Promise<void> {
+ const helper = process.platform === "win32" ? executable.replaceAll("\\", "/") : executable;
+ if (verifiedBrowserHelpers.has(helper)) return;
+ const reason = await antigravityBrowserHelperProblem(profile.environment, helper);
+ if (reason) {
+ throw new Error(`Google sign-in cannot start: the helper that passes the sign-in link to OpenMausBot failed a check (${reason}). Restart OpenMausBot and try again. If it keeps failing, share this message.`);
+ }
+ verifiedBrowserHelpers.add(helper);
+}
+
function quoteBrowserArgument(value: string): string {
return `'${value.replaceAll("'", `'"'"'`)}'`;
}
@@ -126,9 +191,35 @@ export async function removeAntigravityProfile(instanceId: string, baseDir = DAT
});
}
+export function antigravityTokenPath(instanceId: string, baseDir = DATA_DIR): string {
+ return join(antigravityProfileDirectory(instanceId, baseDir), "antigravity-acp", "acp_token.json");
+}
+
/** Signing out forgets only this account's stored Google sign-in; its profile stays for the next sign-in. */
export async function removeAntigravitySignIn(instanceId: string, baseDir = DATA_DIR): Promise<void> {
- await rm(join(antigravityProfileDirectory(instanceId, baseDir), "antigravity-acp", "acp_token.json"), { force: true, maxRetries: 4, retryDelay: 250 });
+ await rm(antigravityTokenPath(instanceId, baseDir), { force: true, maxRetries: 4, retryDelay: 250 });
+}
+
+/** The runtime asked for a Google sign-in although a token file is stored (a revoked or ineligible account). */
+export class AntigravitySignInRequired extends Error {
+ constructor() {
+ super("Antigravity asked for a new Google sign-in.");
+ }
+}
+
+const refusedTokens = new Map<string, string>();
+const tokenStamp = (info: { mtimeMs: number; size: number; ino: number | bigint }) => `${info.mtimeMs}:${info.size}:${info.ino}`;
+
+/** The stored token no longer signs this account in. It counts as signed out until a sign-in succeeds or writes the
+ * file again. */
+export function noteAntigravitySignInRequired(tokenPath: string): void {
+ try {
+ refusedTokens.set(tokenPath, tokenStamp(statSync(tokenPath)));
+ } catch {}
+}
+
+export function noteAntigravitySignedIn(tokenPath: string): void {
+ refusedTokens.delete(tokenPath);
}
/** An isolated Google profile per instance; foreign Google credentials are stripped so the account
@@ -171,7 +262,9 @@ export async function prepareAntigravityProfile(input: {
if (!REMOVED_ENVIRONMENT_KEYS.has(key.toUpperCase())) environment[key] = value;
}
stripWorkspaceCredentialEnv(environment);
+ const caBundle = (input.platform ?? process.platform) === "linux" ? linuxCaBundle(input.baseEnv ?? process.env) : undefined;
Object.assign(environment, {
+ ...(caBundle ? { SSL_CERT_FILE: caBundle } : {}),
GEMINI_HOME: directory,
AGY_ACP_FORCE_FILE_STORAGE: "1",
ANTIGRAVITY_HARNESS_PATH: input.runtime.harnessPath,
@@ -200,6 +293,9 @@ export async function antigravityProfileAuthenticated(profile: AntigravityProfil
const info = await stat(profile.tokenPath);
if (!info.isFile() || info.size <= 0 || info.size > 1024 * 1024) return false;
await readFile(profile.tokenPath, { encoding: "utf8" });
+ const refused = refusedTokens.get(profile.tokenPath);
+ if (refused === tokenStamp(info)) return false;
+ if (refused !== undefined) refusedTokens.delete(profile.tokenPath);
return true;
} catch {
return false;
@@ -301,7 +397,9 @@ export class AntigravityAcpClient {
const raw = authorizationUrlFromLine(line);
if (raw === null) return false;
try {
- this.onAuthorizationUrl?.(parseAntigravityAuthorizationUrl(raw).authorizationUrl);
+ const { authorizationUrl } = parseAntigravityAuthorizationUrl(raw);
+ if (!this.onAuthorizationUrl) throw new AntigravitySignInRequired();
+ this.onAuthorizationUrl(authorizationUrl);
} catch (error) {
this.failAll(error instanceof Error ? error : new Error(String(error)));
}
@@ -575,11 +673,11 @@ export async function probeAntigravityModels(input: {
};
const client = new AntigravityAcpClient(input.runtime, input.profile, input.cwd ?? input.profile.directory);
try {
- await client.initialize(remaining(), deadline);
+ const initialized = await client.initialize(remaining(), deadline);
await client.request("authenticate", { methodId: "oauth-personal" }, remaining());
const session = await client.request(
"session/new",
- { cwd: input.cwd ?? input.profile.directory, mcpServers: [] },
+ { cwd: input.cwd ?? input.profile.directory, mcpServers: [], ...antigravitySessionSetup(initialized) },
remaining(),
);
const catalog = catalogFromAntigravityConfigOptions(session?.configOptions, input.fallbackDefault);
@@ -594,11 +692,24 @@ export async function probeAntigravityModels(input: {
return !option.variants?.length && variants?.length ? { ...option, variants } : option;
}),
};
+ } catch (error) {
+ if (error instanceof AntigravitySignInRequired) noteAntigravitySignInRequired(input.profile.tokenPath);
+ throw error;
} finally {
client.close();
}
}
+const runtimeVersion = (value: unknown) => typeof value === "string" ? value.replace(/^agy_acp_server_/u, "").trim() : "";
+
+/** agy_acp_server 1.4.2 to 1.4.5 create or overwrite skills/system/run-workflow/SKILL.md in the session's folder unless
+ * the session turns its `run_workflow` tool off. Sent with session/new, session/load and session/resume. */
+export function antigravitySessionSetup(initialized: any): { _meta?: { antigravity: { disabledTools: string[] } } } {
+ const match = /^1\.4\.(\d+)(?!\d)/u.exec(runtimeVersion(initialized?.agentInfo?.version));
+ const patch = match ? Number(match[1]) : -1;
+ return patch >= 2 && patch <= 5 ? { _meta: { antigravity: { disabledTools: ["run_workflow"] } } } : {};
+}
+
export function isValidAntigravityInitializeResult(
initialized: any,
expectedVersion: string,
@@ -608,8 +719,8 @@ export function isValidAntigravityInitializeResult(
if (name !== "antigravity-acp" && name !== "Google Antigravity") return false;
const actualVersion = initialized.agentInfo?.version;
if (typeof actualVersion !== "string") return false;
- const normalizedActual = actualVersion.replace(/^agy_acp_server_/u, "").trim();
- const normalizedExpected = expectedVersion.replace(/^agy_acp_server_/u, "").trim();
+ const normalizedActual = runtimeVersion(actualVersion);
+ const normalizedExpected = runtimeVersion(expectedVersion);
if (actualVersion !== expectedVersion && normalizedActual !== normalizedExpected) return false;
// ACP advertises optional operations as capability objects (even empty); older runtimes send booleans.
const advertised = (value: unknown) => value === true
@@ -676,111 +787,3 @@ export async function validateAntigravityRuntime(runtime: AntigravityRuntime, ex
}
if (failed) throw failure;
}
-
-export interface AntigravityAuthStart {
- phase: "waiting" | "succeeded";
- flowId: string | null;
- authorizationUrl: string | null;
- expiresAt: string | null;
-}
-
-interface AuthFlow {
- id: string;
- client: AntigravityAcpClient;
- relay: BoxRelay | null;
- completed: Promise<void>;
- pending: { redirectUri: string; state: string };
- expiresAt: number;
-}
-
-export class AntigravityAuthController {
- private flow: AuthFlow | null = null;
- private readonly onSignedIn: () => void;
-
- constructor(onSignedIn: () => void = () => {}) {
- this.onSignedIn = onSignedIn;
- }
-
- async start(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<AntigravityAuthStart> {
- this.cancel();
- let foundUrl!: (value: ReturnType<typeof parseAntigravityAuthorizationUrl>) => void;
- let failUrl!: (error: Error) => void;
- const urlPromise = new Promise<ReturnType<typeof parseAntigravityAuthorizationUrl>>((resolveUrl, reject) => {
- foundUrl = resolveUrl;
- failUrl = reject;
- });
- const relay = await botBox.openRelay();
- let client: AntigravityAcpClient;
- try {
- client = new AntigravityAcpClient(runtime, profile, profile.directory, (url) => {
- try { foundUrl(parseAntigravityAuthorizationUrl(url)); }
- catch (error) { failUrl(error instanceof Error ? error : new Error(String(error))); }
- }, relay ?? undefined);
- } catch (error) {
- relay?.close();
- throw error;
- }
- const closeAll = () => {
- client.close();
- relay?.close();
- };
- try {
- await client.initialize();
- const authenticated = client.request("authenticate", { methodId: "oauth-personal" }, AUTH_TIMEOUT_MS);
- let startupTimer: ReturnType<typeof setTimeout> | undefined;
- const startupTimeout = new Promise<never>((_resolve, reject) => {
- startupTimer = setTimeout(() => reject(new Error("Google sign-in did not start in time.")), STARTUP_TIMEOUT_MS);
- startupTimer.unref?.();
- });
- const outcome = await Promise.race([
- urlPromise.then((request) => ({ kind: "url" as const, request })),
- authenticated.then(() => ({ kind: "done" as const })),
- startupTimeout,
- ]).finally(() => {
- if (startupTimer) clearTimeout(startupTimer);
- });
- if (outcome.kind === "done") {
- closeAll();
- this.onSignedIn();
- return { phase: "succeeded", flowId: null, authorizationUrl: null, expiresAt: null };
- }
- const flow: AuthFlow = {
- id: randomUUID(),
- client,
- relay,
- completed: authenticated,
- pending: { redirectUri: outcome.request.redirectUri, state: outcome.request.state },
- expiresAt: Date.now() + AUTH_TIMEOUT_MS,
- };
- this.flow = flow;
- void authenticated.then(() => this.onSignedIn(), () => {}).finally(() => {
- if (this.flow === flow) this.flow = null;
- closeAll();
- });
- return {
- phase: "waiting",
- flowId: flow.id,
- authorizationUrl: outcome.request.authorizationUrl,
- expiresAt: new Date(flow.expiresAt).toISOString(),
- };
- } catch (error) {
- closeAll();
- throw error;
- }
- }
-
- async complete(flowId: string, callbackUrl: string): Promise<void> {
- const flow = this.flow;
- if (!flow || flow.id !== flowId || Date.now() >= flow.expiresAt) {
- throw new Error("This Google sign-in is no longer active. Start again.");
- }
- await forwardAntigravityCallback(validateAntigravityCallbackUrl(flow.pending, callbackUrl), flow.relay ?? undefined);
- await flow.completed;
- }
-
- cancel(): void {
- this.flow?.client.close();
- this.flow?.relay?.close();
- this.flow = null;
- }
-}
diff --git a/server/drivers/antigravity-auth.ts b/server/drivers/antigravity-auth.ts
new file mode 100644
index 0000000000..fa5f1965a8
--- /dev/null
+++ b/server/drivers/antigravity-auth.ts
@@ -0,0 +1,189 @@
+// One Google sign-in at a time for an Antigravity account, run by the runtime's own `authenticate`.
+//
+// Adapted from pingdotgg/t3code@b9bc03869e, MIT License, Copyright (c) 2026
+// T3 Tools Inc. (full text in third_party/t3-code/LICENSE); modified:
+// - apps/server/src/provider/AntigravityAuth.ts:33-47, 117-141, 231-250,
+// 321-333, 434-480 (the sign-in's phases, its fixed failure lines, expiry,
+// and one accepted redirect per sign-in), on promises instead of fibers;
+// the link is returned by `start` and the redirect can go through a
+// relay into a boxed runtime.
+import { randomUUID } from "node:crypto";
+
+import { botBox } from "../bot-box/box.ts";
+import type { BoxRelay } from "../bot-box/relay.ts";
+import type { ProviderAuthenticationStart, ProviderAuthenticationStatus } from "../contracts.ts";
+import {
+ AntigravityAcpClient,
+ STARTUP_TIMEOUT_MS,
+ forwardAntigravityCallback,
+ parseAntigravityAuthorizationUrl,
+ validateAntigravityCallbackUrl,
+ type AntigravityProfile,
+} from "./antigravity-acp.ts";
+import type { AntigravityRuntime } from "./antigravity-runtime.ts";
+
+const AUTH_TIMEOUT_MS = 5 * 60_000;
+
+const EXPIRED = "Google sign-in expired. Start sign-in again.";
+const CANCELLED = "Google sign-in was cancelled.";
+const FAILED = "Google sign-in failed. Start sign-in again.";
+const NOT_APPROVED = "Google sign-in was not approved. Start sign-in again.";
+const NOT_ELIGIBLE = "Google requires an eligible Antigravity subscription for this account.";
+const NOT_DELIVERED = "Could not deliver the sign-in response. If Google already finished in your browser, wait a moment. Otherwise send it again.";
+const ALREADY_SENT = "The sign-in response was already sent. Wait for Google to finish.";
+
+class SignInExpired extends Error {}
+
+/** Only these fixed lines reach the person: the runtime's own words can carry an authorization code. */
+function failureLine(error: unknown): { phase: "failed" | "expired"; message: string } {
+ if (error instanceof SignInExpired) return { phase: "expired", message: EXPIRED };
+ const words = error instanceof Error ? error.message : "";
+ if (words.includes("SUBSCRIPTION_REQUIRED")) return { phase: "failed", message: NOT_ELIGIBLE };
+ if (/access_denied|denied access|cancelled/iu.test(words)) return { phase: "failed", message: NOT_APPROVED };
+ return { phase: "failed", message: FAILED };
+}
+
+interface AuthFlow {
+ id: string;
+ client: AntigravityAcpClient;
+ relay: BoxRelay | null;
+ /** Rejects with one of the fixed lines. */
+ completed: Promise<void>;
+ pending: { redirectUri: string; state: string };
+ expiresAt: number;
+ /** The runtime's listener takes one response: a second would be read as another sign-in's. Cleared when a
+ * delivery fails, which the listener having closed after the browser's own redirect also looks like. */
+ callbackSent: boolean;
+}
+
+export class AntigravityAuthController {
+ private flow: AuthFlow | null = null;
+ private ended: ProviderAuthenticationStatus | null = null;
+ private readonly onSignedIn: () => void;
+
+ constructor(onSignedIn: () => void = () => {}) {
+ this.onSignedIn = onSignedIn;
+ }
+
+ async start(runtime: AntigravityRuntime, profile: AntigravityProfile): Promise<ProviderAuthenticationStart> {
+ this.cancel();
+ let foundUrl!: (value: ReturnType<typeof parseAntigravityAuthorizationUrl>) => void;
+ let failUrl!: (error: Error) => void;
+ const urlPromise = new Promise<ReturnType<typeof parseAntigravityAuthorizationUrl>>((resolveUrl, reject) => {
+ foundUrl = resolveUrl;
+ failUrl = reject;
+ });
+ const relay = await botBox.openRelay();
+ let client: AntigravityAcpClient;
+ try {
+ client = new AntigravityAcpClient(runtime, profile, profile.directory, (url) => {
+ try { foundUrl(parseAntigravityAuthorizationUrl(url)); }
+ catch (error) { failUrl(error instanceof Error ? error : new Error(String(error))); }
+ }, relay ?? undefined);
+ } catch (error) {
+ relay?.close();
+ throw error;
+ }
+ const closeAll = () => {
+ client.close();
+ relay?.close();
+ };
+ try {
+ await client.initialize();
+ const expiresAt = Date.now() + AUTH_TIMEOUT_MS;
+ const authenticated = client.request("authenticate", { methodId: "oauth-personal" }, AUTH_TIMEOUT_MS, async () => new SignInExpired());
+ let startupTimer: ReturnType<typeof setTimeout> | undefined;
+ const startupTimeout = new Promise<never>((_resolve, reject) => {
+ startupTimer = setTimeout(() => reject(new Error("Google sign-in did not start in time.")), STARTUP_TIMEOUT_MS);
+ startupTimer.unref?.();
+ });
+ const outcome = await Promise.race([
+ urlPromise.then((request) => ({ kind: "url" as const, request })),
+ authenticated.then(() => ({ kind: "done" as const })),
+ startupTimeout,
+ ]).finally(() => {
+ if (startupTimer) clearTimeout(startupTimer);
+ });
+ if (outcome.kind === "done") {
+ closeAll();
+ this.onSignedIn();
+ return { phase: "succeeded", flowId: null, authorizationUrl: null, expiresAt: null };
+ }
+ const flow: AuthFlow = {
+ id: randomUUID(),
+ client,
+ relay,
+ completed: authenticated.then(
+ () => {
+ if (this.end(flow, "succeeded")) this.onSignedIn();
+ },
+ (error) => {
+ const { phase, message } = failureLine(error);
+ this.end(flow, phase, message);
+ throw new Error(message);
+ },
+ ).finally(closeAll),
+ pending: { redirectUri: outcome.request.redirectUri, state: outcome.request.state },
+ expiresAt,
+ callbackSent: false,
+ };
+ flow.completed.catch(() => {});
+ this.flow = flow;
+ return {
+ phase: "waiting",
+ flowId: flow.id,
+ authorizationUrl: outcome.request.authorizationUrl,
+ expiresAt: new Date(flow.expiresAt).toISOString(),
+ };
+ } catch (error) {
+ closeAll();
+ throw error;
+ }
+ }
+
+ /** False when another outcome already ended this sign-in. */
+ private end(flow: AuthFlow, phase: Exclude<ProviderAuthenticationStatus["phase"], "waiting" | "verifying">, message?: string): boolean {
+ if (this.flow !== flow) return false;
+ this.flow = null;
+ this.ended = { phase, flowId: flow.id, authorizationUrl: null, expiresAt: null, ...(message ? { message } : {}) };
+ return true;
+ }
+
+ async get(flowId: string): Promise<ProviderAuthenticationStatus> {
+ const flow = this.flow;
+ if (flow && flow.id === flowId) {
+ return {
+ phase: flow.callbackSent ? "verifying" : "waiting",
+ flowId,
+ authorizationUrl: null,
+ expiresAt: new Date(flow.expiresAt).toISOString(),
+ };
+ }
+ if (this.ended?.flowId === flowId) return { ...this.ended };
+ return { phase: "expired", flowId, authorizationUrl: null, expiresAt: null, message: EXPIRED };
+ }
+
+ async complete(flowId: string, callbackUrl: string): Promise<void> {
+ const flow = this.flow;
+ if (!flow || flow.id !== flowId || Date.now() >= flow.expiresAt) {
+ throw new Error("This Google sign-in is no longer active. Start again.");
+ }
+ if (flow.callbackSent) throw new Error(ALREADY_SENT);
+ const callback = validateAntigravityCallbackUrl(flow.pending, callbackUrl);
+ flow.callbackSent = true;
+ try {
+ await forwardAntigravityCallback(callback, flow.relay ?? undefined);
+ } catch {
+ flow.callbackSent = false;
+ throw new Error(NOT_DELIVERED);
+ }
+ await flow.completed;
+ }
+
+ cancel(): void {
+ const flow = this.flow;
+ if (!flow || !this.end(flow, "cancelled", CANCELLED)) return;
+ flow.client.close();
+ flow.relay?.close();
+ }
+}
diff --git a/server/drivers/antigravity-box.linux.test.ts b/server/drivers/antigravity-box.linux.test.ts
index 540cf43f2e..bb85f5a21e 100644
--- a/server/drivers/antigravity-box.linux.test.ts
+++ b/server/drivers/antigravity-box.linux.test.ts
@@ -9,7 +9,8 @@ import { afterAll, beforeAll, describe, expect, it } from "vitest";
import { botBox } from "../bot-box/box.ts";
import { detectBox } from "../bot-box/detect.ts";
-import { AntigravityAuthController, antigravityProfileAuthenticated, forwardAntigravityCallback, prepareAntigravityProfile } from "./antigravity-acp.ts";
+import { antigravityProfileAuthenticated, forwardAntigravityCallback, prepareAntigravityProfile } from "./antigravity-acp.ts";
+import { AntigravityAuthController } from "./antigravity-auth.ts";
import { resolveAntigravityRuntime } from "./antigravity-runtime.ts";
const detection = detectBox({ env: { ...process.env, OMB_BOT_BOX: "1" } });
diff --git a/server/drivers/antigravity-processes.ts b/server/drivers/antigravity-processes.ts
new file mode 100644
index 0000000000..3b835a0f60
--- /dev/null
+++ b/server/drivers/antigravity-processes.ts
@@ -0,0 +1,37 @@
+// The runtime processes each Antigravity account has running, so a sign-out can wait for them to end.
+import type { ChildProcess } from "node:child_process";
+
+import { killCliTree } from "../procs.ts";
+
+const EXIT_WAIT_MS = 7_000;
+
+export class AntigravityProcesses {
+ readonly #running = new Map<string, Set<ChildProcess>>();
+
+ track(instanceId: string, child: ChildProcess): void {
+ const children = this.#running.get(instanceId) ?? new Set<ChildProcess>();
+ this.#running.set(instanceId, children);
+ children.add(child);
+ const forget = () => {
+ children.delete(child);
+ if (!children.size && this.#running.get(instanceId) === children) this.#running.delete(instanceId);
+ };
+ child.once("close", forget);
+ child.once("error", () => { if (child.pid === undefined) forget(); });
+ }
+
+ count(instanceId: string): number {
+ return this.#running.get(instanceId)?.size ?? 0;
+ }
+
+ /** Resolves once this account's processes are gone: each was asked to exit and gets `waitMs` before it is killed. */
+ async stopped(instanceId: string, waitMs = EXIT_WAIT_MS): Promise<void> {
+ const children = [...this.#running.get(instanceId) ?? []];
+ await Promise.all(children.map((child) => new Promise<void>((resolve) => {
+ if (child.exitCode !== null || child.signalCode !== null) return resolve();
+ const timer = setTimeout(() => void killCliTree(child).catch(() => false).then(() => resolve()), waitMs);
+ timer.unref?.();
+ child.once("close", () => { clearTimeout(timer); resolve(); });
+ })));
+ }
+}
diff --git a/server/drivers/antigravity-sign-in.test.ts b/server/drivers/antigravity-sign-in.test.ts
new file mode 100644
index 0000000000..713ac25e2d
--- /dev/null
+++ b/server/drivers/antigravity-sign-in.test.ts
@@ -0,0 +1,411 @@
+import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, utimesSync, writeFileSync } from "node:fs";
+import type { ChildProcess } from "node:child_process";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath, pathToFileURL } from "node:url";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { ensureDirs } from "../config.ts";
+import type { ProviderInstance } from "../contracts.ts";
+import { ProviderAuthSessions } from "../provider-auth-sessions.ts";
+import { recordEvents } from "../testing/events.ts";
+import { removeTempDir } from "../testing/cleanup.ts";
+import * as procs from "../procs.ts";
+import {
+ ANTIGRAVITY_AUTH_PREFIX,
+ antigravityBrowserHelperProblem,
+ antigravityProfileAuthenticated,
+ antigravitySessionSetup,
+ antigravityTokenPath,
+ linuxCaBundle,
+ prepareAntigravityProfile,
+ probeAntigravityModels,
+ verifyAntigravityBrowserHelper,
+} from "./antigravity-acp.ts";
+import { AntigravityAuthController } from "./antigravity-auth.ts";
+import { resolveAntigravityRuntime } from "./antigravity-runtime.ts";
+import { AntigravityDriver, antigravitySignInError } from "./antigravity.ts";
+
+const TESTING = join(dirname(fileURLToPath(import.meta.url)), "..", "testing");
+const FAKE_ACP = join(TESTING, "fake-acp-cli.ts");
+const FAKE_SIGNIN = join(TESTING, "fake-antigravity-signin.ts");
+const LINK = "https://accounts.google.com/o/oauth2/v2/auth?response_type=code&state=fixture&redirect_uri=http%3A%2F%2F127.0.0.1%3A54321%2F";
+const LOGIN_NOTE = "Antigravity needs a Google account — choose Sign in with Google in engine setup";
+const scratch: string[] = [];
+const instances: ProviderInstance[] = [];
+
+function fakeRuntime(source?: string) {
+ const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-sign-in-"));
+ scratch.push(directory);
+ const executable = join(directory, "fake-antigravity.ts");
+ const harness = join(directory, process.platform === "win32" ? "localharness_external.exe" : "localharness_external");
+ if (source === undefined) copyFileSync(FAKE_ACP, executable);
+ else writeFileSync(executable, source);
+ copyFileSync(FAKE_ACP, harness);
+ if (process.platform !== "win32") {
+ chmodSync(executable, 0o755);
+ chmodSync(harness, 0o755);
+ }
+ return { directory, executable };
+}
+
+/** Answers every request but `authenticate`, where it does `onAuthenticate` (JavaScript with `message` in scope). */
+const runtimeSource = (onAuthenticate: string) => `#!/usr/bin/env node
+import { createInterface } from 'node:readline';
+const reply = (id, body) => console.log(JSON.stringify({ jsonrpc: '2.0', id, ...body }));
+createInterface({ input: process.stdin }).on('line', line => {
+ const message = JSON.parse(line);
+ if (message.method === 'initialize') reply(message.id, { result: { protocolVersion: 1, authMethods: [{ id: 'oauth-personal' }], agentCapabilities: {} } });
+ else if (message.method === 'authenticate') { ${onAuthenticate} }
+ else reply(message.id, { result: {} });
+});
+`;
+const ASKS_FOR_SIGN_IN = `console.error(${JSON.stringify(ANTIGRAVITY_AUTH_PREFIX + LINK)});`;
+
+function storeToken(instanceId: string): string {
+ const token = antigravityTokenPath(instanceId);
+ mkdirSync(dirname(token), { recursive: true });
+ writeFileSync(token, "{}", { mode: 0o600 });
+ return token;
+}
+
+async function create(instanceId: string, executable: string, environment: Record<string, string> = {}) {
+ const instance = await AntigravityDriver.create({
+ instanceId, displayName: "Antigravity", enabled: true,
+ config: { cli: executable, fullAuto: false },
+ environment: { FAKE_ACP_AUTH_METHOD: "oauth-personal", ...environment },
+ });
+ instances.push(instance);
+ return instance;
+}
+
+afterEach(async () => {
+ vi.restoreAllMocks();
+ vi.useRealTimers();
+ for (const instance of instances.splice(0)) await instance.dispose();
+ while (scratch.length) await removeTempDir(scratch.pop()!);
+});
+
+describe("a sign-in the runtime asks for in the middle of a turn", () => {
+ it("fails the turn at once with the sign-in message and reports the account signed out until it signs in again", async () => {
+ ensureDirs();
+ const fake = fakeRuntime();
+ const revoked = join(fake.directory, "revoked");
+ writeFileSync(fake.executable, runtimeSource(`if (existsSync(${JSON.stringify(revoked)})) { ${ASKS_FOR_SIGN_IN} } else reply(message.id, { result: {} });`)
+ .replace("import { createInterface }", "import { existsSync } from 'node:fs';\nimport { createInterface }"));
+ const instanceId = "antigravity-revoked";
+ const token = storeToken(instanceId);
+ const instance = await create(instanceId, fake.executable);
+ await instance.refreshModels?.().catch(() => {});
+ expect((await instance.snapshot()).authenticated).toBe(true);
+ writeFileSync(revoked, "");
+ const recorder = recordEvents(instance.adapter);
+ const started = Date.now();
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "revoked", text: "hello", cwd: fake.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
+ expect(Date.now() - started).toBeLessThan(30_000);
+ const events = recorder.events.filter((event) => event.turnId === turnId);
+ expect(events).toContainEqual(expect.objectContaining({ type: "runtime.error", message: LOGIN_NOTE, setup: true }));
+ expect(events.at(-1)).toMatchObject({ type: "turn.completed", ok: false, stopReason: "auth_required" });
+ expect((await instance.snapshot()).authenticated).toBe(false);
+
+ const next = await instance.adapter.sendTurn({ threadId: "revoked", text: "again", cwd: fake.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === next.turnId);
+ expect(recorder.events.at(-1)).toMatchObject({ type: "turn.completed", ok: false, stopReason: "auth_required" });
+
+ writeFileSync(token, JSON.stringify({ fixture: "a new sign-in" }));
+ utimesSync(token, new Date(), new Date(Date.now() + 5_000));
+ expect((await instance.snapshot()).authenticated).toBe(true);
+ }, 60_000);
+
+ it("treats the protocol's sign-in-required error the same way", async () => {
+ ensureDirs();
+ const fake = fakeRuntime();
+ const instanceId = "antigravity-auth-required";
+ storeToken(instanceId);
+ const instance = await create(instanceId, fake.executable, { FAKE_ACP_MODE: "auth-required" });
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "auth-required", text: "hello", cwd: fake.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
+ const events = recorder.events.filter((event) => event.turnId === turnId);
+ expect(events).toContainEqual(expect.objectContaining({ type: "runtime.error", message: LOGIN_NOTE, setup: true }));
+ expect(events.at(-1)).toMatchObject({ type: "turn.completed", ok: false, stopReason: "auth_required" });
+ expect((await instance.snapshot()).authenticated).toBe(false);
+ }, 60_000);
+
+ it("reads signed in again after a sign-in that succeeds without rewriting the stored token", async () => {
+ ensureDirs();
+ const fake = fakeRuntime();
+ const mode = join(fake.directory, "mode");
+ writeFileSync(mode, "auth-required");
+ writeFileSync(fake.executable, `#!/usr/bin/env node\nimport { readFileSync } from 'node:fs';\nprocess.env.FAKE_ACP_MODE = readFileSync(${JSON.stringify(mode)}, 'utf8');\nawait import(${JSON.stringify(pathToFileURL(FAKE_ACP).href)});\n`);
+ const instanceId = "antigravity-signed-in-again";
+ const token = storeToken(instanceId);
+ const stored = readFileSync(token, "utf8");
+ const instance = await create(instanceId, fake.executable);
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "again", text: "hello", cwd: fake.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
+ expect((await instance.snapshot()).authenticated).toBe(false);
+ writeFileSync(mode, "happy");
+ expect(await instance.startAuthentication!()).toMatchObject({ phase: "succeeded" });
+ expect(readFileSync(token, "utf8")).toBe(stored);
+ expect((await instance.snapshot()).authenticated).toBe(true);
+ }, 60_000);
+
+ it.each([
+ [{ code: -32000, message: "Authentication required" }, true],
+ [{ code: -32000, message: "Internal", data: { reason: "UNAUTHENTICATED" } }, true],
+ [{ code: -32000, message: "Request failed", data: "Please sign in again" }, true],
+ [{ code: -32000, message: "Server overloaded" }, false],
+ [{ code: -32000 }, false],
+ [{ code: -32603, message: "Authentication required" }, false],
+ [null, false],
+ ])("reads a sign-in request only where the error's code and words agree (%j)", (error, expected) => {
+ expect(antigravitySignInError(error)).toBe(expected);
+ });
+
+ it("stops a model lookup the same way instead of waiting on a link nobody sees", async () => {
+ const fake = fakeRuntime(runtimeSource(ASKS_FOR_SIGN_IN));
+ const runtime = await resolveAntigravityRuntime(fake.executable);
+ const profile = await prepareAntigravityProfile({ instanceId: "lookup", runtime, baseDir: fake.directory });
+ writeFileSync(profile.tokenPath, "{}");
+ await expect(probeAntigravityModels({ runtime, profile, fallbackDefault: "gemini" })).rejects.toThrow("asked for a new Google sign-in");
+ expect(await antigravityProfileAuthenticated(profile)).toBe(false);
+ }, 60_000);
+});
+
+describe("signing out of Antigravity", () => {
+ it("forgets the sign-in at once and stops the account's running runtime", async () => {
+ ensureDirs();
+ const fake = fakeRuntime();
+ const instanceId = "antigravity-pooled";
+ const token = storeToken(instanceId);
+ const children: ChildProcess[] = [];
+ const spawn = procs.spawnCli;
+ vi.spyOn(procs, "spawnCli").mockImplementation((...args) => {
+ const child = spawn(...args);
+ if (args[2]?.cwd === fake.directory) children.push(child);
+ return child;
+ });
+ const instance = await create(instanceId, fake.executable, { FAKE_ACP_MODELS: "gemini-3.8-flash" });
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "pooled", text: "hello", approvalMode: "full", cwd: fake.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
+ expect(recorder.events.at(-1)).toMatchObject({ type: "turn.completed", ok: true });
+ expect(children).toHaveLength(1);
+ expect(children[0]!.exitCode).toBeNull();
+
+ const started = Date.now();
+ await instance.signOut!();
+ expect(Date.now() - started).toBeLessThan(3_000);
+ expect(existsSync(token)).toBe(false);
+ expect((await instance.snapshot()).authenticated).toBe(false);
+ await vi.waitFor(() => expect(children[0]!.exitCode !== null || children[0]!.signalCode !== null).toBe(true), { timeout: 15_000 });
+ expect(existsSync(token)).toBe(false);
+ }, 90_000);
+});
+
+describe("the session setup for releases that write a workflow skill file", () => {
+ it.each(["1.4.2", "1.4.3", "1.4.5", "agy_acp_server_1.4.3"])("turns run_workflow off on %s", (version) => {
+ expect(antigravitySessionSetup({ agentInfo: { version } })).toEqual({ _meta: { antigravity: { disabledTools: ["run_workflow"] } } });
+ });
+
+ it.each(["1.4.1", "1.4.6", "1.4.20", "1.5.1", "1.1.1", "2.4.3", "", undefined, 143])("sends nothing on %s", (version) => {
+ expect(antigravitySessionSetup({ agentInfo: { version } })).toEqual({});
+ });
+
+ it("rides the turn's session/new on the pinned release and not on another", async () => {
+ ensureDirs();
+ for (const [version, meta] of [["1.4.3", { antigravity: { disabledTools: ["run_workflow"] } }], ["1.1.1", undefined]] as const) {
+ const fake = fakeRuntime();
+ const dump = join(fake.directory, "dump.json");
+ const instanceId = `antigravity-meta-${version}`;
+ storeToken(instanceId);
+ const instance = await create(instanceId, fake.executable, {
+ FAKE_ACP_MODELS: "gemini-3.8-flash", FAKE_ACP_DUMP: dump, FAKE_ACP_AGENT_NAME: "Google Antigravity", FAKE_ACP_AGENT_VERSION: version,
+ });
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: `meta-${version}`, text: "hello", approvalMode: "full", cwd: fake.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
+ expect(JSON.parse(readFileSync(`${dump}.session.json`, "utf8"))._meta).toEqual(meta);
+ }
+ }, 90_000);
+});
+
+describe("the Google sign-in's state", () => {
+ async function signIn(instanceId: string, source: string | Buffer) {
+ const fake = fakeRuntime(String(source));
+ const runtime = await resolveAntigravityRuntime(fake.executable);
+ const profile = await prepareAntigravityProfile({ instanceId, runtime, baseDir: fake.directory });
+ const signedIn = vi.fn();
+ const controller = new AntigravityAuthController(signedIn);
+ return { controller, signedIn, profile, flow: await controller.start(runtime, profile) };
+ }
+
+ it("is waiting until the redirect is accepted, verifying after, and succeeded once Google finishes", async () => {
+ const hold = runtimeSource(`${ASKS_FOR_SIGN_IN} process.stdin.on('data', () => {});`);
+ const { controller, flow } = await signIn("state-waiting", hold);
+ try {
+ expect(await controller.get(flow.flowId!)).toMatchObject({ phase: "waiting", flowId: flow.flowId, authorizationUrl: null });
+ expect(await controller.get("another-flow")).toMatchObject({ phase: "expired", message: "Google sign-in expired. Start sign-in again." });
+ } finally {
+ controller.cancel();
+ }
+ expect(await controller.get(flow.flowId!)).toMatchObject({ phase: "cancelled", message: "Google sign-in was cancelled." });
+
+ const done = await signIn("state-done", readFileSync(FAKE_SIGNIN));
+ const redirect = new URL(done.flow.authorizationUrl!).searchParams.get("redirect_uri")!;
+ await done.controller.complete(done.flow.flowId!, `${redirect}?state=fixture&code=pasted`);
+ expect(await done.controller.get(done.flow.flowId!)).toMatchObject({ phase: "succeeded" });
+ expect(done.signedIn).toHaveBeenCalledOnce();
+ }, 60_000);
+
+ it("refuses a second redirect once one was accepted", async () => {
+ const slow = String(readFileSync(FAKE_SIGNIN)).replace("if (pending !== null) reply(pending, {});", "setTimeout(() => reply(pending, {}), 1_500);");
+ const { controller, flow, signedIn } = await signIn("state-twice", slow);
+ try {
+ const redirect = new URL(flow.authorizationUrl!).searchParams.get("redirect_uri")!;
+ const first = controller.complete(flow.flowId!, `${redirect}?state=fixture&code=first`);
+ await vi.waitFor(async () => expect((await controller.get(flow.flowId!)).phase).toBe("verifying"));
+ await expect(controller.complete(flow.flowId!, `${redirect}?state=fixture&code=second`))
+ .rejects.toThrow("The sign-in response was already sent. Wait for Google to finish.");
+ await first;
+ expect(signedIn).toHaveBeenCalledOnce();
+ } finally {
+ controller.cancel();
+ }
+ }, 60_000);
+
+ it("lets a redirect that fails validation or delivery be sent again", async () => {
+ const { controller, flow } = await signIn("state-undelivered", runtimeSource(ASKS_FOR_SIGN_IN));
+ try {
+ await expect(controller.complete(flow.flowId!, "http://127.0.0.1:54321/?state=wrong&code=x")).rejects.toThrow("does not belong");
+ expect((await controller.get(flow.flowId!)).phase).toBe("waiting");
+ for (const attempt of [1, 2]) {
+ await expect(controller.complete(flow.flowId!, `http://127.0.0.1:54321/?state=fixture&code=${attempt}`))
+ .rejects.toThrow("Could not deliver the sign-in response.");
+ expect((await controller.get(flow.flowId!)).phase).toBe("waiting");
+ }
+ } finally {
+ controller.cancel();
+ }
+ }, 60_000);
+
+ it("still succeeds when the redirect is pasted after the browser already delivered it", async () => {
+ const closes = String(readFileSync(FAKE_SIGNIN)).replace("if (pending !== null) reply(pending, {});", "callback.close(); setTimeout(() => reply(pending, {}), 1_500);");
+ const { controller, flow, signedIn, profile } = await signIn("state-browser-first", closes);
+ try {
+ const redirect = `${new URL(flow.authorizationUrl!).searchParams.get("redirect_uri")!}?state=fixture&code=browser`;
+ expect((await fetch(redirect, { headers: { connection: "close" } })).status).toBe(200);
+ await expect(controller.complete(flow.flowId!, redirect)).rejects.toThrow("Could not deliver the sign-in response.");
+ await vi.waitFor(async () => expect((await controller.get(flow.flowId!)).phase).toBe("succeeded"), { timeout: 10_000 });
+ expect(signedIn).toHaveBeenCalledOnce();
+ expect(await antigravityProfileAuthenticated(profile)).toBe(true);
+ } finally {
+ controller.cancel();
+ }
+ }, 60_000);
+
+ it.each([
+ ["SUBSCRIPTION_REQUIRED: code 4/0Aprivate", "Google requires an eligible Antigravity subscription for this account."],
+ ["access_denied", "Google sign-in was not approved. Start sign-in again."],
+ ["boom code=4/0Aprivate", "Google sign-in failed. Start sign-in again."],
+ ])("reports a failure as a fixed line, never the runtime's words (%s)", async (words, line) => {
+ const fails = runtimeSource(`${ASKS_FOR_SIGN_IN} setTimeout(() => reply(message.id, { error: { code: -1, message: ${JSON.stringify(words)} } }), 200);`);
+ const { controller, flow, signedIn } = await signIn("state-failed", fails);
+ await vi.waitFor(async () => expect(await controller.get(flow.flowId!)).toMatchObject({ phase: "failed", message: line }));
+ expect(signedIn).not.toHaveBeenCalled();
+ }, 60_000);
+
+ it("expires after five minutes and says so", async () => {
+ vi.useFakeTimers({ now: Date.now(), toFake: ["setTimeout", "clearTimeout", "Date"] });
+ const { controller, flow } = await signIn("state-expired", runtimeSource(ASKS_FOR_SIGN_IN));
+ try {
+ expect(Date.parse(flow.expiresAt!) - Date.now()).toBeLessThanOrEqual(5 * 60_000);
+ await vi.advanceTimersByTimeAsync(5 * 60_000 + 1_000);
+ vi.useRealTimers();
+ await vi.waitFor(async () => expect(await controller.get(flow.flowId!))
+ .toMatchObject({ phase: "expired", message: "Google sign-in expired. Start sign-in again." }));
+ await expect(controller.complete(flow.flowId!, "http://127.0.0.1:54321/?state=fixture&code=x")).rejects.toThrow("no longer active");
+ } finally {
+ vi.useRealTimers();
+ controller.cancel();
+ }
+ }, 60_000);
+
+ it("is readable through the status call by the browser that started it, as a callback-url sign-in", async () => {
+ ensureDirs();
+ const fake = fakeRuntime(runtimeSource(ASKS_FOR_SIGN_IN));
+ const instance = await create("antigravity-status", fake.executable);
+ expect(instance.authenticationMethod).toBe("callback-url");
+ const sessions = new ProviderAuthSessions();
+ const started = await sessions.start(instance, "browser-1");
+ expect(await sessions.status(instance.instanceId, "browser-1", started.flowId!)).toMatchObject({ phase: "waiting" });
+ await expect(sessions.status(instance.instanceId, "browser-2", started.flowId!)).rejects.toMatchObject({ status: 404 });
+ await sessions.cancel(instance.instanceId, "browser-1", started.flowId!);
+ expect(await sessions.status(instance.instanceId, "browser-1", started.flowId!)).toMatchObject({ phase: "cancelled" });
+ }, 60_000);
+});
+
+describe("the runtime's launch environment", () => {
+ it("drops an inherited crash-reporter pipe and, on Linux, names a certificate bundle that exists", async () => {
+ const fake = fakeRuntime();
+ const runtime = await resolveAntigravityRuntime(fake.executable);
+ const profile = await prepareAntigravityProfile({
+ instanceId: "environment", runtime, baseDir: fake.directory, baseEnv: { PATH: process.env.PATH, CHROME_CRASHPAD_PIPE_NAME: "gone" },
+ });
+ expect(profile.environment.CHROME_CRASHPAD_PIPE_NAME).toBeUndefined();
+ const present = (path: string) => path === "/etc/ssl/certs/ca-certificates.crt" || path === "/nix/store/certs.crt";
+ expect(linuxCaBundle({}, present)).toBe("/etc/ssl/certs/ca-certificates.crt");
+ expect(linuxCaBundle({ NIX_SSL_CERT_FILE: "/nix/store/certs.crt" }, present)).toBe("/nix/store/certs.crt");
+ expect(linuxCaBundle({ NIX_SSL_CERT_FILE: "relative/certs.crt" }, () => true)).toBe("/etc/ssl/certs/ca-bundle.crt");
+ expect(linuxCaBundle({ SSL_CERT_FILE: "/own.crt" }, present)).toBeUndefined();
+ expect(linuxCaBundle({ SSL_CERT_DIR: "/own" }, present)).toBeUndefined();
+ expect(linuxCaBundle({}, () => false)).toBeUndefined();
+ });
+
+ describe("the browser helper check before a sign-in may start", () => {
+ async function helperProfile() {
+ const fake = fakeRuntime();
+ const runtime = await resolveAntigravityRuntime(fake.executable);
+ return { fake, profile: await prepareAntigravityProfile({ instanceId: "helper", runtime, baseDir: fake.directory }) };
+ }
+ /** The app's own program as the helper, with a script loaded before the helper's. */
+ function preloading(fake: { directory: string }, profile: { environment: NodeJS.ProcessEnv }, script: string) {
+ const preload = join(fake.directory, "preload.cjs");
+ writeFileSync(preload, script);
+ return { ...profile.environment, NODE_OPTIONS: `--require "${preload.replaceAll("\\", "/")}"` };
+ }
+
+ it("passes the program the app runs on, started as the runtime starts it", async () => {
+ const { profile } = await helperProfile();
+ expect(await antigravityBrowserHelperProblem(profile.environment, process.execPath)).toBeNull();
+ await expect(verifyAntigravityBrowserHelper(profile)).resolves.toBeUndefined();
+ }, 60_000);
+
+ it("passes when the link is one stderr line among others", async () => {
+ const { fake, profile } = await helperProfile();
+ const environment = preloading(fake, profile, "process.stderr.write('(node) a warning the runtime also prints\\n');");
+ expect(await antigravityBrowserHelperProblem(environment, process.execPath)).toBeNull();
+ }, 60_000);
+
+ it("names the reason when the helper keeps the link or stops with an error", async () => {
+ const { fake, profile } = await helperProfile();
+ expect(await antigravityBrowserHelperProblem(preloading(fake, profile, "console.log('opened a browser'); process.exit(0);"), process.execPath))
+ .toBe("it did not hand the sign-in link to the app");
+ expect(await antigravityBrowserHelperProblem(preloading(fake, profile, "process.exit(3);"), process.execPath)).toBe("it stopped with an error");
+ }, 60_000);
+
+ it("turns a helper that cannot be started into the same message, never a raw spawn error", async () => {
+ const { fake, profile } = await helperProfile();
+ const absent = join(fake.directory, "absent");
+ expect(await antigravityBrowserHelperProblem(profile.environment, absent)).toBe("it could not be started");
+ await expect(verifyAntigravityBrowserHelper(profile, absent)).rejects.toThrow(
+ "Google sign-in cannot start: the helper that passes the sign-in link to OpenMausBot failed a check (it could not be started).");
+ const script = join(fake.directory, process.platform === "win32" ? "helper.cmd" : "helper.txt");
+ writeFileSync(script, "not a program\n");
+ expect(await antigravityBrowserHelperProblem(profile.environment, script)).toBe("it could not be started");
+ }, 60_000);
+ });
+});
diff --git a/server/drivers/antigravity.test.ts b/server/drivers/antigravity.test.ts
index 4b0112e84f..0f045c5718 100644
--- a/server/drivers/antigravity.test.ts
+++ b/server/drivers/antigravity.test.ts
@@ -16,7 +16,6 @@ import * as managedRuntime from "./antigravity-runtime.ts";
import {
ANTIGRAVITY_AUTH_PREFIX,
AntigravityAcpClient,
- AntigravityAuthController,
antigravityProfileAuthenticated,
antigravityProfileDirectory,
authorizationUrlFromLine,
@@ -28,6 +27,7 @@ import {
validateAntigravityCallbackUrl,
validateAntigravityRuntime,
} from "./antigravity-acp.ts";
+import { AntigravityAuthController } from "./antigravity-auth.ts";
import {
ANTIGRAVITY_RELEASE_VERSION,
resolveAntigravityReleaseAsset,
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index a699f69d0f..1cf2fb62d3 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -14,20 +14,27 @@ import type {
} from "../contracts.ts";
import { createAcpDriver, type AcpConfig, type AcpSupport } from "./acp/core.ts";
import {
- AntigravityAuthController,
antigravityProfileAuthenticated,
antigravityProfileDirectory,
+ antigravitySessionSetup,
+ antigravityTokenPath,
+ authorizationUrlFromLine,
+ noteAntigravitySignedIn,
+ noteAntigravitySignInRequired,
prepareAntigravityProfile,
probeAntigravityModels,
removeAntigravitySignIn,
validateAntigravityRuntime,
+ verifyAntigravityBrowserHelper,
} from "./antigravity-acp.ts";
+import { AntigravityAuthController } from "./antigravity-auth.ts";
import {
antigravityManagedInstallAvailable,
installAntigravityRuntime,
resolveAntigravityRuntime,
} from "./antigravity-runtime.ts";
import { resolveAntigravityReleaseAsset } from "./antigravity-release.ts";
+import { AntigravityProcesses } from "./antigravity-processes.ts";
import { VERIFICATION_TEMP_KEY, scheduleAntigravityTempSweep } from "./antigravity-temp.ts";
import { augmentedPath } from "../env-path.ts";
import { bundledEngineCatalog } from "../model-manifest/bundled.ts";
@@ -52,7 +59,18 @@ export function antigravityPermissionMode(fullAuto: boolean, approvalMode?: Appr
return approvalMode === "edits" ? "auto_edit" : "default";
}
+const SIGN_IN_WORDS = /\bauthenticat|\bunauthenticated\b|\bsign(?:ed)?[ -]?in\b|\blog(?:ged)?[ -]?in\b|\bcredentials?\b/iu;
+
+/** -32000 is ACP's `auth_required`, but an agent may reuse it for other failures; the text must agree. */
+export function antigravitySignInError(error: unknown): boolean {
+ const value = error as { code?: unknown; message?: unknown; data?: unknown } | null;
+ if (value?.code !== -32000) return false;
+ const data = typeof value.data === "string" ? value.data : value.data && typeof value.data === "object" ? JSON.stringify(value.data) : "";
+ return SIGN_IN_WORDS.test(`${typeof value.message === "string" ? value.message : ""} ${data.slice(0, 2_000)}`);
+}
+
const managedAsset = resolveAntigravityReleaseAsset();
+const runtimeProcesses = new AntigravityProcesses();
const support: AcpSupport = {
driverKind: "antigravityAgent",
@@ -109,6 +127,15 @@ const support: AcpSupport = {
? "oauth-personal"
: null,
authFailure: "fail",
+ // With a stored token Google no longer honours, agy_acp_server 1.4.3 prints its sign-in link and waits on
+ // `authenticate`.
+ signInRequest: {
+ stderrLine: (line) => authorizationUrlFromLine(line) !== null,
+ rpcError: antigravitySignInError,
+ required: (instanceId) => noteAntigravitySignInRequired(antigravityTokenPath(instanceId)),
+ },
+ processStarted: (child, instanceId) => runtimeProcesses.track(instanceId, child),
+ sessionSetupParams: antigravitySessionSetup,
requireAuthenticationBeforeSpawn: true,
isAuthenticated: async (env, config, instanceId) => {
try {
@@ -159,7 +186,11 @@ export const AntigravityDriver: ProviderDriver<AcpConfig> = {
const base = await AcpAntigravityDriver.create(input);
scheduleAntigravityTempSweep(input.instanceId);
scheduleAntigravityTempSweep(VERIFICATION_TEMP_KEY);
- const auth = new AntigravityAuthController(() => void base.refreshModels?.());
+ const auth = new AntigravityAuthController(() => {
+ noteAntigravitySignedIn(antigravityTokenPath(input.instanceId));
+ void base.refreshModels?.();
+ });
+ let signingOut: Promise<void> = Promise.resolve();
let installFailure: string | undefined;
const runtimeAndProfile = async () => {
// A GUI launch's raw PATH may omit the official runtime the model picker found.
@@ -204,15 +235,26 @@ export const AntigravityDriver: ProviderDriver<AcpConfig> = {
},
}
: {}),
+ authenticationMethod: "callback-url",
startAuthentication: async () => {
+ await signingOut;
const { runtime, profile } = await runtimeAndProfile();
+ await verifyAntigravityBrowserHelper(profile);
return auth.start(runtime, profile);
},
+ getAuthentication: async (flowId) => auth.get(flowId),
completeAuthentication: async (flowId, callbackUrl) => auth.complete(flowId, callbackUrl),
cancelAuthentication: async () => auth.cancel(),
+ // A runtime process keeps the account it started with, and can write the token file again as it exits: the
+ // sign-in is removed at once, and once more when those processes are gone. A new sign-in waits for that.
signOut: async () => {
auth.cancel();
+ await base.adapter.stopAll();
await removeAntigravitySignIn(input.instanceId);
+ if (!runtimeProcesses.count(input.instanceId)) return;
+ signingOut = runtimeProcesses.stopped(input.instanceId)
+ .then(() => removeAntigravitySignIn(input.instanceId))
+ .catch((error) => console.warn(`antigravity: could not finish the sign-out: ${error instanceof Error ? error.message : String(error)}`));
},
dispose: async () => {
auth.cancel();
diff --git a/server/provider-auth-sessions.ts b/server/provider-auth-sessions.ts
index b13b1543d0..56e15b0077 100644
--- a/server/provider-auth-sessions.ts
+++ b/server/provider-auth-sessions.ts
@@ -78,7 +78,7 @@ export class ProviderAuthSessions {
const revision = flow.revision;
const status = await flow.instance.getAuthentication(flowId);
if (flow.revoked || this.flows.get(instanceId) !== flow || flow.flowId !== flowId || flow.revision !== revision) throw failure("This sign-in session ended.", 404);
- if (status.phase !== "waiting") flow.expiresAt = 0;
+ if (status.phase !== "waiting" && status.phase !== "verifying") flow.expiresAt = 0;
if (status.phase === "succeeded") this.signedIn(instanceId);
return status;
}
diff --git a/src/components/EngineSetup.antigravity.test.ts b/src/components/EngineSetup.antigravity.test.ts
index 41fdad12a3..6f84470038 100644
--- a/src/components/EngineSetup.antigravity.test.ts
+++ b/src/components/EngineSetup.antigravity.test.ts
@@ -35,27 +35,59 @@ afterEach(() => {
vi.unstubAllGlobals();
});
-async function startSignIn(cloudHome: boolean, ogb: object): Promise<HTMLDetailsElement> {
- vi.stubGlobal("ogb", { platform: "linux", openExternal: vi.fn(async () => {}), ...ogb });
- const store = { state: { config: cloudHome ? { cloudHome: true } : {} }, dispatch: vi.fn(), refreshInstances: vi.fn(async () => {}), refreshModels: vi.fn(async () => {}) } as unknown as ReturnType<typeof useStore>;
+function auth(body: object) {
+ return new Response(JSON.stringify({ auth: body }), { status: 200, headers: { "content-type": "application/json" } });
+}
+
+async function startSignIn(status: object, ogb: object = { remoteClient: { active: false } }) {
+ const openExternal = vi.fn(async () => {});
+ vi.stubGlobal("ogb", { platform: "linux", openExternal, ...ogb });
+ const fetched = vi.fn(async (input: RequestInfo | URL) => String(input).includes("/auth/status")
+ ? auth(status)
+ : auth({ phase: "waiting", flowId: "flow-1", authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth?state=s" }));
+ vi.stubGlobal("fetch", fetched);
+ const store = { state: { config: {} }, dispatch: vi.fn(), refreshInstances: vi.fn(async () => {}), refreshModels: vi.fn(async () => {}) } as unknown as ReturnType<typeof useStore>;
flushSync(() => root.render(createElement(BotEditorStore, { value: store, children: createElement(EngineSetup, { instance: antigravity }) })));
- const button = [...host.querySelectorAll("button")].find((b) => b.textContent?.includes("Sign in with Google"))!;
- button.click();
- await vi.waitFor(() => expect(host.querySelector("details")).not.toBeNull());
- return host.querySelector("details")!;
+ const button = () => [...host.querySelectorAll("button")].find((b) => /Sign in with Google|Open Google sign-in again/.test(b.textContent ?? ""))!;
+ button().click();
+ await vi.waitFor(() => expect(host.querySelector("[data-redirect-paste]")).not.toBeNull());
+ return { store, fetched, openExternal, button };
}
-it("opens the paste-the-redirect step on a Cloud, where Google's 127.0.0.1 redirect can't reach the server", async () => {
- expect((await startSignIn(true, { remoteClient: { active: false } })).open).toBe(true);
-});
+it("shows the paste-the-redirect field the whole time the card waits, on the person's own computer too", async () => {
+ await startSignIn({ phase: "waiting", flowId: "flow-1" });
+ const field = host.querySelector<HTMLInputElement>("[data-redirect-paste] input")!;
+ expect(field.getAttribute("aria-label")).toBeTruthy();
+ expect(host.querySelector("details")).toBeNull();
+ await new Promise((resolve) => setTimeout(resolve, 2_300));
+ expect(host.querySelector("[data-redirect-paste] input")).not.toBeNull();
+}, 15_000);
-it("opens it on a desktop paired to another computer's server", async () => {
- expect((await startSignIn(false, { remoteClient: { active: true } })).open).toBe(true);
+it("opens the same Google link again instead of starting another sign-in", async () => {
+ const { fetched, openExternal, button } = await startSignIn({ phase: "waiting", flowId: "flow-1" });
+ await vi.waitFor(() => expect(button().textContent).toContain("Open Google sign-in again"));
+ button().click();
+ await vi.waitFor(() => expect(openExternal).toHaveBeenCalledTimes(2));
+ expect(fetched.mock.calls.filter(([input]) => String(input).includes("/auth/start"))).toHaveLength(1);
});
-it("keeps it folded on the person's own computer, where the redirect lands by itself", async () => {
- expect((await startSignIn(false, { remoteClient: { active: false } })).open).toBe(false);
-});
+it("says the sign-in expired and offers to start again, once the server reports it", async () => {
+ const { button } = await startSignIn({ phase: "expired", flowId: "flow-1", message: "Google sign-in expired. Start sign-in again." });
+ await vi.waitFor(() => expect(host.textContent).toContain("Google sign-in expired. Start again."), { timeout: 6_000 });
+ expect(host.querySelector("[data-redirect-paste]")).toBeNull();
+ expect(button().textContent).toContain("Sign in with Google");
+}, 15_000);
+
+it("shows the server's fixed reason when the sign-in fails", async () => {
+ await startSignIn({ phase: "failed", flowId: "flow-1", message: "Google sign-in was not approved. Start sign-in again." });
+ await vi.waitFor(() => expect(host.textContent).toContain("Google sign-in was not approved. Start sign-in again."), { timeout: 6_000 });
+}, 15_000);
+
+it("reads the engines and their models when the sign-in finishes by itself", async () => {
+ const { store } = await startSignIn({ phase: "succeeded", flowId: "flow-1" });
+ await vi.waitFor(() => expect(store.refreshModels).toHaveBeenCalledWith("antigravity"), { timeout: 6_000 });
+ await vi.waitFor(() => expect(host.querySelector("[data-redirect-paste]")).toBeNull());
+}, 15_000);
it("names Google on the sign-in card, never another provider", () => {
vi.stubGlobal("ogb", { platform: "linux", remoteClient: { active: false } });
diff --git a/src/components/EngineSetup.tsx b/src/components/EngineSetup.tsx
index bd435f331f..5197decfdb 100644
--- a/src/components/EngineSetup.tsx
+++ b/src/components/EngineSetup.tsx
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { AlertTriangle, Check, Copy, Download, ExternalLink, KeyRound, Loader2, LogIn, TerminalSquare, X } from "lucide-react";
-import { api, type InstanceInfo, useStore } from "@/state/store";
+import { api, ApiError, type InstanceInfo, useStore } from "@/state/store";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
import { engineDisplayName } from "@/lib/engine-name";
@@ -35,12 +35,6 @@ export function serverTerminal(cloudHome: boolean): boolean {
return Boolean(window.ogb?.openInstallTerminal) && window.ogb?.remoteClient?.active !== true && !cloudHome;
}
-/** Google's redirect goes to 127.0.0.1 on the server, which the person's browser can't reach when the server is a Cloud or
- * another computer: there the paste-the-redirect step is the only way to finish, so it starts open. */
-export function redirectPasteOpen(cloudHome: boolean): boolean {
- return cloudHome || window.ogb?.remoteClient?.active === true;
-}
-
export function grokKeyInstead(instance: InstanceInfo, cloudHome: boolean): boolean {
return instance.driverKind === "grokAgent" && needsCli(instance) && !serverTerminal(cloudHome);
}
@@ -278,18 +272,41 @@ export function EngineWarningNotice({
}
function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo; signInOnly: boolean }) {
- const { state, refreshInstances, refreshModels } = useStore();
+ const { refreshInstances, refreshModels } = useStore();
const [busy, setBusy] = useState<"install" | "signin" | "complete" | "check" | null>(null);
const [error, setError] = useState<string | null>(null);
const [flow, setFlow] = useState<{ flowId: string; authorizationUrl: string } | null>(null);
const [callbackUrl, setCallbackUrl] = useState("");
const managed = instance.install!.managed!;
+ const flowId = flow?.flowId;
useEffect(() => {
- if (!flow || instance.snapshot.authenticated) return;
- const timer = window.setInterval(() => void refreshInstances(), 2_000);
- return () => window.clearInterval(timer);
- }, [flow, instance.snapshot.authenticated, refreshInstances]);
+ if (!flowId || instance.snapshot.authenticated) return;
+ let live = true;
+ const ended = (line: string | null) => {
+ if (!live) return;
+ setFlow((current) => current?.flowId === flowId ? null : current);
+ if (line) setError(line);
+ };
+ const check = async () => {
+ try {
+ const { auth } = await api(`/api/instances/${encodeURIComponent(instance.instanceId)}/auth/status?flowId=${encodeURIComponent(flowId)}`);
+ if (!live || auth.phase === "waiting" || auth.phase === "verifying") return;
+ if (auth.phase !== "succeeded") return ended(auth.phase === "expired" ? t("engineSetup.googleExpired") : auth.message ?? t("engineSetup.googleFailed"));
+ await refreshInstances();
+ await refreshModels(instance.instanceId);
+ ended(null);
+ } catch (cause) {
+ // 404: this sign-in is gone on the server (finished through the pasted redirect, or its session ended).
+ if (cause instanceof ApiError && cause.status === 404) {
+ await refreshInstances().catch(() => {});
+ ended(null);
+ }
+ }
+ };
+ const timer = window.setInterval(() => void check(), 2_000);
+ return () => { live = false; window.clearInterval(timer); };
+ }, [flowId, instance.instanceId, instance.snapshot.authenticated, refreshInstances, refreshModels]);
const run = async (kind: NonNullable<typeof busy>, action: () => Promise<void>) => {
setBusy(kind);
@@ -307,7 +324,13 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
}
});
+ const openLink = async (link: string) => {
+ if (window.ogb?.openExternal) await window.ogb.openExternal(link);
+ else window.open(link, "_blank", "noopener,noreferrer");
+ };
+
const signIn = () => run("signin", async () => {
+ if (flow) return openLink(flow.authorizationUrl);
const { auth } = await api(`/api/instances/${encodeURIComponent(instance.instanceId)}/auth/start`, { method: "POST" });
if (auth.phase === "succeeded") {
await refreshInstances();
@@ -316,8 +339,7 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
}
if (!auth.flowId || !auth.authorizationUrl) throw new Error(t("engineSetup.googleNoLink"));
setFlow({ flowId: auth.flowId, authorizationUrl: auth.authorizationUrl });
- if (window.ogb?.openExternal) await window.ogb.openExternal(auth.authorizationUrl);
- else window.open(auth.authorizationUrl, "_blank", "noopener,noreferrer");
+ await openLink(auth.authorizationUrl);
});
const complete = () => run("complete", async () => {
@@ -377,8 +399,8 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
<button type="button" onClick={() => void check()} className="w-full rounded-lg bg-control px-3 py-2 text-[12px] font-semibold text-ink hover:bg-raised-hover">
{busy === "check" ? t("common.checking") : t("engineSetup.finishedSignIn")}
</button>
- <details open={redirectPasteOpen(state.config?.cloudHome === true)} className="rounded-lg border border-hairline/50 bg-app px-2.5 py-2 text-[12px] text-ink-secondary">
- <summary className="cursor-pointer select-none">{t("engineSetup.otherComputer")}</summary>
+ <div data-redirect-paste className="rounded-lg border border-hairline/50 bg-app px-2.5 py-2 text-[12px] text-ink-secondary">
+ <p>{t("engineSetup.otherComputer")}</p>
<p className="mt-2 leading-relaxed">{t("engineSetup.otherComputerHint")}</p>
<input
value={callbackUrl}
@@ -395,7 +417,7 @@ function ManagedEngineSetup({ instance, signInOnly }: { instance: InstanceInfo;
>
{busy === "complete" ? t("engineSetup.sending") : t("engineSetup.sendRedirect")}
</button>
- </details>
+ </div>
</>
)}
{error && <p className="text-[12px] text-danger">{error}</p>}
diff --git a/src/components/onboarding/SignInPill.test.ts b/src/components/onboarding/SignInPill.test.ts
new file mode 100644
index 0000000000..1791ef6a84
--- /dev/null
+++ b/src/components/onboarding/SignInPill.test.ts
@@ -0,0 +1,29 @@
+import { expect, it } from "vitest";
+
+import type { InstanceInfo } from "@/state/store";
+import { pillWay } from "./SignInPill";
+
+const signedOut = (method: NonNullable<InstanceInfo["authentication"]>["method"]): InstanceInfo => ({
+ instanceId: "engine", driverKind: "engine", displayName: "Engine",
+ models: { default: "model", options: [] },
+ snapshot: { state: "available", authenticated: false, version: "1.0.0" },
+ authentication: { method },
+} as InstanceInfo);
+
+it("signs in from the pill where the provider's page finishes the sign-in", () => {
+ for (const method of ["device-code", "paste-code", "browser-pkce"] as const) expect(pillWay(signedOut(method))).toBe("sign-in");
+});
+
+it("opens the dialog for a sign-in that may need its redirect pasted back, which the pill cannot show or follow", () => {
+ expect(pillWay(signedOut("callback-url"))).toBe("dialog");
+});
+
+it("still installs that engine from the pill before its sign-in", () => {
+ const notInstalled = { ...signedOut("callback-url"), snapshot: { state: "unavailable" }, authentication: undefined,
+ install: { managed: { label: "Install", downloadBytes: 1 } } } as InstanceInfo;
+ expect(pillWay(notInstalled)).toBe("install");
+});
+
+it("opens the dialog when there is nothing the pill can do itself", () => {
+ expect(pillWay(undefined)).toBe("dialog");
+});
diff --git a/src/components/onboarding/SignInPill.tsx b/src/components/onboarding/SignInPill.tsx
index 4562358e35..2179a1d689 100644
--- a/src/components/onboarding/SignInPill.tsx
+++ b/src/components/onboarding/SignInPill.tsx
@@ -28,7 +28,9 @@ type Slot =
* else through the Connect an AI dialog. */
export function pillWay(instance: InstanceInfo | undefined): "install" | "sign-in" | "dialog" {
if (!instance || !plainSignIn(instance)) return "dialog";
- return needsSignIn(instance) ? "sign-in" : "install";
+ if (!needsSignIn(instance)) return "install";
+ // A sign-in that may need its redirect pasted back has no room in the pill.
+ return instance.authentication?.method === "callback-url" ? "dialog" : "sign-in";
}
/** One AI connected from the first screen's pill: installed (when the app installs it), signed in on the provider's
diff --git a/src/locales/de.json b/src/locales/de.json
index 3c7456072f..ecc1247724 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -1355,6 +1355,8 @@
"engineSetup.sending": "Wird gesendet…",
"engineSetup.sendRedirect": "Weiterleitung senden",
"engineSetup.googleNoLink": "Die Google-Anmeldung hat keinen Link zurückgegeben.",
+ "engineSetup.googleExpired": "Die Google-Anmeldung ist abgelaufen. Starte sie erneut.",
+ "engineSetup.googleFailed": "Die Google-Anmeldung wurde nicht abgeschlossen. Starte sie erneut.",
"engineSetup.signInTitle": "Bei {name} anmelden",
"engineSetup.installTitle": "{name} installieren",
"engineSetup.managedSignIn": "Jede Antigravity-Einrichtung hat ein eigenes Google-Konto. Dein Browser schließt die sichere Anmeldung ab.",
diff --git a/src/locales/en.json b/src/locales/en.json
index acee464452..19d31d31ef 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -3673,6 +3673,8 @@
"engineSetup.sending": "Sending…",
"engineSetup.sendRedirect": "Send redirect",
"engineSetup.googleNoLink": "Google sign-in did not return a link.",
+ "engineSetup.googleExpired": "Google sign-in expired. Start again.",
+ "engineSetup.googleFailed": "Google sign-in did not finish. Start again.",
"engineSetup.signInTitle": "Sign in to {name}",
"engineSetup.installTitle": "Install {name}",
"engineSetup.managedSignIn": "Each Antigravity setup has its own Google account. Your browser completes the secure sign-in.",
diff --git a/src/locales/es.json b/src/locales/es.json
index 5f27d7256d..8fe462941c 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -2685,6 +2685,8 @@
"engineSetup.sending": "Enviando…",
"engineSetup.sendRedirect": "Enviar la redirección",
"engineSetup.googleNoLink": "El acceso con Google no devolvió un enlace.",
+ "engineSetup.googleExpired": "El inicio de sesión con Google caducó. Empieza de nuevo.",
+ "engineSetup.googleFailed": "El inicio de sesión con Google no terminó. Empieza de nuevo.",
"engineSetup.signInTitle": "Inicia sesión en {name}",
"engineSetup.installTitle": "Instalar {name}",
"engineSetup.managedSignIn": "Cada configuración de Antigravity tiene su propia cuenta de Google. Tu navegador completa el acceso seguro.",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 60af319e03..05e919d842 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -1256,6 +1256,8 @@
"engineSetup.sending": "Envoi…",
"engineSetup.sendRedirect": "Envoyer la redirection",
"engineSetup.googleNoLink": "La connexion Google n'a pas renvoyé de lien.",
+ "engineSetup.googleExpired": "La connexion Google a expiré. Recommencez.",
+ "engineSetup.googleFailed": "La connexion Google n'a pas abouti. Recommencez.",
"engineSetup.signInTitle": "Se connecter à {name}",
"engineSetup.installTitle": "Installer {name}",
"engineSetup.managedSignIn": "Chaque configuration Antigravity a son propre compte Google. Votre navigateur termine la connexion sécurisée.",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 0f1df0a2d7..626e8b3167 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -1256,6 +1256,8 @@
"engineSetup.sending": "भेजा जा रहा है…",
"engineSetup.sendRedirect": "रीडायरेक्ट भेजें",
"engineSetup.googleNoLink": "Google साइन-इन ने कोई लिंक नहीं दिया।",
+ "engineSetup.googleExpired": "Google साइन-इन की समय सीमा समाप्त हो गई। फिर से शुरू करें।",
+ "engineSetup.googleFailed": "Google साइन-इन पूरा नहीं हुआ। फिर से शुरू करें।",
"engineSetup.signInTitle": "{name} में साइन इन करें",
"engineSetup.installTitle": "{name} इंस्टॉल करें",
"engineSetup.managedSignIn": "हर Antigravity सेटअप का अपना Google खाता होता है। सुरक्षित साइन-इन आपका ब्राउज़र पूरा करता है।",
diff --git a/src/locales/it.json b/src/locales/it.json
index 2be5a02ac9..eb0ba097b7 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -2808,6 +2808,8 @@
"engineSetup.sending": "Invio…",
"engineSetup.sendRedirect": "Invia reindirizzamento",
"engineSetup.googleNoLink": "L'accesso con Google non ha restituito un link.",
+ "engineSetup.googleExpired": "L'accesso con Google è scaduto. Ricomincia.",
+ "engineSetup.googleFailed": "L'accesso con Google non è stato completato. Ricomincia.",
"engineSetup.signInTitle": "Accedi a {name}",
"engineSetup.installTitle": "Installa {name}",
"engineSetup.managedSignIn": "Ogni configurazione di Antigravity ha il suo account Google. Il browser completa l'accesso sicuro.",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 67805bce46..98cfd88619 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -3237,6 +3237,8 @@
"engineSetup.sending": "送信中…",
"engineSetup.sendRedirect": "リダイレクトを送る",
"engineSetup.googleNoLink": "Google サインインからリンクが返りませんでした。",
+ "engineSetup.googleExpired": "Google のサインインの有効期限が切れました。もう一度始めてください。",
+ "engineSetup.googleFailed": "Google のサインインが完了しませんでした。もう一度始めてください。",
"engineSetup.signInTitle": "{name} にサインイン",
"engineSetup.installTitle": "{name} をインストール",
"engineSetup.managedSignIn": "Antigravity のセットアップごとに Google アカウントがあります。安全なサインインはブラウザーで完了します。",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 2fe21dcb04..6180d2640d 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -3104,6 +3104,8 @@
"engineSetup.sending": "보내는 중…",
"engineSetup.sendRedirect": "리디렉션 보내기",
"engineSetup.googleNoLink": "Google 로그인에서 링크를 받지 못했어요.",
+ "engineSetup.googleExpired": "Google 로그인이 만료되었습니다. 다시 시작하세요.",
+ "engineSetup.googleFailed": "Google 로그인이 완료되지 않았습니다. 다시 시작하세요.",
"engineSetup.signInTitle": "{name}에 로그인",
"engineSetup.installTitle": "{name} 설치",
"engineSetup.managedSignIn": "Antigravity 설정마다 자체 Google 계정이 있어요. 브라우저에서 안전한 로그인을 마쳐요.",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index a8bab3cbb0..fb199a61c1 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -2876,6 +2876,8 @@
"engineSetup.sending": "Wysyłanie…",
"engineSetup.sendRedirect": "Wyślij przekierowanie",
"engineSetup.googleNoLink": "Logowanie przez Google nie zwróciło linku.",
+ "engineSetup.googleExpired": "Logowanie przez Google wygasło. Zacznij od nowa.",
+ "engineSetup.googleFailed": "Logowanie przez Google nie zostało ukończone. Zacznij od nowa.",
"engineSetup.signInTitle": "Zaloguj się do {name}",
"engineSetup.installTitle": "Zainstaluj {name}",
"engineSetup.managedSignIn": "Każda konfiguracja Antigravity ma własne konto Google. Przeglądarka dokończy bezpieczne logowanie.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 9fc8856145..bcaee76eac 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -3494,6 +3494,8 @@
"engineSetup.sending": "Enviando…",
"engineSetup.sendRedirect": "Enviar link",
"engineSetup.googleNoLink": "O login do Google não devolveu um link.",
+ "engineSetup.googleExpired": "O login com o Google expirou. Comece de novo.",
+ "engineSetup.googleFailed": "O login com o Google não foi concluído. Comece de novo.",
"engineSetup.signInTitle": "Entrar em {name}",
"engineSetup.installTitle": "Instalar {name}",
"engineSetup.managedSignIn": "Cada configuração do Antigravity tem a própria conta Google. Seu navegador conclui o login seguro.",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index eb113b6f95..a909e26db2 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -2904,6 +2904,8 @@
"engineSetup.sending": "Отправка…",
"engineSetup.sendRedirect": "Отправить перенаправление",
"engineSetup.googleNoLink": "Вход через Google не вернул ссылку.",
+ "engineSetup.googleExpired": "Срок входа через Google истёк. Начните заново.",
+ "engineSetup.googleFailed": "Вход через Google не завершён. Начните заново.",
"engineSetup.signInTitle": "Вход в {name}",
"engineSetup.installTitle": "Установить {name}",
"engineSetup.managedSignIn": "У каждого экземпляра Antigravity свой аккаунт Google. Безопасный вход выполняется в вашем браузере.",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index 2690984c22..bc674ca83d 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -2357,6 +2357,8 @@
"engineSetup.sending": "Gönderiliyor…",
"engineSetup.sendRedirect": "Yönlendirmeyi gönder",
"engineSetup.googleNoLink": "Google girişi bir bağlantı döndürmedi.",
+ "engineSetup.googleExpired": "Google girişinin süresi doldu. Yeniden başlatın.",
+ "engineSetup.googleFailed": "Google girişi tamamlanamadı. Yeniden başlatın.",
"engineSetup.signInTitle": "{name} servisine giriş yap",
"engineSetup.installTitle": "{name} Kur",
"engineSetup.managedSignIn": "Her Antigravity kurulumunun kendi Google hesabı vardır. Güvenli girişi tarayıcınız tamamlar.",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index dc8d00c684..fedb6391ee 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -1430,6 +1430,8 @@
"engineSetup.sending": "Надсилаємо…",
"engineSetup.sendRedirect": "Надіслати редирект",
"engineSetup.googleNoLink": "Вхід Google не повернув посилання.",
+ "engineSetup.googleExpired": "Термін входу через Google минув. Почніть знову.",
+ "engineSetup.googleFailed": "Вхід через Google не завершено. Почніть знову.",
"engineSetup.signInTitle": "Увійти в {name}",
"engineSetup.installTitle": "Встановити {name}",
"engineSetup.managedSignIn": "Кожне налаштування Antigravity має власний акаунт Google. Ваш браузер виконує безпечний вхід.",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 0351d35036..b0344509cc 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -2357,6 +2357,8 @@
"engineSetup.sending": "Đang gửi…",
"engineSetup.sendRedirect": "Gửi chuyển hướng",
"engineSetup.googleNoLink": "Đăng nhập bằng Google không trả về liên kết.",
+ "engineSetup.googleExpired": "Phiên đăng nhập Google đã hết hạn. Hãy bắt đầu lại.",
+ "engineSetup.googleFailed": "Đăng nhập Google chưa hoàn tất. Hãy bắt đầu lại.",
"engineSetup.signInTitle": "Đăng nhập vào {name}",
"engineSetup.installTitle": "Cài đặt {name}",
"engineSetup.managedSignIn": "Mỗi thiết lập Antigravity có tài khoản Google riêng. Trình duyệt của bạn sẽ hoàn tất đăng nhập bảo mật.",