@devries-cameron20 / t3code Mirror · read-only / commits / cf65084c97
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 21, 21:00 UTC

fix(server): Antigravity install names network failures and 16 KiB-page kernels (#34486)

Julius Marminge committed Nov 11, 2026 at 16:01 UTC cf65084c979a0376f8a62ec95e17fd400e8d9b24
2 files changed +123 -17
apps/server/src/provider/AntigravityInstallation.test.ts
+91 -11
@@ -17,7 +17,7 @@ import * as Schema from "effect/Schema";
17 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";
20 +import { HttpClient, HttpClientError, HttpClientResponse } from "effect/http";
21 import * as ChildProcess from "effect/process/ChildProcess";
22 import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
23
@@ -126,6 +126,7 @@ interface HarnessOptions {
126 readonly spawner?: ChildProcessSpawner.ChildProcessSpawner["Service"];
127 readonly validate?: AntigravityInstallation.AntigravityInstallationOptions["validate"];
128 readonly useDefaultValidation?: boolean;
129 + readonly connectTimeout?: boolean;
130 }
131
132 const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
@@ -188,8 +189,18 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
189 Effect.provideService(
190 HttpClient.HttpClient,
191 HttpClient.make((request) =>
191 - Effect.sync(() => {
192 + Effect.suspend(() => {
193 requests.push(request.url);
194 + if (options.connectTimeout) {
195 + return Effect.fail(
196 + new HttpClientError.HttpClientError({
197 + reason: new HttpClientError.TransportError({
198 + request,
199 + cause: new Error("Connect Timeout Error (attempted address: dl.google.com:443)"),
200 + }),
201 + }),
202 + );
203 + }
204 const response = HttpClientResponse.fromWeb(
205 request,
206 new Response(null, {
@@ -203,15 +214,17 @@ const makeHarness = Effect.fn("test.makeAntigravityInstallation")(function* (
214 },
215 }),
216 );
206 - return Object.defineProperty(response, "stream", {
207 - value:
208 - options.body ??
209 - Stream.make(
210 - archive.subarray(0, 31),
211 - archive.subarray(31, 149),
212 - archive.subarray(149),
213 - ),
214 - });
217 + return Effect.succeed(
218 + Object.defineProperty(response, "stream", {
219 + value:
220 + options.body ??
221 + Stream.make(
222 + archive.subarray(0, 31),
223 + archive.subarray(31, 149),
224 + archive.subarray(149),
225 + ),
226 + }),
227 + );
228 }),
229 ),
230 ),
@@ -353,6 +366,73 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
366 }),
367 );
368
369 + it.effect(
370 + "names the connection failure instead of disk space when the download cannot connect",
371 + () =>
372 + Effect.gen(function* () {
373 + const { installation, validations } = yield* makeHarness({ connectTimeout: true });
374 + yield* installation.start;
375 + const state = yield* terminalState(installation);
376 + expect(state.phase).toBe("failed");
377 + expect(state.message).not.toMatch(/disk space/i);
378 + expect(state.message).toMatch(/connect|network|download/i);
379 + expect(validations).toEqual([]);
380 + }),
381 + );
382 +
383 + // The runtime's own abort is a real process; Windows has no POSIX sh.
384 + it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
385 + "explains that the linux-arm64 runtime needs 4 KiB pages when it aborts on a 16 KiB kernel",
386 + () =>
387 + Effect.gen(function* () {
388 + const realSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
389 + // Google's linux-arm64 build aborts like this on Asahi and Raspberry Pi 5 kernels.
390 + const spawner = ChildProcessSpawner.make((command) =>
391 + ChildProcess.isStandardCommand(command) &&
392 + String(command.command).endsWith(executableName)
393 + ? realSpawner.spawn(
394 + ChildProcess.make(
395 + "sh",
396 + [
397 + "-c",
398 + "echo 'F1111 11:50:12.383176 page-size.cc:19] Check failed: sysconf(_SC_PAGE_SIZE) == kPageSize (16384 vs. 4096) Compile-time page size does not match runtime page size' >&2; kill -ABRT $$",
399 + ],
400 + { stdin: "pipe", stdout: "pipe", stderr: "pipe" },
401 + ),
402 + )
403 + : realSpawner.spawn(command),
404 + );
405 + const { installation } = yield* makeHarness({
406 + arch: "arm64",
407 + useDefaultValidation: true,
408 + spawner,
409 + });
410 + yield* installation.start;
411 + const state = yield* terminalState(installation);
412 + expect(state.phase).toBe("failed");
413 + expect(state.message).toMatch(/page/i);
414 + }),
415 + );
416 +
417 + it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
418 + "refuses a 16 KiB-page linux-arm64 kernel before downloading the runtime",
419 + () =>
420 + Effect.gen(function* () {
421 + const realSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
422 + const spawner = ChildProcessSpawner.make((command) =>
423 + ChildProcess.isStandardCommand(command) && command.command === "getconf"
424 + ? realSpawner.spawn(ChildProcess.make("sh", ["-c", "echo 16384"], command.options))
425 + : realSpawner.spawn(command),
426 + );
427 + const { installation, requests } = yield* makeHarness({ arch: "arm64", spawner });
428 + yield* installation.start;
429 + const state = yield* terminalState(installation);
430 + expect(state.phase).toBe("failed");
431 + expect(state.message).toMatch(/4 KiB/);
432 + expect(requests).toEqual([]);
433 + }),
434 + );
435 +
436 it.effect.each(["download", "extract", "active pointer"] as const)(
437 "preserves the old runtime after an ENOSPC error during %s",
438 (stage) =>
apps/server/src/provider/AntigravityInstallation.ts
+32 -6
@@ -21,7 +21,7 @@ import * as Scope from "effect/Scope";
21 import * as Semaphore from "effect/Semaphore";
22 import * as Stream from "effect/Stream";
23 import * as SubscriptionRef from "effect/SubscriptionRef";
24 -import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
24 +import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/http";
25 import * as ChildProcess from "effect/process/ChildProcess";
26 import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
27 import * as NodeCrypto from "node:crypto";
@@ -46,6 +46,8 @@ const VALIDATION_TIMEOUT = "90 seconds";
46 const FREE_SPACE_MARGIN = 256 * 1024 * 1024;
47 const RECORD_MAX_BYTES = 8 * 1024;
48 const RELEASE_RECORD = ".install-complete.json";
49 +const LARGE_PAGE_KERNEL_MESSAGE =
50 + "Google's linux-arm64 Antigravity runtime needs a kernel with 4 KiB memory pages, and this kernel uses larger pages (as on Asahi Linux or Raspberry Pi 5). Use a remote environment or a custom Antigravity executable.";
51
52 const ReleaseId = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u));
53 const ActiveRelease = Schema.Struct({ releaseId: ReleaseId });
@@ -458,10 +460,11 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
460 Effect.provideService(SecureRandom.SecureRandom, random),
461 Effect.mapError((cause) => {
462 if (isInstallationError(cause)) return cause;
461 - const detail =
462 - isAcpProcessExitedError(cause) &&
463 - /\b(?:AF_INET6|enforce_kernel_ipv6_support)\b/.test(cause.stderr ?? "")
464 - ? "Antigravity requires IPv6 socket support. Enable IPv6 in this environment. On WSL, remove ipv6.disable=1 from .wslconfig and run wsl --shutdown."
463 + const stderr = isAcpProcessExitedError(cause) ? (cause.stderr ?? "") : "";
464 + const detail = /\b(?:AF_INET6|enforce_kernel_ipv6_support)\b/.test(stderr)
465 + ? "Antigravity requires IPv6 socket support. Enable IPv6 in this environment. On WSL, remove ipv6.disable=1 from .wslconfig and run wsl --shutdown."
466 + : /page-size\.cc|Compile-time page size does not match/.test(stderr)
467 + ? LARGE_PAGE_KERNEL_MESSAGE
468 : "The downloaded Antigravity runtime could not start in this environment.";
469 return installationError("verify", detail, cause);
470 }),
@@ -477,6 +480,18 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
480 installationError("verify", nodeRuntimeUnavailableMessage("Antigravity"), cause),
481 ),
482 );
483 + if (platform === "linux" && arch === "arm64") {
484 + const pageSize = yield* spawner
485 + .string(ChildProcess.make("getconf", ["PAGESIZE"], { stdin: "ignore", stderr: "ignore" }))
486 + .pipe(
487 + Effect.map((output) => Number(output.trim())),
488 + Effect.timeout("5 seconds"),
489 + Effect.orElseSucceed(() => Number.NaN),
490 + );
491 + if (pageSize > 4096) {
492 + return yield* installationError("download", LARGE_PAGE_KERNEL_MESSAGE);
493 + }
494 + }
495 const report = (phase: ProviderInstallState["phase"], message: string | null) =>
496 SubscriptionRef.update(state, (current) => ({ ...current, phase, message }));
497 yield* fs.makeDirectory(versionsDirectory, { recursive: true });
@@ -599,7 +614,18 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
614 ),
615 Stream.run(fs.sink(archivePath, { flag: "wx", mode: 0o600 })),
616 );
602 - }).pipe(Effect.timeout(DOWNLOAD_TIMEOUT));
617 + }).pipe(
618 + Effect.timeout(DOWNLOAD_TIMEOUT),
619 + Effect.mapError((cause) =>
620 + HttpClientError.isHttpClientError(cause) || Cause.isTimeoutError(cause)
621 + ? installationError(
622 + "download",
623 + "Could not download Antigravity from Google. Check the network connection and any proxy settings, then try again.",
624 + cause,
625 + )
626 + : cause,
627 + ),
628 + );
629 if (downloadedBytes !== asset.archiveBytes || hash.digest("hex") !== asset.sha256) {
630 return yield* installationError(
631 "download",