Skip to content

Commit 38292c8

Browse files
fix(server): Antigravity install names network failures and 16 KiB-page kernels
Download transport, HTTP status and timeout failures now report a network problem instead of falling through to the disk-space catch-all. On linux-arm64, the installer checks getconf PAGESIZE before the ~308 MB download and refuses kernels with larger than 4 KiB pages, and a runtime that still aborts with Google's page-size check gets the same explanation. Fixes #34427 AI-assisted; verified with the tests and tools listed above.
1 parent 801d41c commit 38292c8

2 files changed

Lines changed: 51 additions & 6 deletions

File tree

‎apps/server/src/provider/AntigravityInstallation.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,25 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst
414414
}),
415415
);
416416

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+
417436
it.effect.each(["download", "extract", "active pointer"] as const)(
418437
"preserves the old runtime after an ENOSPC error during %s",
419438
(stage) =>

‎apps/server/src/provider/AntigravityInstallation.ts‎

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import * as Scope from "effect/Scope";
2121
import * as Semaphore from "effect/Semaphore";
2222
import * as Stream from "effect/Stream";
2323
import * as SubscriptionRef from "effect/SubscriptionRef";
24-
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
24+
import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/http";
2525
import * as ChildProcess from "effect/process/ChildProcess";
2626
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
2727
import * as NodeCrypto from "node:crypto";
@@ -46,6 +46,8 @@ const VALIDATION_TIMEOUT = "90 seconds";
4646
const FREE_SPACE_MARGIN = 256 * 1024 * 1024;
4747
const RECORD_MAX_BYTES = 8 * 1024;
4848
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.";
4951

5052
const ReleaseId = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/u));
5153
const ActiveRelease = Schema.Struct({ releaseId: ReleaseId });
@@ -458,10 +460,11 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
458460
Effect.provideService(SecureRandom.SecureRandom, random),
459461
Effect.mapError((cause) => {
460462
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
465468
: "The downloaded Antigravity runtime could not start in this environment.";
466469
return installationError("verify", detail, cause);
467470
}),
@@ -477,6 +480,18 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
477480
installationError("verify", nodeRuntimeUnavailableMessage("Antigravity"), cause),
478481
),
479482
);
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+
}
480495
const report = (phase: ProviderInstallState["phase"], message: string | null) =>
481496
SubscriptionRef.update(state, (current) => ({ ...current, phase, message }));
482497
yield* fs.makeDirectory(versionsDirectory, { recursive: true });
@@ -599,7 +614,18 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma
599614
),
600615
Stream.run(fs.sink(archivePath, { flag: "wx", mode: 0o600 })),
601616
);
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+
);
603629
if (downloadedBytes !== asset.archiveBytes || hash.digest("hex") !== asset.sha256) {
604630
return yield* installationError(
605631
"download",

0 commit comments

Comments
 (0)