mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 20:09:33 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Paperclip Runner executes Google Antigravity agents on local hosts and remote sandboxes > - Previously, Paperclip shipped two separate Google runtimes: an 853 MiB IDE-extension ACP bundle (`agy_acp_server.par` 1.5.2 + `localharness_external` + Python admission monkey-patch) for ordinary turns and a separate `agy` 1.5.15 CLI binary for local-only `/swarm` turns > - Because the legacy server lacked `/swarm` and the CLI path refused remote targets and required macOS Keychain or Linux user namespaces (`auto` mode), remote sandboxes could not run `/swarm` and carried 853 MiB of legacy binaries > - This pull request unifies all Antigravity surfaces (ordinary turns, `/swarm`, interactive sign-in, and model discovery) onto one pinned `agy` 1.5.19 CLI binary (`1.5.19-4821414830800896`) with file-backed OAuth isolation (`AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1`) and `--dangerously-skip-permissions` support for remote sandboxes > - The benefit is one 268 MiB Linux binary instead of 853 MiB (saving ~585 MiB in remote images), no Python runtime monkey-patching, full `/swarm` support on both local and remote hosts, and a unified 25-model catalog including Gemini 4 Neon, Carbon, Hydrogen, and Argon ## Linked Issues or Issue Description **What existing behavior does this improve?** The Google Antigravity Runner driver, provider pack materialization, Google sign-in flow, model discovery, and `/swarm` execution in `packages/paperclip-runner`, `packages/shared`, `server`, and `ui`. **Subsystem affected** Cross-cutting (multiple of the above) **Current behavior** Ordinary Antigravity turns use the legacy 1.5.2 IDE-extension ACP server (`agy_acp_server.par` + `localharness_external` + Python monkey-patch) at ~853 MiB on `linux-x64`. Native `/swarm` turns require a separate `agy` 1.5.15 CLI binary, refuse remote execution targets (`input.remote`), and fail on Linux sandboxes without user namespaces (`auto` mode). **Proposed behavior** All Antigravity flows use one pinned `agy` 1.5.19 binary (`1.5.19-4821414830800896`, ~268 MiB on `linux-x64`) across all four platforms (`darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`). Ordinary turns speak ACP directly through `openAntigravityAcpRuntime`. Both ordinary and `/swarm` turns stage file-backed OAuth tokens under `<agentHomeDirectory>/antigravity-cli/antigravity-oauth-token` with `AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1`, isolate from host keychains, and allow `/swarm` on remote targets using `--dangerously-skip-permissions`. Interactive Google sign-in runs `agy acp --login` with `https://antigravity.google/oauth-callback`, pre-creates `<home>/antigravity-cli` with mode `0700`, and prompts for the authorization code in the UI. **Reason and benefit** Unifying onto `agy` 1.5.19 cuts the `linux-x64` provider-pack footprint by ~585 MiB, removes Python bytecode patching from materialization, enables `/swarm` in headless Linux sandboxes without user namespaces or D-Bus, and aligns ordinary turns, model discovery, and `/swarm` on the same 25-model catalog. **Breaking changes** - `acpx-profiles.json` bumps `antigravity` to `agentProfileVersion: 3` (`native:antigravity-cli`, version `1.5.19`). Existing saved legacy 1.5.2 sessions fail closed as incompatible saved state and start fresh cleanly. - Existing Google OAuth connections carrying `client_secret` remain fully backward-compatible; new `agy acp --login` connections store canonical credentials with `auth_method: "consumer"` and no `client_secret`. ## What Changed - Pin `agy` `1.5.19-4821414830800896` across all four platforms (`darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`) in `antigravity-distributions.json`, `antigravity-cli-distributions.json`, `antigravity-cli-pins.ts`, and `acpx-profiles.json` (`agentProfileVersion: 3`), and regenerate TypeScript and Rust profile artifacts. - Replace ZIP + Python patch materialization with strict single-member `tar.gz` verification (`materialize-antigravity-distribution.mjs`, `provision-antigravity.mjs`, `probe-antigravity-metadata.mjs`, `candidate-provider-pack.mjs`, `release-provider-pack.mjs`). - Regenerate `packages/shared/src/antigravity-models.generated.ts` from `agy` 1.5.19 (25 models across 8 families, including Gemini 4 Neon, Carbon, Hydrogen, and Argon) and update `packages/shared/src/antigravity-models.ts` and `tests/runner-e2e/antigravity-qualification-cases.ts` for `xhigh` thinking levels. - Add direct ACP runtime `packages/paperclip-runner/src/drivers/acpx/antigravity-acp-runtime.ts` (`openAntigravityAcpRuntime`) for ordinary Antigravity turns with OAuth and `GEMINI_API_KEY` support, `session/new` + `session/resume`, `readOnly`/plan mode enforcement, HTTP and stdio MCP forwarding, live `setModel`, slash-command neutralization, refusal classification, cancellation, and lineage retirement; route ordinary Antigravity turns unconditionally in `acpx-runtime-adapter.ts` without an ACPX fallback seam. - Update `antigravity-auth.ts`, `antigravity-credentials.ts`, `antigravity-models.ts`, `antigravity-process.ts`, `runtime-host.ts`, and `runtime-sandbox.ts` to run `agy acp --login`, pre-create `<home>/antigravity-cli` with mode `0700` (preventing Go `os.MkdirAll` `0755` readback failures), force file-backed token storage (`AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1`), align `--gemini-dir` with `agentHomeDirectory`, bound model-discovery token sync cleanup, and scrub live CLI token files on cleanup. - Enable remote `/swarm` by removing the `input.remote` refusal in `server/src/services/antigravity-swarm.ts` and allowing `--dangerously-skip-permissions` + `default` mode in `antigravity-swarm-route.ts`, `antigravity-swarm-guard.ts`, and `antigravity-swarm-runtime.ts` when `permissionMode === "approve-all"`. - Update `ui/src/components/AdapterLoginChrome.tsx` copy to prompt for an authorization code (`Submit code`) for `https://antigravity.google/oauth-callback` while preserving callback URL handling for loopback redirects. - Add unit tests for `openAntigravityAcpRuntime`, direct Antigravity routing, `0700` token directory pre-creation, and hosted authorization-code login UX, and update Runner, script, shared, server, Rust, UI, and runner-e2e test suites for `agy` 1.5.19. ## Verification - Runner driver tests: `vitest run` across Antigravity driver test files (`antigravity-auth.test.ts`, `antigravity-models.test.ts`, `antigravity-acp-runtime.test.ts`, `antigravity-swarm-route.test.ts`, `codex-credentials.test.ts`, `acpx-runtime-adapter.test.ts`, `candidate-admission.test.ts`, `native-distribution-integrity.test.ts`) — all passing. - Runner script tests: `node --test` across all 7 Antigravity & provider-pack script suites — 98/98 passed. - Shared, UI, Server, and runner-e2e tests: `antigravity-models.test.ts`, `AdapterLoginChrome.test.tsx` (23/23), `antigravity-thread.test.tsx`, 23 server Antigravity/provider-pack suites, and 7 `runner-e2e` Antigravity suites — all passing. - Rust tests: `cargo test --manifest-path packages/paperclip-runner/runner/Cargo.toml --locked -p paperclip-runner-core -- acpx antigravity` — 145/145 passed. - Typechecks & generators: `@paperclipai/shared`, `@paperclipai/paperclip-runner` (TS + Rust), `@paperclipai/server` (all layers), `@paperclipai/ui`, `generate-acpx-profiles.mjs --check`, `generate-antigravity-models.mjs --check` — all passing. - Live E2E against real pinned `agy` 1.5.19 binaries (macOS `darwin-arm64`, headless Linux `linux-arm64` Docker with `--security-opt no-new-privileges`, and a live remote test deployment): - Verified `materialize-antigravity-distribution.mjs` on all 4 platform archives and `probe-antigravity-metadata.mjs` on macOS and headless Linux Docker. - Verified live Google OAuth sign-in end-to-end via `agy acp --login` + `https://antigravity.google/oauth-callback` authorization code exchange on a live remote deployment, creating a working Antigravity connection. - Verified `stageManagedAntigravityCredential` + `AGY_CLI_FORCE_FILE_TOKEN_STORAGE=1` file-backed isolation and cleanup scrub on macOS and headless Linux Docker. - Verified live `openAntigravityAcpRuntime` ordinary turn + HTTP MCP tool call + `_meta.antigravity.systemPrompt.append` + `setModel(gemini-4-argon-low)` + `session/resume` on real `agy` 1.5.19. - Verified live `openAntigravitySwarmRuntime` `/swarm` turn with `--dangerously-skip-permissions` spawning a real helper, writing workspace file, calling `paperclip_finish`, and retiring cleanly. ## Risks - **Coordinated Cloud deployment**: Remote sandboxes use the companion transition-safe Cloud update to expect `provider-assets/antigravity/linux-x64/agy`, accept `auth_method: "consumer"` credentials without `client_secret`, and scrub `antigravity-cli/antigravity-oauth-token`. - **Saved session continuity**: Existing saved 1.5.2 sessions fail closed as `ANTIGRAVITY_SAVED_STATE_INCOMPATIBLE` and start fresh cleanly on 1.5.19. ## Model Used - Google Gemini (Antigravity agentic coding assistant, reasoning/tool-use/code-execution enabled) ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
267 lines
13 KiB
JavaScript
267 lines
13 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { createHash } from "node:crypto";
|
|
import { EventEmitter } from "node:events";
|
|
import { chmod, copyFile, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { PassThrough } from "node:stream";
|
|
import { test } from "node:test";
|
|
import { pathToFileURL } from "node:url";
|
|
import { antigravityMetadataEnvironment, createAntigravityMetadataRpc } from "./probe-antigravity-metadata.mjs";
|
|
|
|
const sha256 = bytes => createHash("sha256").update(bytes).digest("hex");
|
|
const sha512 = bytes => createHash("sha512").update(bytes).digest("hex");
|
|
const response = {
|
|
protocolVersion: 1,
|
|
agentInfo: { name: "Antigravity ACP Server", title: "private-provider-text 🛰", version: "1.5.19" },
|
|
agentCapabilities: {
|
|
loadSession: true,
|
|
promptCapabilities: { image: true },
|
|
mcpCapabilities: { http: true },
|
|
sessionCapabilities: { list: {}, resume: {} },
|
|
auth: { logout: {} },
|
|
_meta: { antigravity: { tier: true, systemPrompt: { append: true } } },
|
|
},
|
|
authMethods: [{ id: "oauth-personal", name: "private-provider-text" }, { id: "gemini-api-key", name: "private-provider-text" }, { id: "untrusted-auth-method", name: "private-provider-text" }],
|
|
};
|
|
|
|
async function fixture(t, behavior = "success", { platform = "darwin", architecture = "arm64" } = {}) {
|
|
const target = `${platform}-${architecture}`;
|
|
const args = ["acp"];
|
|
const root = await mkdtemp(join(tmpdir(), "paperclip-antigravity-probe-test-"));
|
|
t.after(() => rm(root, { recursive: true, force: true }));
|
|
const scripts = join(root, "scripts");
|
|
await mkdir(scripts);
|
|
for (const name of ["materialize-antigravity-distribution.mjs", "antigravity-provisioner-layout.mjs", "probe-antigravity-metadata.mjs"]) {
|
|
await copyFile(new URL(name, import.meta.url), join(scripts, name));
|
|
}
|
|
const auditPath = join(root, "audit.json");
|
|
const script = `#!${process.execPath}
|
|
const { writeFileSync } = require('node:fs');
|
|
const { spawn } = require('node:child_process');
|
|
const behavior=${JSON.stringify(behavior)};
|
|
const result=${JSON.stringify(response)};
|
|
let buffer='';let descendant;
|
|
if(behavior==='ignore-stop') { process.on('SIGTERM',()=>{});setInterval(()=>{},1000); }
|
|
process.stdin.on('data',chunk=>{
|
|
buffer+=chunk;
|
|
if(!buffer.includes('\\n'))return;
|
|
const requests=buffer.trim().split('\\n').map(line=>JSON.parse(line));
|
|
writeFileSync(${JSON.stringify(auditPath)},JSON.stringify({pid:process.pid,argv:process.argv.slice(2),home:process.env.HOME,geminiHome:process.env.GEMINI_HOME,cwd:process.cwd(),env:process.env,requests}));
|
|
if(requests.length!==1||requests[0].method!=='initialize')process.exit(41);
|
|
if(behavior==='timeout')return;
|
|
if(behavior==='malformed')return process.stdout.write('not-json\\n');
|
|
if(behavior==='oversized')return process.stdout.write('x'.repeat(8192));
|
|
if(behavior==='stderr-limit')return process.stderr.write('sensitive'.repeat(8192));
|
|
if(behavior==='unexpected-method')return process.stdout.write(JSON.stringify({jsonrpc:'2.0',id:99,method:'authenticate',params:{token:'sensitive'}})+'\\n');
|
|
if(behavior==='wrong-version')result.agentInfo.version='1.4.2';
|
|
if(behavior==='wrong-identity')result.agentInfo.name='another-harness';
|
|
if(behavior==='wrong-protocol')result.protocolVersion=2;
|
|
if(behavior==='bad-capabilities')result.agentCapabilities=[];
|
|
if(behavior==='orphan-child') {
|
|
descendant=spawn(process.execPath,['-e',"setInterval(()=>{},1000)"],{stdio:'ignore'});
|
|
writeFileSync(${JSON.stringify(join(root, "descendant.json"))},JSON.stringify({pid:descendant.pid}));
|
|
}
|
|
const payload=JSON.stringify({jsonrpc:'2.0',id:1,result});
|
|
process.stderr.write('private-provider-text sensitive-secret\\n');
|
|
if(behavior==='truncated') { process.stdout.write(payload);process.exit(0); }
|
|
process.stdout.write(payload+'\\n'+(behavior==='extra-message'?'{}\\n':''));
|
|
});
|
|
process.stdin.on('end',()=>{if(behavior!=='ignore-stop')process.exit(0)});
|
|
`;
|
|
const content = Buffer.from(script);
|
|
const entries = [{ path: "agy", sha256: sha256(content), size: content.length, executable: true }];
|
|
const closureSha256 = sha256(JSON.stringify(entries));
|
|
const item = {
|
|
url: `https://storage.googleapis.com/antigravity-public/antigravity-cli/1.5.19-4821414830800896/${target}/fixture.tar.gz`,
|
|
archiveFormat: "tar.gz",
|
|
archiveSize: 1024,
|
|
archiveSha256: "a".repeat(64),
|
|
archiveSha512: "b".repeat(128),
|
|
archiveMember: "antigravity",
|
|
executable: "agy",
|
|
executableSha512: sha512(content),
|
|
closureSha256,
|
|
provisioning: "verified-closure",
|
|
args,
|
|
entries,
|
|
};
|
|
await writeFile(join(root, "antigravity-distributions.json"), JSON.stringify({
|
|
schema: "paperclip.antigravity_distribution.v1",
|
|
version: "1.5.19",
|
|
build: "1.5.19-4821414830800896",
|
|
environment: { AGY_CLI_DISABLE_AUTO_UPDATE: "1", AGY_CLI_FORCE_FILE_TOKEN_STORAGE: "1" },
|
|
platforms: { [target]: item },
|
|
}));
|
|
const home = join(root, "operator-home");
|
|
const runtime = join(home, ".paperclip/runtimes/antigravity", target, closureSha256);
|
|
await mkdir(runtime, { recursive: true, mode: 0o700 });
|
|
await writeFile(join(runtime, "agy"), content, { mode: 0o500 });
|
|
await writeFile(join(runtime, ".paperclip-antigravity-closure.json"), JSON.stringify({
|
|
schema: "paperclip.antigravity_closure.v1",
|
|
version: "1.5.19",
|
|
build: "1.5.19-4821414830800896",
|
|
archiveSha256: item.archiveSha256,
|
|
archiveSha512: item.archiveSha512,
|
|
closureSha256,
|
|
entries,
|
|
}), { mode: 0o400 });
|
|
const api = await import(pathToFileURL(join(scripts, "probe-antigravity-metadata.mjs")));
|
|
return {
|
|
root, runtime, auditPath,
|
|
probe: options => api.probeAntigravityMetadata({ home, platform, architecture, startupTimeoutMs: 2_000, eofTimeoutMs: 60, terminateTimeoutMs: 60, killTimeoutMs: 250, ...options }),
|
|
};
|
|
}
|
|
|
|
test("probe environment has only explicit sterile settings and cannot inherit credentials", () => {
|
|
const env = antigravityMetadataEnvironment("/isolated", "/verified/runtime");
|
|
assert.equal(env.HOME, "/isolated/home");
|
|
assert.equal(env.GEMINI_HOME, "/isolated/gemini");
|
|
assert.equal(env.AGY_CLI_FORCE_FILE_TOKEN_STORAGE, "1");
|
|
assert.equal(env.AGY_CLI_DISABLE_AUTO_UPDATE, "1");
|
|
assert.deepEqual(Object.keys(env).sort(), [
|
|
"AGY_CLI_DISABLE_AUTO_UPDATE",
|
|
"AGY_CLI_FORCE_FILE_TOKEN_STORAGE",
|
|
"GEMINI_HOME",
|
|
"HOME",
|
|
"LANG",
|
|
"NO_COLOR",
|
|
"PATH",
|
|
"TMPDIR",
|
|
"XDG_CACHE_HOME",
|
|
"XDG_CONFIG_HOME",
|
|
"XDG_DATA_HOME",
|
|
]);
|
|
});
|
|
|
|
test("initialize uses Paperclip identity, preserves split UTF-8 and cannot send another method", async () => {
|
|
const child = Object.assign(new EventEmitter(), { stdout: new PassThrough(), stderr: new PassThrough(), stdin: new PassThrough() });
|
|
let request = "";
|
|
child.stdin.on("data", chunk => { request += chunk; });
|
|
const rpc = createAntigravityMetadataRpc(child);
|
|
const pending = rpc.initialize();
|
|
const payload = Buffer.from(`${JSON.stringify({ jsonrpc: "2.0", id: 1, result: response })}\n`);
|
|
const split = payload.indexOf(Buffer.from("🛰")) + 1;
|
|
child.stdout.write(payload.subarray(0, split));
|
|
child.stdout.write(payload.subarray(split));
|
|
assert.equal((await pending).agentInfo.title, response.agentInfo.title);
|
|
assert.deepEqual(JSON.parse(request).params.clientInfo, { name: "paperclip-runner", title: "Paperclip Runner", version: "1" });
|
|
assert.throws(() => rpc.initialize(), /only be sent once/);
|
|
rpc.close();
|
|
});
|
|
|
|
test("invalid UTF-8 is rejected instead of silently replacing wire bytes", async () => {
|
|
const child = Object.assign(new EventEmitter(), { stdout: new PassThrough(), stderr: new PassThrough(), stdin: new PassThrough() });
|
|
const rpc = createAntigravityMetadataRpc(child);
|
|
const pending = rpc.initialize();
|
|
child.stdout.write(Buffer.from([0xff, 0x0a]));
|
|
await assert.rejects(pending, /malformed_utf8/);
|
|
rpc.close();
|
|
});
|
|
|
|
test("real stdio probe sends initialize only, sanitizes metadata and removes its isolated profile", async t => {
|
|
const current = await fixture(t);
|
|
const output = await current.probe();
|
|
const audit = JSON.parse(await readFile(current.auditPath, "utf8"));
|
|
assert.deepEqual(audit.requests.map(request => request.method), ["initialize"]);
|
|
assert.equal(audit.env.AGY_CLI_FORCE_FILE_TOKEN_STORAGE, "1");
|
|
assert.equal(audit.env.AGY_CLI_DISABLE_AUTO_UPDATE, "1");
|
|
assert.equal(audit.env.GEMINI_API_KEY, undefined);
|
|
assert.equal(audit.env.GOOGLE_APPLICATION_CREDENTIALS, undefined);
|
|
assert.equal(audit.env.NODE_OPTIONS, undefined);
|
|
assert.notEqual(audit.home, process.env.HOME);
|
|
assert.notEqual(audit.geminiHome, process.env.GEMINI_HOME);
|
|
await assert.rejects(readFile(join(audit.home, "anything")), { code: "ENOENT" });
|
|
await assert.rejects(readFile(audit.cwd), { code: "ENOENT" });
|
|
assert.deepEqual(output.authMethodIds, ["oauth-personal", "gemini-api-key"]);
|
|
assert.equal(output.agentInfo.version, "1.5.19");
|
|
assert.equal(output.promptRequestsSent, 0);
|
|
assert.equal(output.shutdown.exitCode, 0);
|
|
assert.equal(output.shutdown.method, "eof");
|
|
assert.doesNotMatch(JSON.stringify(output), /sensitive|private-provider-text|paperclip-antigravity-metadata-/);
|
|
});
|
|
|
|
test("identity, version and protocol mismatches are rejected with sanitized diagnostics", async t => {
|
|
for (const [behavior, error] of [
|
|
["wrong-version", /version_mismatch/],
|
|
["wrong-identity", /identity_mismatch/],
|
|
["wrong-protocol", /identity_mismatch/],
|
|
["bad-capabilities", /malformed_initialize_capabilities/],
|
|
]) {
|
|
const current = await fixture(t, behavior);
|
|
await assert.rejects(current.probe(), error);
|
|
}
|
|
});
|
|
|
|
test("malformed, oversized, truncated and unexpected protocol streams fail closed", async t => {
|
|
for (const [behavior, error] of [
|
|
["malformed", /malformed_json/],
|
|
["oversized", /stdout_limit/],
|
|
["stderr-limit", /stderr_limit/],
|
|
["unexpected-method", /unexpected_message/],
|
|
["truncated", /truncated_stream/],
|
|
["extra-message", /unexpected_message/],
|
|
]) {
|
|
const current = await fixture(t, behavior);
|
|
await assert.rejects(current.probe({ maxBytes: 4096 }), error);
|
|
}
|
|
});
|
|
|
|
test("startup deadline retires the native process and isolated profile", async t => {
|
|
const current = await fixture(t, "timeout");
|
|
await assert.rejects(current.probe({ startupTimeoutMs: 600 }), /initialize_timeout/);
|
|
const audit = JSON.parse(await readFile(current.auditPath, "utf8"));
|
|
assert.throws(() => process.kill(audit.pid, 0), { code: "ESRCH" });
|
|
await assert.rejects(readFile(audit.cwd), { code: "ENOENT" });
|
|
});
|
|
|
|
test("SIGKILL bounds shutdown when native work ignores EOF and SIGTERM", async t => {
|
|
const current = await fixture(t, "ignore-stop");
|
|
const output = await current.probe();
|
|
const audit = JSON.parse(await readFile(current.auditPath, "utf8"));
|
|
assert.equal(output.shutdown.method, "sigkill");
|
|
assert.equal(output.shutdown.signal, "SIGKILL");
|
|
assert.throws(() => process.kill(audit.pid, 0), { code: "ESRCH" });
|
|
});
|
|
|
|
test("shutdown retires an owned child after its native parent exits", async t => {
|
|
const current = await fixture(t, "orphan-child");
|
|
try { await current.probe(); }
|
|
catch (error) {
|
|
assert.equal(process.platform, "darwin");
|
|
assert.match(error.message, /^antigravity_process_group_check_failed:EPERM$/);
|
|
}
|
|
const descendant = JSON.parse(await readFile(join(current.root, "descendant.json"), "utf8"));
|
|
assert.throws(() => process.kill(descendant.pid, 0), { code: "ESRCH" });
|
|
});
|
|
|
|
test("tampered cache fails verification before any native process starts", async t => {
|
|
const current = await fixture(t);
|
|
const binary = join(current.runtime, "agy");
|
|
await chmod(binary, 0o700);
|
|
await writeFile(binary, "corrupt");
|
|
await assert.rejects(current.probe(), /full execution closure digest mismatch/);
|
|
await assert.rejects(readFile(current.auditPath), { code: "ENOENT" });
|
|
});
|
|
|
|
test("invalid startup or shutdown limits fail before any native process starts", async t => {
|
|
const current = await fixture(t);
|
|
for (const options of [{ startupTimeoutMs: 0 }, { startupTimeoutMs: 30_001 }, { maxBytes: 1024 * 1024 + 1 }, { eofTimeoutMs: -1 }, { killTimeoutMs: 5_001 }]) {
|
|
await assert.rejects(current.probe(options), /Invalid Antigravity metadata probe limits/);
|
|
}
|
|
await assert.rejects(readFile(current.auditPath), { code: "ENOENT" });
|
|
});
|
|
|
|
test("a Linux closure probe starts the pinned executable with its declared arguments", async t => {
|
|
const current = await fixture(t, "success", { platform: "linux", architecture: "x64" });
|
|
const output = await current.probe();
|
|
const audit = JSON.parse(await readFile(current.auditPath, "utf8"));
|
|
assert.equal(audit.argv[0], "acp");
|
|
assert.equal(audit.argv[1], "--gemini-dir");
|
|
assert.equal(audit.argv[3], "--disable-telemetry");
|
|
assert.deepEqual(audit.requests.map(request => request.method), ["initialize"]);
|
|
assert.equal(output.platform, "linux");
|
|
assert.equal(output.architecture, "x64");
|
|
assert.equal(output.agentInfo.version, "1.5.19");
|
|
});
|