@devries-cameron20 / t3code Mirror · read-only / commits / 88a779defe
Fork 0

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, 23:15 UTC

fix(server): Antigravity can reach Google on NixOS (#20551)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Felix Laga committed Oct 20, 2026 at 13:24 UTC 88a779defe85e0f3253e98305867ff1d4a86f152
2 files changed +104
apps/server/src/provider/antigravityAuthSupport.test.ts
+76
@@ -556,6 +556,82 @@ describe("Antigravity stderr compatibility", () => {
556 });
557
558 it.layer(NodeServices.layer)("Antigravity profile preparation", (it) => {
559 + const prepareSpawn = Effect.fn(function* (
560 + bundles: ReadonlyArray<string>,
561 + baseEnv: NodeJS.ProcessEnv = {},
562 + platform: NodeJS.Platform = "linux",
563 + ) {
564 + const fs = yield* FileSystem.FileSystem;
565 + const path = yield* Path.Path;
566 + const directory = yield* fs.makeTempDirectoryScoped();
567 + const profile = yield* prepareAntigravityProfile({
568 + profileDirectory: path.join(directory, "profile"),
569 + userHome: path.join(directory, "home"),
570 + runtimeExecutablePath: process.execPath,
571 + platform,
572 + baseEnv,
573 + }).pipe(
574 + Effect.provideService(FileSystem.FileSystem, {
575 + ...fs,
576 + exists: (candidate) => Effect.succeed(bundles.includes(candidate)),
577 + }),
578 + );
579 + return buildAntigravityAcpSpawnInput({
580 + installation: { executablePath: "/release/acp", harnessPath: "/release/harness" },
581 + profile,
582 + cwd: directory,
583 + baseEnv,
584 + }).env;
585 + });
586 +
587 + // A Windows Node path cannot preflight the browser helper as a POSIX host.
588 + const caTest = it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32");
589 +
590 + caTest(
591 + "launches Linux agents with the first available CA bundle, preferring absolute Nix paths",
592 + () =>
593 + Effect.gen(function* () {
594 + const systemBundles = ["/etc/pki/tls/certs/ca-bundle.crt", "/etc/ssl/cert.pem"];
595 + const nixBundle = "/nix/store/nss-cacert/etc/ssl/certs/ca-bundle.crt";
596 + expect((yield* prepareSpawn(systemBundles))?.SSL_CERT_FILE).toBe(systemBundles[0]);
597 + expect(
598 + (yield* prepareSpawn([nixBundle, ...systemBundles], { NIX_SSL_CERT_FILE: nixBundle }))
599 + ?.SSL_CERT_FILE,
600 + ).toBe(nixBundle);
601 + expect(
602 + (yield* prepareSpawn(systemBundles, { NIX_SSL_CERT_FILE: nixBundle }))?.SSL_CERT_FILE,
603 + ).toBe(systemBundles[0]);
604 + expect(
605 + (yield* prepareSpawn(["certs/local.pem", ...systemBundles], {
606 + NIX_SSL_CERT_FILE: "certs/local.pem",
607 + }))?.SSL_CERT_FILE,
608 + ).toBe(systemBundles[0]);
609 + expect((yield* prepareSpawn([]))?.SSL_CERT_FILE).toBeUndefined();
610 + }),
611 + );
612 +
613 + caTest("preserves explicit certificate files and directories in Linux launches", () =>
614 + Effect.gen(function* () {
615 + const bundles = ["/etc/ssl/certs/ca-certificates.crt"];
616 + expect(
617 + (yield* prepareSpawn(bundles, { SSL_CERT_FILE: "/custom/ca.pem" }))?.SSL_CERT_FILE,
618 + ).toBe("/custom/ca.pem");
619 + const directoryEnv = yield* prepareSpawn(bundles, { SSL_CERT_DIR: "/custom/certs" });
620 + expect(directoryEnv?.SSL_CERT_DIR).toBe("/custom/certs");
621 + expect(directoryEnv?.SSL_CERT_FILE).toBeUndefined();
622 + }),
623 + );
624 +
625 + caTest("leaves non-Linux certificate defaults unchanged even when a bundle exists", () =>
626 + Effect.gen(function* () {
627 + const bundle = "/etc/ssl/certs/ca-certificates.crt";
628 + for (const platform of ["darwin", "win32"] as const) {
629 + const env = yield* prepareSpawn([bundle], { NIX_SSL_CERT_FILE: bundle }, platform);
630 + expect(env?.SSL_CERT_FILE).toBeUndefined();
631 + }
632 + }),
633 + );
634 +
635 it.effect("runs the browser helper with installed Node in standalone builds", () =>
636 Effect.gen(function* () {
637 const fs = yield* FileSystem.FileSystem;
apps/server/src/provider/antigravityAuthSupport.ts
+28
@@ -87,6 +87,7 @@ export interface AntigravityProfile {
87 readonly tokenPath: string;
88 readonly tempDirectory: string;
89 readonly browserCommand: string;
90 + readonly caBundlePath?: string;
91 }
92
93 export interface AntigravityAuthConfig {
@@ -221,6 +222,11 @@ function antigravityEnvironment(
222 return {
223 ...environment,
224 ...credential,
225 + ...(profile.caBundlePath !== undefined &&
226 + baseEnv.SSL_CERT_FILE === undefined &&
227 + baseEnv.SSL_CERT_DIR === undefined
228 + ? { SSL_CERT_FILE: profile.caBundlePath }
229 + : {}),
230 GEMINI_HOME: profile.geminiHome,
231 AGY_ACP_FORCE_FILE_STORAGE: "1",
232 BROWSER: profile.browserCommand,
@@ -327,6 +333,27 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(
333 const geminiHome = path.resolve(input.profileDirectory);
334 const acpDirectory = path.join(geminiHome, "antigravity-acp");
335 const tempDirectory = input.tempDirectory ?? path.join(acpDirectory, "tmp");
336 + let caBundlePath: string | undefined;
337 + if (platform === "linux") {
338 + // Bundled Python may look for certificates at paths absent on this distribution.
339 + // Relative paths would resolve differently when the agent runs in the project directory.
340 + for (const candidate of [
341 + (input.baseEnv ?? process.env).NIX_SSL_CERT_FILE,
342 + "/etc/ssl/certs/ca-bundle.crt",
343 + "/etc/ssl/certs/ca-certificates.crt",
344 + "/etc/pki/tls/certs/ca-bundle.crt",
345 + "/etc/ssl/cert.pem",
346 + ]) {
347 + if (
348 + candidate &&
349 + path.isAbsolute(candidate) &&
350 + (yield* fs.exists(candidate).pipe(Effect.orElseSucceed(() => false)))
351 + ) {
352 + caBundlePath = candidate;
353 + break;
354 + }
355 + }
356 + }
357 const profile: AntigravityProfile = {
358 platform,
359 geminiHome,
@@ -334,6 +361,7 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(
361 tokenPath: path.join(acpDirectory, "acp_token.json"),
362 tempDirectory,
363 browserCommand,
364 + ...(caBundlePath === undefined ? {} : { caBundlePath }),
365 };
366 const environment = antigravityEnvironment(profile, input.baseEnv ?? process.env, auth);
367 yield* Effect.gen(function* () {