The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 03:15 UTC
fix(server): Antigravity installs on Intel Macs (#30189)
Co-authored-by: Alessio Fano <alessio.fano@swisscom.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Ale 🐶 committed
Nov 6, 2026 at 08:39 UTC
c55db3e9c72fdf584f4b54192fb39beb88667b59
2 files changed
+92
-6
apps/server/src/provider/AntigravityInstallation.test.ts
+58
@@ -18,6 +18,8 @@ import * as Scope from "effect/Scope";
18
import * as Sink from "effect/Sink";
19
import * as Stream from "effect/Stream";
20
import { HttpClient, HttpClientResponse } from "effect/http";
21
+import * as ChildProcess from "effect/process/ChildProcess";
22
+import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
23
24
import * as AntigravityInstallation from "./AntigravityInstallation.ts";
25
import { type AntigravityReleaseAsset } from "./antigravityRelease.ts";
@@ -121,6 +123,7 @@ interface HarnessOptions {
123
readonly path?: string;
124
readonly previous?: boolean;
125
readonly fileSystem?: FileSystem.FileSystem;
126
+ readonly spawner?: ChildProcessSpawner.ChildProcessSpawner["Service"];
127
readonly validate?: AntigravityInstallation.AntigravityInstallationOptions["validate"];
128
readonly useDefaultValidation?: boolean;
129
}
@@ -175,6 +178,9 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
178
),
179
}),
180
}).pipe(
181
+ options.spawner
182
+ ? Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, options.spawner)
183
+ : (effect) => effect,
184
Effect.provideService(FileSystem.FileSystem, trackedFs),
185
Effect.provideService(HostProcess.Platform, platform),
186
Effect.provideService(HostProcess.Architecture, arch),
@@ -571,6 +577,58 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
577
}),
578
);
579
580
+ it.effect("re-signs the Intel Mac runtime ad hoc and records the signed sizes", () =>
581
+ Effect.gen(function* () {
582
+ const fs = yield* FileSystem.FileSystem;
583
+ const signed: Array<ReadonlyArray<string>> = [];
584
+ const spawner = ChildProcessSpawner.make((command) =>
585
+ Effect.gen(function* () {
586
+ if (!ChildProcess.isStandardCommand(command))
587
+ return yield* Effect.die("Unexpected spawn.");
588
+ const args = command.args.map(String);
589
+ signed.push([String(command.command), ...args]);
590
+ // codesign rewrites the signature, which changes each file's size.
591
+ for (const file of args.slice(3)) {
592
+ yield* fs.writeFileString(file, "signature", { flag: "a" });
593
+ }
594
+ return ChildProcessSpawner.makeHandle({
595
+ pid: ChildProcessSpawner.ProcessId(900_000_301),
596
+ exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(0)),
597
+ isRunning: Effect.succeed(false),
598
+ kill: () => Effect.void,
599
+ unref: Effect.succeed(Effect.void),
600
+ stdin: Sink.drain,
601
+ stdout: Stream.empty,
602
+ stderr: Stream.empty,
603
+ all: Stream.empty,
604
+ getInputFd: () => Sink.drain,
605
+ getOutputFd: () => Stream.empty,
606
+ });
607
+ }).pipe(Effect.orDie),
608
+ );
609
+ const { installation, validations } = yield* makeHarness({
610
+ platform: "darwin",
611
+ arch: "x64",
612
+ spawner,
613
+ });
614
+ yield* installation.start;
615
+ expect((yield* terminalState(installation)).phase).toBe("succeeded");
616
+ const validated = validations[0]?.executable;
617
+ expect(signed).toEqual([
618
+ [
619
+ "/usr/bin/codesign",
620
+ "--force",
621
+ "--sign",
622
+ "-",
623
+ validated?.executablePath,
624
+ validated?.harnessPath,
625
+ ],
626
+ ]);
627
+ const selected = yield* installation.resolve();
628
+ expect(yield* fs.readFileString(selected.executablePath)).toBe(`${serverContents}signature`);
629
+ }),
630
+ );
631
+
632
// The mocked Linux PATH walk needs POSIX paths; Windows temp paths contain colons.
633
it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
634
"honors explicit paths and reports invalid overrides without falling back",
apps/server/src/provider/AntigravityInstallation.ts
+34
-6
@@ -21,6 +21,7 @@ import * as Semaphore from "effect/Semaphore";
21
import * as Stream from "effect/Stream";
22
import * as SubscriptionRef from "effect/SubscriptionRef";
23
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
24
+import * as ChildProcess from "effect/process/ChildProcess";
25
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
26
import * as NodeCrypto from "node:crypto";
27
import * as NodeFSP from "node:fs/promises";
@@ -642,15 +643,39 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
643
}
644
}).pipe(Effect.scoped);
645
yield* fs.remove(archivePath);
646
+ const executablePath = path.join(pairDirectory, asset.executable.name);
647
+ const harnessPath = path.join(pairDirectory, asset.harness.name);
648
if (platform !== "win32") {
646
- yield* fs.chmod(path.join(pairDirectory, asset.executable.name), 0o755);
647
- yield* fs.chmod(path.join(pairDirectory, asset.harness.name), 0o755);
649
+ yield* fs.chmod(executablePath, 0o755);
650
+ yield* fs.chmod(harnessPath, 0o755);
651
+ }
652
+ if (platform === "darwin" && arch === "x64") {
653
+ // Google signs the Intel build with the hardened runtime but no JIT entitlement, so
654
+ // libffi's writable+executable trampolines spin forever. Re-sign ad hoc after the hash check.
655
+ const exitCode = yield* spawner
656
+ .spawn(
657
+ ChildProcess.make(
658
+ "/usr/bin/codesign",
659
+ ["--force", "--sign", "-", executablePath, harnessPath],
660
+ { stdout: "ignore", stderr: "ignore" },
661
+ ),
662
+ )
663
+ .pipe(
664
+ Effect.flatMap((child) => child.exitCode),
665
+ Effect.scoped,
666
+ );
667
+ if (exitCode !== 0) {
668
+ return yield* installationError(
669
+ "extract",
670
+ "Could not prepare the Antigravity runtime for this Mac. Check that codesign is available.",
671
+ );
672
+ }
673
}
674
yield* report("verifying", "Checking the downloaded runtime.");
675
yield* validate(
676
{
652
- executablePath: path.join(pairDirectory, asset.executable.name),
653
- harnessPath: path.join(pairDirectory, asset.harness.name),
677
+ executablePath,
678
+ harnessPath,
679
source: "managed",
680
version: asset.version,
681
managedVersionDirectory: pairDirectory,
@@ -660,8 +685,11 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
685
const record: InstalledRelease = {
686
releaseId: asset.sha256,
687
version: asset.version,
663
- executable: asset.executable,
664
- harness: asset.harness,
688
+ executable: {
689
+ name: asset.executable.name,
690
+ bytes: Number((yield* fs.stat(executablePath)).size),
691
+ },
692
+ harness: { name: asset.harness.name, bytes: Number((yield* fs.stat(harnessPath)).size) },
693
};
694
yield* fs.writeFileString(
695
path.join(pairDirectory, RELEASE_RECORD),