Skip to content

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

fix(antigravity): runtimes before 1.5.1 are started with an allowlisted editor's client name (#6089)

Milind Sonie18bb244c0e2
diff --git a/NOTICE b/NOTICE
index 478e7cb685..d800e9f9fd 100644
--- a/NOTICE
+++ b/NOTICE
@@ -6,8 +6,8 @@ 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, sign-out, session setup, turn-outcome, and runtime
-temporary-folder behavior from T3 Code, Copyright 2026 T3 Tools Inc., used under the MIT License
+authentication, sign-out, session setup, client name, turn-outcome, 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,
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index 379326729d..30f02c4f78 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -1168,7 +1168,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
"initialize",
{
protocolVersion: 1,
- clientInfo: { name: "openmausbot", version: "0.0.0" },
+ clientInfo: support.clientInfo?.(instanceId) ?? { name: "openmausbot", version: "0.0.0" },
clientCapabilities: {
fs: {
readTextFile: support.clientFileSystem === true,
diff --git a/server/drivers/acp/driver-hooks.ts b/server/drivers/acp/driver-hooks.ts
index 6618ebc360..22f85d44ee 100644
--- a/server/drivers/acp/driver-hooks.ts
+++ b/server/drivers/acp/driver-hooks.ts
@@ -18,6 +18,8 @@ export interface AcpDriverHooks {
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>;
+ /** The `clientInfo` of initialize, for an agent that reads it; the app's own name when unset or undefined. */
+ clientInfo?(instanceId: string): { name: string; version: string } | undefined;
/** Called before each session/prompt. The check it returns gets that prompt's result and names the failure the agent
* reported as an ordinary reply, which then fails the turn. Neither may throw. */
promptOutcome?(instanceId: string, sessionId: string): Promise<(result: unknown) => Promise<Error | undefined>>;
diff --git a/server/drivers/antigravity-acp.ts b/server/drivers/antigravity-acp.ts
index acf83e27cf..fa92229a87 100644
--- a/server/drivers/antigravity-acp.ts
+++ b/server/drivers/antigravity-acp.ts
@@ -10,7 +10,9 @@
// - 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 session setup for releases that write a workflow skill file);
+// - apps/server/src/provider/acp/AntigravityAcpSupport.ts:89-90, 123-129
+// at b732621b51 (the client name by runtime version).
// 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";
@@ -324,6 +326,7 @@ export class AntigravityAcpClient {
private stopping?: Promise<boolean>;
private readonly onAuthorizationUrl?: (url: string) => void;
private readonly tempDirectory?: string;
+ private readonly runtimeVersion: string | null;
/** On Windows a running executable pins its file and directory: do not rename or delete before this settles. */
readonly exited: Promise<void>;
@@ -336,6 +339,7 @@ export class AntigravityAcpClient {
) {
this.onAuthorizationUrl = onAuthorizationUrl;
this.tempDirectory = profile.tempDirectory;
+ this.runtimeVersion = runtime.version;
this.child = spawnCli(
runtime.executablePath,
process.platform === "linux" ? ["--uid="] : [],
@@ -493,7 +497,7 @@ export class AntigravityAcpClient {
};
const initialized = await this.request("initialize", {
protocolVersion: 1,
- clientInfo: { name: "openmausbot", version: "0.0.0" },
+ clientInfo: antigravityClientInfo(this.runtimeVersion),
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
}, Math.min(windowMs, Math.max(0, deadline - Date.now())), expired);
this.initializationComplete = true;
@@ -700,6 +704,19 @@ export async function probeAntigravityModels(input: {
}
}
+/** Whether runtimes that offer some models only to editors they know are told an editor's name. */
+export const ANTIGRAVITY_EDITOR_CLIENT_NAME = true;
+// `agy acp` 1.5.1 offers every model to every ACP client; older runtimes allowlist editors.
+const OPEN_MODEL_ACCESS_RELEASE = [1, 5, 1] as const;
+
+/** The `clientInfo` a runtime of `version` is started with. Before 1.5.1, and for a version that is not known, a runtime
+ * offers its non-Gemini models only to clients on its allowlist, so it is given a name from that list. */
+export function antigravityClientInfo(version: string | null | undefined, editorName = ANTIGRAVITY_EDITOR_CLIENT_NAME): { name: string; version: string } {
+ const match = /^(\d+)\.(\d+)\.(\d+)/u.exec(version?.trim() ?? "");
+ const open = match !== null && OPEN_MODEL_ACCESS_RELEASE.reduce((difference, part, index) => difference || Number(match[index + 1]) - part, 0) >= 0;
+ return open || !editorName ? { name: "openmausbot", version: "0.0.0" } : { name: "zed", version: "0.0.0" };
+}
+
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
diff --git a/server/drivers/antigravity-client-name.test.ts b/server/drivers/antigravity-client-name.test.ts
new file mode 100644
index 0000000000..32cd32cfa9
--- /dev/null
+++ b/server/drivers/antigravity-client-name.test.ts
@@ -0,0 +1,91 @@
+// Adapted from pingdotgg/t3code@b732621b51, MIT License, Copyright (c) 2026
+// T3 Tools Inc. (full text in third_party/t3-code/LICENSE); modified:
+// - apps/server/src/provider/acp/AntigravityAcpSupport.test.ts:62-99 (the
+// table of versions and the name each gets).
+import { chmodSync, copyFileSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { ensureDirs } from "../config.ts";
+import type { ProviderInstance } from "../contracts.ts";
+import { removeTempDir } from "../testing/cleanup.ts";
+import { recordEvents } from "../testing/events.ts";
+import { antigravityClientInfo, antigravityTokenPath, prepareAntigravityProfile, probeAntigravityModels } from "./antigravity-acp.ts";
+import { resolveAntigravityRuntime } from "./antigravity-runtime.ts";
+import { AntigravityDriver } from "./antigravity.ts";
+
+const FAKE_ACP = join(dirname(fileURLToPath(import.meta.url)), "..", "testing", "fake-acp-cli.ts");
+const OWN = { name: "openmausbot", version: "0.0.0" };
+const scratch: string[] = [];
+const instances: ProviderInstance[] = [];
+
+function fakeRuntime() {
+ const directory = mkdtempSync(join(tmpdir(), "omb-antigravity-client-"));
+ scratch.push(directory);
+ const executable = join(directory, "fake-antigravity.ts");
+ const harness = join(directory, process.platform === "win32" ? "localharness_external.exe" : "localharness_external");
+ copyFileSync(FAKE_ACP, executable);
+ copyFileSync(FAKE_ACP, harness);
+ if (process.platform !== "win32") for (const file of [executable, harness]) chmodSync(file, 0o755);
+ return { directory, executable, dump: join(directory, "dump.json") };
+}
+
+afterEach(async () => {
+ for (const instance of instances.splice(0)) await instance.dispose();
+ while (scratch.length) await removeTempDir(scratch.pop()!);
+});
+
+describe("the client name an Antigravity runtime is started with", () => {
+ it.each([
+ { version: "1.4.1", ownName: false },
+ { version: "1.4.2", ownName: false },
+ { version: "1.4.3", ownName: false },
+ { version: "1.4.5", ownName: false },
+ { version: "1.4.6", ownName: false },
+ { version: "1.5.0", ownName: false },
+ { version: "1.5.1", ownName: true },
+ { version: "1.5.7", ownName: true },
+ { version: "1.10.0", ownName: true },
+ { version: "2.0.0", ownName: true },
+ { version: "1.3.0", ownName: false },
+ { version: undefined, ownName: false },
+ { version: null, ownName: false },
+ { version: "unknown", ownName: false },
+ ])("$version: own client name $ownName", ({ version, ownName }) => {
+ expect(antigravityClientInfo(version)).toEqual(ownName ? OWN : { name: "zed", version: "0.0.0" });
+ });
+
+ it.each(["1.4.3", "1.5.1", undefined])("is the app's own for %s once the switch is off", (version) => {
+ expect(antigravityClientInfo(version, false)).toEqual(OWN);
+ });
+
+ it("reaches the runtime's initialize for a turn and for the model lookup", async () => {
+ ensureDirs();
+ const turn = fakeRuntime();
+ const instanceId = "antigravity-client-name";
+ const token = antigravityTokenPath(instanceId);
+ mkdirSync(dirname(token), { recursive: true });
+ writeFileSync(token, "{}", { mode: 0o600 });
+ const instance = await AntigravityDriver.create({
+ instanceId, displayName: "Antigravity", enabled: true,
+ config: { cli: turn.executable, fullAuto: false },
+ environment: { FAKE_ACP_AUTH_METHOD: "oauth-personal", FAKE_ACP_MODELS: "gemini-3.8-flash", FAKE_ACP_AGENT_NAME: "Google Antigravity", FAKE_ACP_DUMP: turn.dump },
+ });
+ instances.push(instance);
+ const recorder = recordEvents(instance.adapter);
+ const { turnId } = await instance.adapter.sendTurn({ threadId: "client-name", text: "hello", approvalMode: "full", cwd: turn.directory });
+ await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);
+ expect(JSON.parse(readFileSync(`${turn.dump}.initialize.json`, "utf8")).clientInfo).toEqual({ name: "zed", version: "0.0.0" });
+
+ const lookup = fakeRuntime();
+ const runtime = await resolveAntigravityRuntime(lookup.executable);
+ const profile = await prepareAntigravityProfile({
+ instanceId: "lookup", runtime, baseDir: lookup.directory,
+ baseEnv: { ...process.env, FAKE_ACP_AUTH_METHOD: "oauth-personal", FAKE_ACP_MODELS: "gemini-3.8-flash", FAKE_ACP_AGENT_NAME: "Google Antigravity", FAKE_ACP_DUMP: lookup.dump },
+ });
+ await probeAntigravityModels({ runtime: { ...runtime, version: "1.5.1" }, profile, fallbackDefault: "gemini-3.8-flash" });
+ expect(JSON.parse(readFileSync(`${lookup.dump}.initialize.json`, "utf8")).clientInfo).toEqual(OWN);
+ }, 90_000);
+});
diff --git a/server/drivers/antigravity.ts b/server/drivers/antigravity.ts
index 217108a9a9..07c1344402 100644
--- a/server/drivers/antigravity.ts
+++ b/server/drivers/antigravity.ts
@@ -14,6 +14,7 @@ import type {
} from "../contracts.ts";
import { createAcpDriver, type AcpConfig, type AcpSupport } from "./acp/core.ts";
import {
+ antigravityClientInfo,
antigravityProfileAuthenticated,
antigravityProfileDirectory,
antigravitySessionSetup,
@@ -74,6 +75,8 @@ const managedAsset = resolveAntigravityReleaseAsset();
const runtimeProcesses = new AntigravityProcesses();
/** Every model id an account here has been offered, beside the bundled catalog's. */
const offeredModels = new Set<string>();
+/** The version of the runtime each instance's turns were last started on, known before it answers initialize. */
+const launchedVersions = new Map<string, string | null>();
const support: AcpSupport = {
driverKind: "antigravityAgent",
@@ -105,6 +108,7 @@ const support: AcpSupport = {
resolveCommand: async (env, config, instanceId) => {
const runtime = await resolveAntigravityRuntime(config.cli, env);
+ launchedVersions.set(instanceId, runtime.version);
const profile = await prepareAntigravityProfile({ instanceId, runtime, baseEnv: env });
if (profile.tempDirectory) scheduleAntigravityTempSweep(instanceId);
return {
@@ -143,6 +147,7 @@ const support: AcpSupport = {
sessionSetupParams: antigravitySessionSetup,
// One model family's quota is not the account's: Gemini and the models that share another allowance keep running.
limitFacts: (_text, model) => antigravityLimitFacts(model, [...support.models.options.map((option) => option.id), ...offeredModels]),
+ clientInfo: (instanceId) => antigravityClientInfo(launchedVersions.get(instanceId)),
promptOutcome: (instanceId, sessionId) => watchAntigravityPromptOutcome(support.displayName, antigravityProfileDirectory(instanceId), sessionId),
requireAuthenticationBeforeSpawn: true,
isAuthenticated: async (env, config, instanceId) => {
diff --git a/server/testing/fake-acp-cli.ts b/server/testing/fake-acp-cli.ts
index 67374a4c95..7b6196ffbc 100755
--- a/server/testing/fake-acp-cli.ts
+++ b/server/testing/fake-acp-cli.ts
@@ -30,6 +30,7 @@
// FAKE_ACP_MCP_TRANSPORTS remote MCP transports advertised in initialize, e.g. "http,sse"
// FAKE_ACP_PERMISSION_OPTIONS JSON options override in permission mode
// FAKE_ACP_DUMP path for {argv, env}; with FAKE_ACP_MODES or FAKE_ACP_MODELS also <dump>.prompts.jsonl
+// and <dump>.initialize.json for the initialize params
// FAKE_ACP_LAUNCH_COUNT_FILE process counter incremented at startup
// FAKE_ACP_VERSION what `--version` prints (default "fake-acp 1.0.0"); a CLI the driver checks the shape of needs its own
// FAKE_ACP_RPC_DUMP this process's method list, rewritten after every request
@@ -818,6 +819,7 @@ function handle(msg: any) {
switch (msg.method) {
case "initialize": {
+ if (process.env.FAKE_ACP_DUMP) writeFileSync(`${process.env.FAKE_ACP_DUMP}.initialize.json`, JSON.stringify(msg.params));
if (failRpc(msg)) break;
if (mode === "hang-initialize") {
setInterval(() => {}, 1_000);