The best way to control Claude Code, Codex and more from any computer or phone
feat(antigravity): support agy CLI as custom binaryPath (#32503)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Georgi Todorov committed
Nov 8, 2026 at 06:09 UTC
7b680b616f6d35fa3ba16c3dbdd6f9146b1f3a92
4 files changed
+156
-23
apps/server/src/provider/AntigravityInstallation.test.ts
+82
-5
@@ -237,7 +237,7 @@ const expectPreviousRelease = Effect.fn("test.expectPreviousAntigravityRelease")
237
path.join(installation.managedDirectory, "versions", previousReleaseId),
238
);
239
expect(yield* fs.readFileString(resolved.executablePath)).toBe(serverContents);
240
- expect(yield* fs.readFileString(resolved.harnessPath)).toBe(harnessContents);
240
+ expect(yield* fs.readFileString(resolved.harnessPath!)).toBe(harnessContents);
241
expect((yield* installation.state).installedVersion).toBe(previousVersion);
242
});
243
@@ -281,7 +281,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
281
expect(validation?.version).toBe("fixture-new");
282
if (!validation) return yield* Effect.die("Expected runtime validation.");
283
expect(yield* fs.readFileString(validation.executable.executablePath)).toBe(serverContents);
284
- expect(yield* fs.readFileString(validation.executable.harnessPath)).toBe(harnessContents);
284
+ expect(yield* fs.readFileString(validation.executable.harnessPath!)).toBe(harnessContents);
285
286
yield* Deferred.succeed(finishValidation, undefined);
287
expect(yield* terminalState(installation)).toMatchObject({
@@ -293,9 +293,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
293
yield* Deferred.await(stagingReleased);
294
const selected = yield* installation.resolve();
295
expect(selected).toMatchObject({ source: "managed", version: "fixture-new" });
296
- expect(path.dirname(selected.harnessPath)).toBe(path.dirname(selected.executablePath));
296
+ expect(path.dirname(selected.harnessPath!)).toBe(path.dirname(selected.executablePath));
297
expect(yield* fs.readFileString(selected.executablePath)).toBe(serverContents);
298
- expect(yield* fs.readFileString(selected.harnessPath)).toBe(harnessContents);
298
+ expect(yield* fs.readFileString(selected.harnessPath!)).toBe(harnessContents);
299
expect(yield* fs.readDirectory(path.join(installation.managedDirectory, "versions"))).toEqual(
300
expect.arrayContaining([previousReleaseId, (yield* releaseAsset()).sha256]),
301
);
@@ -634,6 +634,68 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
634
}),
635
);
636
637
+ // The mocked Linux PATH walk needs POSIX paths; Windows temp paths contain colons.
638
+ it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
639
+ "accepts the agy CLI without a harness sibling but still requires one for other binaries",
640
+ () =>
641
+ Effect.gen(function* () {
642
+ const fs = yield* FileSystem.FileSystem;
643
+ const path = yield* Path.Path;
644
+ const baseDir = yield* fs
645
+ .makeTempDirectoryScoped({ prefix: "t3-agy-cli-test-" })
646
+ .pipe(Effect.flatMap((directory) => fs.realPath(directory)));
647
+ const cliDirectory = path.join(baseDir, "cli");
648
+ yield* fs.makeDirectory(cliDirectory);
649
+ const cli = path.join(cliDirectory, "antigravity");
650
+ const alias = path.join(cliDirectory, "agy");
651
+ const other = path.join(cliDirectory, "custom-acp");
652
+ yield* fs.writeFileString(cli, "cli", { mode: 0o755 });
653
+ yield* fs.symlink(cli, alias);
654
+ yield* fs.writeFileString(other, "other", { mode: 0o755 });
655
+ const { installation } = yield* makeHarness({ baseDir });
656
+
657
+ expect(yield* installation.resolve(cli)).toMatchObject({
658
+ executablePath: cli,
659
+ harnessPath: null,
660
+ source: "override",
661
+ version: null,
662
+ });
663
+ expect(yield* installation.resolve(alias)).toMatchObject({
664
+ executablePath: alias,
665
+ harnessPath: null,
666
+ });
667
+ expect(yield* installation.resolve("agy", { PATH: cliDirectory })).toMatchObject({
668
+ executablePath: alias,
669
+ harnessPath: null,
670
+ });
671
+ expect(yield* installation.resolve(other).pipe(Effect.flip)).toMatchObject({
672
+ operation: "resolve",
673
+ });
674
+
675
+ // Version-manager shims dispatch by their invoked name, so the shim path is what runs.
676
+ const shims = path.join(baseDir, "shims");
677
+ const mise = path.join(baseDir, "mise");
678
+ yield* fs.makeDirectory(shims);
679
+ yield* fs.writeFileString(mise, "mise", { mode: 0o755 });
680
+ yield* fs.symlink(mise, path.join(shims, "agy"));
681
+ expect(yield* installation.resolve("agy", { PATH: shims })).toMatchObject({
682
+ executablePath: path.join(shims, "agy"),
683
+ harnessPath: null,
684
+ });
685
+
686
+ const { installation: windows } = yield* makeHarness({ baseDir, platform: "win32" });
687
+ for (const name of ["agy.EXE", "agy.cmd"]) {
688
+ const windowsDirectory = path.join(baseDir, `windows-${name}`);
689
+ yield* fs.makeDirectory(windowsDirectory);
690
+ yield* fs.writeFileString(path.join(windowsDirectory, name), "cli");
691
+ expect(yield* windows.resolve("agy", { PATH: windowsDirectory })).toMatchObject({
692
+ executablePath: path.join(windowsDirectory, name),
693
+ harnessPath: null,
694
+ });
695
+ }
696
+ }),
697
+ );
698
+
699
// The mocked Linux PATH walk needs POSIX paths; Windows temp paths contain colons.
700
it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
701
"honors explicit paths and reports invalid overrides without falling back",
@@ -697,6 +759,21 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
759
expect(
760
yield* isolated.installation.resolve(executableName, { PATH: externalDirectory }),
761
).toMatchObject({ source: "override", executablePath: externalExecutable });
762
+
763
+ const incompleteDirectory = path.join(baseDir, "incomplete");
764
+ yield* fs.makeDirectory(incompleteDirectory);
765
+ yield* fs.writeFileString(path.join(incompleteDirectory, executableName), "no harness", {
766
+ mode: 0o755,
767
+ });
768
+ const shadowedPath = { PATH: `${incompleteDirectory}:${externalDirectory}` };
769
+ expect(yield* isolated.installation.resolve(undefined, shadowedPath)).toMatchObject({
770
+ source: "path",
771
+ executablePath: externalExecutable,
772
+ });
773
+ expect(yield* isolated.installation.resolve(executableName, shadowedPath)).toMatchObject({
774
+ source: "override",
775
+ executablePath: externalExecutable,
776
+ });
777
}),
778
);
779
@@ -725,7 +802,7 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
802
Effect.gen(function* () {
803
const { installation, baseDir, fs, path } = yield* makeHarness({ previous: true });
804
const previous = yield* installation.resolve();
728
- yield* fs.remove(previous.harnessPath);
805
+ yield* fs.remove(previous.harnessPath!);
806
const externalDirectory = path.join(baseDir, "external");
807
yield* fs.makeDirectory(externalDirectory);
808
yield* fs.writeFileString(path.join(externalDirectory, executableName), "external server", {
apps/server/src/provider/AntigravityInstallation.ts
+49
-15
@@ -3,6 +3,7 @@ import * as EffectNodeStream from "@effect/platform-node/NodeStream";
3
import { ProviderDriverKind, type ProviderInstallState } from "@t3tools/contracts";
4
import * as HostProcess from "@t3tools/shared/HostProcess";
5
import { resolveNodeExecutable, nodeRuntimeUnavailableMessage } from "@t3tools/shared/nodeRuntime";
6
+import { resolveCommandPath } from "@t3tools/shared/shell";
7
import * as Clock from "effect/Clock";
8
import * as Cause from "effect/Cause";
9
import * as Context from "effect/Context";
@@ -75,7 +76,8 @@ const isAcpProcessExitedError = Schema.is(EffectAcpErrors.AcpProcessExitedError)
76
77
export interface AntigravityExecutable {
78
readonly executablePath: string;
78
- readonly harnessPath: string;
79
+ /** Null for the `agy` CLI, which embeds the harness and runs as `agy acp`. */
80
+ readonly harnessPath: string | null;
81
readonly source: "override" | "managed" | "path";
82
readonly version: string | null;
83
readonly managedVersionDirectory: string | null;
@@ -141,6 +143,13 @@ function executableNames(platform: NodeJS.Platform) {
143
: { executable: "agy_acp_server.par", harness: "localharness_external" };
144
}
145
146
+/** Antigravity CLI 1.5.0+ serves ACP itself (`agy acp`), so it has no `localharness_external` sibling. */
147
+function isAntigravityCli(...candidates: ReadonlyArray<string>) {
148
+ return candidates.some((candidate) =>
149
+ /^(?:agy|antigravity)(?:\.(?:exe|cmd|bat))?$/iu.test(candidate.split(/[\\/]/u).at(-1) ?? ""),
150
+ );
151
+}
152
+
153
function isRunning(state: ProviderInstallState) {
154
return (
155
state.phase === "downloading" || state.phase === "extracting" || state.phase === "verifying"
@@ -252,6 +261,16 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
261
) {
262
if (!(yield* executableFile(candidate))) return null;
263
const executablePath = yield* fs.realPath(candidate);
264
+ // Keep launcher symlinks intact: version-manager shims dispatch by their invoked name.
265
+ if (isAntigravityCli(candidate, executablePath)) {
266
+ return {
267
+ executablePath: candidate,
268
+ harnessPath: null,
269
+ source,
270
+ version: null,
271
+ managedVersionDirectory: null,
272
+ } satisfies AntigravityExecutable;
273
+ }
274
const directory = path.dirname(executablePath);
275
const harnessPath = path.join(directory, names.harness);
276
if (!(yield* executableFile(harnessPath))) return null;
@@ -273,17 +292,36 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
292
} satisfies AntigravityExecutable;
293
});
294
276
- const pathCandidates = (binary: string, processEnvironment = environment) => {
295
+ const commandPath = (command: string, env: NodeJS.ProcessEnv) =>
296
+ resolveCommandPath(command, { env }).pipe(
297
+ Effect.map((resolved) => (resolved === null ? null : path.resolve(resolved))),
298
+ Effect.provideService(HostProcess.Platform, platform),
299
+ Effect.provideService(FileSystem.FileSystem, fs),
300
+ Effect.provideService(Path.Path, path),
301
+ );
302
+
303
+ // Resolve per PATH entry so an executable without its harness falls through to later entries.
304
+ const commandCandidates = Effect.fn("AntigravityInstallation.commandCandidates")(function* (
305
+ command: string,
306
+ processEnvironment = environment,
307
+ ) {
308
+ if (command.includes("/") || command.includes("\\")) {
309
+ const resolved = yield* commandPath(command, processEnvironment);
310
+ return resolved === null ? [] : [resolved];
311
+ }
312
const pathValue =
313
platform === "win32"
314
? Object.entries(processEnvironment).findLast(([key]) => key.toUpperCase() === "PATH")?.[1]
315
: processEnvironment.PATH;
281
- return (pathValue ?? "")
282
- .split(platform === "win32" ? ";" : ":")
283
- .map((directory) => directory.trim().replace(/^"|"$/gu, ""))
284
- .filter((directory) => directory.length > 0)
285
- .map((directory) => path.resolve(directory, binary));
286
- };
316
+ const candidates: string[] = [];
317
+ for (const directory of (pathValue ?? "").split(platform === "win32" ? ";" : ":")) {
318
+ const entry = directory.trim().replace(/^"|"$/gu, "");
319
+ if (entry.length === 0) continue;
320
+ const resolved = yield* commandPath(command, { ...processEnvironment, PATH: entry });
321
+ if (resolved !== null) candidates.push(resolved);
322
+ }
323
+ return candidates;
324
+ });
325
326
const resolve: AntigravityInstallationService["resolve"] = Effect.fn(
327
"AntigravityInstallation.resolve",
@@ -291,24 +329,20 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
329
function* (binaryPath?: string, processEnvironment?: NodeJS.ProcessEnv) {
330
const override = binaryPath?.trim();
331
if (override) {
294
- const candidates =
295
- path.isAbsolute(override) || override.includes("/") || override.includes("\\")
296
- ? [path.resolve(override)]
297
- : pathCandidates(override, processEnvironment);
298
- for (const candidate of candidates) {
332
+ for (const candidate of yield* commandCandidates(override, processEnvironment)) {
333
const selected = yield* fromExternal(candidate, "override");
334
if (selected) return selected;
335
}
336
return yield* installationError(
337
"resolve",
304
- "The custom Antigravity executable or its localharness_external sibling is missing or not executable.",
338
+ "The custom Antigravity executable is missing or not executable, or it needs a localharness_external sibling. The agy CLI does not.",
339
);
340
}
341
if (yield* fs.exists(activePath)) {
342
const active = yield* readRecord(activePath, ActiveRelease);
343
return yield* completedRelease(active.releaseId);
344
}
311
- for (const candidate of pathCandidates(names.executable, processEnvironment)) {
345
+ for (const candidate of yield* commandCandidates(names.executable, processEnvironment)) {
346
const selected = yield* fromExternal(candidate, "path");
347
if (selected) return selected;
348
}
apps/server/src/provider/antigravityAuthSupport.test.ts
+14
@@ -102,6 +102,20 @@ describe("Antigravity process environment", () => {
102
});
103
});
104
105
+ it("runs the agy CLI as `agy acp` without a harness", () => {
106
+ const spawn = buildAntigravityAcpSpawnInput({
107
+ installation: { executablePath: "/usr/bin/agy", harnessPath: null },
108
+ profile,
109
+ cwd: "/project",
110
+ baseEnv: { PATH: "/usr/bin", ANTIGRAVITY_HARNESS_PATH: "/stale/harness" },
111
+ });
112
+
113
+ expect(spawn.command).toBe("/usr/bin/agy");
114
+ expect(spawn.args).toEqual(["acp"]);
115
+ expect(spawn.env).not.toHaveProperty("ANTIGRAVITY_HARNESS_PATH");
116
+ expect(spawn.env).toMatchObject({ GEMINI_HOME: profile.geminiHome, PATH: "/usr/bin" });
117
+ });
118
+
119
it("passes only the configured method's credential and keeps the GCP pair out of the environment", () => {
120
const baseEnv = { PATH: "/usr/bin", GOOGLE_API_KEY: "ambient-key" };
121
const spawnFor = (auth: AntigravityAuthConfig) =>
apps/server/src/provider/antigravityAuthSupport.ts
+11
-3
@@ -452,7 +452,7 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(
452
export function buildAntigravityAcpSpawnInput(input: {
453
readonly installation: {
454
readonly executablePath: string;
455
- readonly harnessPath: string;
455
+ readonly harnessPath: string | null;
456
};
457
readonly profile: AntigravityProfile;
458
readonly cwd: string;
@@ -462,7 +462,13 @@ export function buildAntigravityAcpSpawnInput(input: {
462
}): AcpSessionRuntime.AcpSpawnInput {
463
return {
464
command: input.installation.executablePath,
465
- args: input.profile.platform === "linux" ? ["--uid="] : [],
465
+ // The agy CLI has no harness sibling and serves ACP through its `acp` subcommand.
466
+ args:
467
+ input.installation.harnessPath === null
468
+ ? ["acp"]
469
+ : input.profile.platform === "linux"
470
+ ? ["--uid="]
471
+ : [],
472
cwd: input.cwd,
473
env: {
474
...antigravityEnvironment(
@@ -471,7 +477,9 @@ export function buildAntigravityAcpSpawnInput(input: {
477
input.auth ?? ANTIGRAVITY_PERSONAL_AUTH,
478
input.runtimeTempDirectory,
479
),
474
- ANTIGRAVITY_HARNESS_PATH: input.installation.harnessPath,
480
+ ...(input.installation.harnessPath === null
481
+ ? {}
482
+ : { ANTIGRAVITY_HARNESS_PATH: input.installation.harnessPath }),
483
},
484
extendEnv: false,
485
};