Files
PaperClipAI/packages/paperclip-runner/scripts/release-provider-pack.test.mjs
T
DottaandPaperclip c5107f12fe feat(runner): flip Google Antigravity ACPX profile to qualified (#22939)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Paperclip Runner executes native ACPX providers using
release-verified profiles, capability declarations, and provider packs
> - Google Antigravity is wired across Runner, server routes, UI
pickers, and remote provider packs, but its ACPX profile remained
`qualificationStatus: "pending"` behind operator candidate grants
> - The owner waived the paid-key `runner-e2e-paid` gate on 2026-11-25
so Google Antigravity can ship to staging and be tested there live
> - This pull request flips the Google Antigravity ACPX profile from
`pending` to `qualified` (profile revision 2), updates its capability
declaration while keeping `recovery: "unverified"`, enables ordinary
server/UI/pack admission without candidate grants, and updates tests and
qualification docs honestly
> - The benefit is that Google Antigravity enters the default
`linux-x64` remote provider pack and ordinary board setup/execution
flows on staging, while candidate-era v1 saved sessions are cleanly
rejected and unverified recovery/paid-key evidence remains honestly
labeled

## Linked Issues or Issue Description

Refs #22923
Refs #22935 (merge after #22935
`fix/per-turn-harness-on-warm-environment`)

**What existing behavior does this improve?**
Google Antigravity native ACPX profile qualification, remote
provider-pack assembly, and Paperclip Runner agent setup/admission
across `packages/paperclip-runner`, `packages/adapter-utils`,
`packages/adapters/codex-local`, `server`, `ui`, and `tests/runner-e2e`.

**Subsystem affected**
Cross-cutting (multiple of the above)

**Current behavior**
`packages/paperclip-runner/acpx-profiles.json` declares `antigravity` at
`agentProfileVersion: 1` with `qualificationStatus: "pending"`.
`PAPERCLIP_RUNNER_ACPX_PROFILES` marks `antigravity.qualified = false`,
remote `linux-x64` provider packs exclude Antigravity unless built with
`--candidate-providers=antigravity`, and server/Runner admission
requires a short-lived operator candidate grant.

**Proposed behavior**
Remove `qualificationStatus: "pending"` from `antigravity` and bump
`agentProfileVersion` from `1` to `2` so candidate-era v1 saved state is
refused permanently as `provider_state_incompatible`. Flip
`PAPERCLIP_RUNNER_ACPX_PROFILES.antigravity.qualified` to `true`, mark
`ACPX_CAPABILITY_PROFILES.antigravity` as `qualified` with `models:
"explicit-provider-verified"` while keeping `recovery: "unverified"`,
require an explicit provider model in config builders and server
validation, and admit qualified Antigravity through the ordinary ACPX
path without candidate grants.

**Reason and benefit**
Unblocks staging deployment and live testing of Google Antigravity under
the 2026-11-25 owner waiver of `runner-e2e-paid`, including default
`linux-x64` provider pack inclusion (local `darwin-arm64` continues to
use `paperclipai runtime setup antigravity`).

**Breaking changes**
Any candidate-era v1 Google Antigravity saved session state is
intentionally refused as `provider_state_incompatible` due to the
`agentProfileVersion` bump (`1` -> `2`).

## What Changed

- **Runner profile & generated contracts**:
- `packages/paperclip-runner/acpx-profiles.json`: removed
`qualificationStatus: "pending"` on `antigravity` and bumped
`agentProfileVersion` from `1` to `2`.
- Regenerated
`packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts` and
`packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs`
(`qualification_pending: false`).
- `packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts`:
set `antigravity.qualification` to `"qualified"` and `models` to
`"explicit-provider-verified"` when released; kept `recovery:
"unverified"` (never claiming `session-load` without live proof).
- **Adapter utils & config builder**:
- `packages/adapter-utils/src/paperclip-runner-permissions.ts`: flipped
`PAPERCLIP_RUNNER_ACPX_PROFILES.antigravity.qualified` to `true`.
- `packages/adapters/codex-local/src/ui/build-config.ts`: added
`"antigravity"` to the explicit-provider-model validation check.
- **Server admission & routes**:
- `server/src/services/native-runtime/provider-profile.ts`: added
`antigravity: null` to `DEFAULT_ACPX_RUNNER_MODELS`, included
`antigravity` in explicit-model-required and qualified ACPX checks.
- `server/src/services/native-runtime/acpx-qualification.ts`:
short-circuited `resolveAntigravityCandidateAdmission` to return
`undefined` once `qualificationStatus !== "pending"`.
- `server/src/routes/agents.ts`: allowed qualified `antigravity` without
`experimental.enableNativeRunner` (matching Copilot and UI rules),
preserved empty model on provisional setup draft transitions, and
allowed `setupOnly` draft creation before model selection.
- **Tests**:
- Updated Runner TS/Rust tests (`profile-compatibility.test.ts`,
`candidate-provider-pack.test.mjs`, `release-provider-pack.test.mjs`,
`antigravity-provider-pack-smoke.test.mjs`,
`candidate-admission*.test.ts`, `antigravity-models.test.ts`,
`acpx-runtime-sidecar.test.ts`, `runner-core` Rust unit/integration
tests).
- Updated `@paperclipai/adapter-utils`,
`@paperclipai/adapter-codex-local`, `@paperclipai/server`,
`@paperclipai/ui`, and `tests/runner-e2e` (`catalog.test.ts`,
`controller-rolling-deployment.test.ts`) tests for qualified Antigravity
behavior.
- **Documentation & maps**:
- `doc/plans/2026-11-22-antigravity-qualification.md`,
`doc/plans/2026-11-25-antigravity-cloud-rollout.md`, and
`packages/paperclip-runner/README.md`: recorded the 2026-11-25 owner
waiver of `runner-e2e-paid` for staging verification while keeping all
`NOT RUN` paid-key rows honestly marked `NOT RUN` / deferred.
- Minimal in-place accuracy updates in
`maps/feature-map/instance-operations.md` and
`maps/agent-access-map/instance-operations.md` (`node
scripts/check-maps.mjs` passing).

## Verification

- `pnpm --filter @paperclipai/paperclip-runner build` (TS + Rust release
binary + `check:acpx-profiles`, `generate-antigravity-models --check`,
`check:protocol-types`,
capability/attestation/traceability/replay-golden checks) — passed.
- `pnpm --filter @paperclipai/paperclip-runner test:typescript:prep`
(468 tests) and focused Runner Vitest suites
(`acpx-runtime-sidecar.test.ts` 127/127, `antigravity-models.test.ts`
22/22, `candidate-admission*.test.ts`, `profile-compatibility.test.ts`,
`runnerd-codex-transport-antigravity-release.test.ts`, pack script
tests) — passed.
- Rust tests in `packages/paperclip-runner/runner`: `cargo fmt --all --
--check`, `paperclip_process_table` (3/3), `paperclip_runner_core --lib`
(670/670, skipping macOS-incompatible `task_memory::tests::monitor_*`),
`paperclip-runnerd` bin tests (11/11), and `acpx_provider_resolutions`
(12/12) — passed.
- `packages/adapter-utils` (`paperclip-runner-permissions.test.ts`
50/50) and `packages/adapters/codex-local` (`build-config.test.ts`
64/64) — passed.
- `scripts/__tests__/prepare-runner-release-image.test.mjs`, `node
scripts/check-maps.mjs`, and `node
tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --check` — passed.
- Server suites: `adapter-routes.test.ts` (36/36), `registry.test.ts`
(67/67), `agent-adapter-validation-routes.test.ts` (`Antigravity|YAML`),
`antigravity-connection-probe.test.ts`,
`antigravity-save-refusal.test.ts`, `antigravity-release.test.ts`
(10/10), `acpx-qualification.test.ts` (39/39),
`antigravity-candidate-admission.test.ts`,
`remote-provider-pack.test.ts` (60/60),
`native-session-executor.test.ts` (`Antigravity|provider pack`),
`plugin-runner-credentials.test.ts`,
`plugin-runner-credential-names.test.ts`,
`antigravity-plugin-task-credential-writeback.test.ts` — passed.
- CLI (`runtime.test.ts`, `runtime-setup.test.ts` 15/15), UI (6
Antigravity/setup suites 58/58 + `AgentConfigForm.render.test.tsx`), and
`tests/runner-e2e` (`catalog.test.ts`,
`controller-rolling-deployment.test.ts`,
`antigravity-qualification.test.ts`, `eval-gateway-drain.test.ts`, and
690+ unit files) — passed.
- Typechecks: `@paperclipai/adapter-utils`,
`@paperclipai/adapter-codex-local`, `@paperclipai/paperclip-runner`,
`@paperclipai/server` (all 7 layers), `@paperclipai/ui`, and `pnpm
test:e2e:runner:typecheck` — all passed.
- **Not run locally**: Live paid-key `runner-e2e` suites
(`antigravity-qualification`, `antigravity-model-lineup`,
`antigravity-agent-journey`) were waived by the owner on 2026-11-25 to
enable staging testing and remain marked `NOT RUN` / deferred in the
qualification docs. Rust `task_memory::tests::monitor_*` cgroup tests
require Linux CI.

## Risks

- **Merge sequencing**: Merge after #22935
(`fix/per-turn-harness-on-warm-environment`) so warm environments keep
Antigravity on its per-turn lifecycle.
- **Deferred live qualification**: Paid-key `antigravity-qualification`
cells have not run in CI;
`ACPX_CAPABILITY_PROFILES.antigravity.recovery` remains `"unverified"`
until live multi-turn and restart continuity are verified on staging.
- **Profile version reset**: Bumping `agentProfileVersion` from `1` to
`2` intentionally rejects any candidate-era v1 saved sessions as
`provider_state_incompatible`; new runs start a clean replacement
conversation in the same workspace.
- **Remote provider pack targets**: Remote provider packs intentionally
target `linux-x64` (Core Docker images and Linux sandboxes); local
`darwin-arm64` hosts continue to provision via `paperclipai runtime
setup antigravity`.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Google Gemini (Antigravity agent with tool use and code execution)

## 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>
2026-11-25 09:02:06 -06:00

268 lines
19 KiB
JavaScript

import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { spawnSync } from "node:child_process";
import { cpSync, existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import test from "node:test";
import profiles from "../acpx-profiles.json" with { type: "json" };
import historicalKimi from "../test/fixtures/kimi-profile-v14-identity.json" with { type: "json" };
import { KIMI_DISTRIBUTION_CLOSURE_SHA256 as kimiClosures } from "../src/drivers/acpx/kimi-closure-pins.ts";
import distributions from "../cursor-distributions.json" with { type: "json" };
import antigravityDistributions from "../antigravity-distributions.json" with { type: "json" };
import { verifyReleaseProviderPack } from "./release-provider-pack.mjs";
import { existingReleaseProviderPack, releaseProviderPackManifest } from "./stage-release-runner-binaries.mjs";
const revision = "a".repeat(40);
const digest = "sha256:" + "b".repeat(64);
const canonical = value => Array.isArray(value) ? `[${value.map(canonical).join(",")}]`
: value && typeof value === "object" ? `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonical(value[key])}`).join(",")}}` : JSON.stringify(value);
function fixture() {
const payload = { target: { platform: "linux", architecture: "x64" }, runnerSourceRevision: revision,
pins: { acpx: profiles.acpxVersion },
acpxProfileDigests: Object.fromEntries(["grok", "claude", "codex"].map(agent => [agent, profiles.profiles[agent].commandDigest])),
providers: { cursor: { version: profiles.profiles.cursor.agentServerVersion, profileDigest: profiles.profiles.cursor.commandDigest,
closureDigest: `sha256:${distributions.platforms["linux-x64"].closureSha256}`, qualification: "qualified",
path: "provider-assets/cursor/linux-x64", sha256: digest } } };
payload.providers.copilot = { version: profiles.profiles.copilot.agentServerVersion,
profileDigest: profiles.profiles.copilot.commandDigest, closureDigest: "sha256:a3d8f4367cfa1694d79e3f8b7930b6fbfe42a229c272b375b11951d631db8d07",
qualification: "qualified", path: "provider-assets/copilot/linux-x64", sha256: digest };
payload.providers.kimi = { version: profiles.profiles.kimi.agentServerVersion,
profileDigest: profiles.profiles.kimi.commandDigest, closureDigest: `sha256:${kimiClosures["linux-x64"]}`,
qualification: "qualified", path: "provider-assets/kimi/linux-x64", sha256: digest };
payload.providers.antigravity = { version: profiles.profiles.antigravity.agentServerVersion,
profileDigest: profiles.profiles.antigravity.commandDigest,
closureDigest: `sha256:${antigravityDistributions.platforms["linux-x64"].closureSha256}`,
qualification: "qualified", path: "provider-assets/antigravity/linux-x64", sha256: digest };
return payload;
}
function seal(payload) { return { schema: "paperclip-runner/remote-provider-pack/v1", payload,
digest: `sha256:${createHash("sha256").update(canonical(payload)).digest("hex")}` }; }
test("accepts a pack whose source and profiles match the assembled release", () => {
const manifest = seal(fixture()); assert.equal(verifyReleaseProviderPack(manifest, revision), manifest);
});
for (const field of ["version", "profileDigest", "closureDigest", "qualification", "path"]) {
test(`rejects an independently rehashed stale Cursor ${field}`, () => {
const payload = fixture(); payload.providers.cursor[field] = field.endsWith("Digest") ? digest : "stale";
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Cursor identity/);
});
}
test("rejects omitted Cursor, conflicting legacy inventory, stale sources and forged payload digests", () => {
const missing = fixture(); delete missing.providers.cursor;
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Cursor identity/);
const mixed = fixture(); mixed.candidateProviders = { cursor: { ...mixed.providers.cursor, profileDigest: digest } };
assert.throws(() => verifyReleaseProviderPack(seal(mixed), revision), /Cursor identity/);
const old = fixture(); old.runnerSourceRevision = "c".repeat(40);
assert.throws(() => verifyReleaseProviderPack(seal(old), revision), /release source/);
const forged = seal(fixture()); forged.digest = digest;
assert.throws(() => verifyReleaseProviderPack(forged, revision), /payload digest/);
});
test("release assembly rejects rehashed stale or missing packs before staging any files", () => {
const root = realpathSync(mkdtempSync(join(tmpdir(), "release-provider-pack-")));
const source = dirname(dirname(fileURLToPath(import.meta.url)));
try {
// Run the actual assembler in an isolated layout so it cannot overwrite built artifacts.
for (const file of ["scripts/stage-release-runner-binaries.mjs", "scripts/release-provider-pack.mjs", "src/live/runner-binary.ts", "src/drivers/acpx/kimi-closure-pins.ts", "acpx-profiles.json", "cursor-distributions.json", "antigravity-distributions.json", "release-runner-targets.json"]) {
mkdirSync(dirname(join(root, file)), { recursive: true }); cpSync(join(source, file), join(root, file));
}
const platforms = {};
for (const target of ["darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"]) {
const bytes = Buffer.alloc(64);
if (target.startsWith("linux-")) {
bytes.set([0x7f, 0x45, 0x4c, 0x46, 2, 1]); bytes.writeUInt16LE(target === "linux-x64" ? 62 : 183, 18);
} else {
bytes.writeUInt32LE(0xfeedfacf, 0); bytes.writeUInt32LE(target === "darwin-arm64" ? 0x0100000c : 0x01000007, 4);
}
const path = join(root, target); writeFileSync(path, bytes);
platforms[target] = { path, sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}` };
}
const payload = fixture(); payload.providers.cursor.profileDigest = digest;
const bytes = JSON.stringify(seal(payload)), path = join(root, "provider-pack.json"); writeFileSync(path, bytes);
const manifest = { sourceRevision: revision, platforms, remoteProviderPack: { path, sha256: `sha256:${createHash("sha256").update(bytes).digest("hex")}` } };
for (const error of [/Cursor identity/, /requires the matching Linux remote provider pack/]) {
writeFileSync(join(root, "release.json"), JSON.stringify(manifest));
const result = spawnSync(process.execPath, [join(root, "scripts/stage-release-runner-binaries.mjs"), join(root, "release.json")], { encoding: "utf8" });
assert.equal(result.status, 1); assert.match(result.stderr, error);
assert.equal(existsSync(join(root, "dist")), false);
delete manifest.remoteProviderPack;
}
} finally { rmSync(root, { recursive: true, force: true }); }
});
test("daemon-only assembly retains an existing same-source Linux provider-pack identity", () => {
const root = realpathSync(mkdtempSync(join(tmpdir(), "release-provider-retained-")));
try {
assert.equal(existingReleaseProviderPack(root, revision), undefined);
const file = join(root, "dist/remote-provider-packs/linux-x64/provider-pack.json");
mkdirSync(dirname(file), { recursive: true });
const pack = seal(fixture()); writeFileSync(file, JSON.stringify(pack));
assert.deepEqual(existingReleaseProviderPack(root, revision), pack);
assert.throws(() => existingReleaseProviderPack(root, "c".repeat(40)), /release source/);
const wrongTarget = fixture(); wrongTarget.target = { platform: "darwin", architecture: "arm64" };
writeFileSync(file, JSON.stringify(seal(wrongTarget)));
assert.throws(() => existingReleaseProviderPack(root, revision), /Linux x64 target/);
} finally { rmSync(root, { recursive: true, force: true }); }
});
for (const field of ["version", "profileDigest", "closureDigest", "qualification", "path", "sha256"]) {
test(`rejects an independently rehashed stale Copilot ${field}`, () => {
const payload = fixture(); payload.providers.copilot[field] = "stale";
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Copilot identity/);
});
}
test("rejects omitted Copilot and a duplicate candidate inventory", () => {
const missing = fixture(); delete missing.providers.copilot;
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Copilot identity/);
const mixed = fixture(); mixed.candidateProviders = { copilot: mixed.providers.copilot };
assert.throws(() => verifyReleaseProviderPack(seal(mixed), revision), /Copilot identity/);
});
function armFixture() {
const payload = fixture();
payload.target.architecture = "arm64";
delete payload.providers;
return payload;
}
test("ARM pack binds its own target and preserves other providers qualification limits", () => {
const pack = seal(armFixture());
assert.equal(verifyReleaseProviderPack(pack, revision, "linux-arm64"), pack);
assert.throws(() => verifyReleaseProviderPack(pack, revision), /Linux x64 target/);
assert.throws(() => verifyReleaseProviderPack(seal(fixture()), revision, "linux-arm64"), /linux-arm64 target/);
for (const inventory of ["providers", "candidateProviders"]) {
const payload = armFixture(); payload[inventory] = { pi: {} };
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-arm64"), /must not expand/);
}
});
test("both remote pack identities bind one source and remain separated during assembly", () => {
const root = realpathSync(mkdtempSync(join(tmpdir(), "release-provider-targets-")));
try {
for (const [target, payload] of [["linux-x64", fixture()], ["linux-arm64", armFixture()]]) {
const file = join(root, target, "provider-pack.json"); mkdirSync(dirname(file), { recursive: true });
writeFileSync(file, JSON.stringify(seal(payload)));
}
const entries = releaseProviderPackManifest(root, revision);
assert.deepEqual(Object.keys(entries), ["linux-x64", "linux-arm64"]);
assert.notEqual(entries["linux-x64"].sha256, entries["linux-arm64"].sha256);
assert.throws(() => releaseProviderPackManifest(root, "c".repeat(40)), /release source/);
writeFileSync(join(root, "linux-arm64", "provider-pack.json"), JSON.stringify(seal(fixture())));
assert.throws(() => releaseProviderPackManifest(root, revision), /linux-arm64 target/);
rmSync(join(root, "linux-arm64"), { recursive: true });
assert.throws(() => releaseProviderPackManifest(root, revision), /exactly both/);
} finally { rmSync(root, { recursive: true, force: true }); }
});
test("frozen image validation uses release profiles rather than the newer workflow checkout", () => {
const frozenProfiles = structuredClone(profiles);
const frozenDistributions = structuredClone(distributions);
frozenProfiles.acpxVersion = "frozen-acpx";
for (const agent of ["claude", "codex", "grok", "cursor"]) frozenProfiles.profiles[agent].commandDigest = digest;
frozenProfiles.profiles.cursor.agentServerVersion = "frozen-cursor";
frozenDistributions.platforms["linux-x64"].closureSha256 = "c".repeat(64);
const payload = fixture();
payload.pins.acpx = frozenProfiles.acpxVersion;
for (const agent of ["claude", "codex", "grok"]) payload.acpxProfileDigests[agent] = digest;
Object.assign(payload.providers.cursor, { version: "frozen-cursor", profileDigest: digest, closureDigest: "sha256:" + "c".repeat(64) });
const pack = seal(payload);
const expected = { profiles: frozenProfiles, distributions: frozenDistributions };
assert.throws(() => verifyReleaseProviderPack(pack, revision), /profiles/);
assert.equal(verifyReleaseProviderPack(pack, revision, "linux-x64", expected), pack);
payload.acpxProfileDigests.claude = "sha256:" + "d".repeat(64);
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", expected), /profiles/);
});
test("uses the frozen release's Copilot profile when the workflow checkout has advanced", () => {
const releaseProfiles = structuredClone(profiles);
releaseProfiles.profiles.copilot.commandDigest = "sha256:" + "e".repeat(64);
const payload = fixture(); payload.providers.copilot.profileDigest = releaseProfiles.profiles.copilot.commandDigest;
const manifest = seal(payload);
assert.equal(verifyReleaseProviderPack(manifest, revision, "linux-x64", { profiles: releaseProfiles, distributions }), manifest);
assert.throws(() => verifyReleaseProviderPack(manifest, revision), /Copilot identity/);
});
for (const field of ["version", "profileDigest", "closureDigest", "qualification", "path", "sha256"]) {
test(`rejects an independently rehashed stale Kimi ${field}`, () => {
const payload = fixture(); payload.providers.kimi[field] = "stale";
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Kimi identity/);
});
}
test("released Kimi requires one ordinary identity and exact frozen closure", () => {
const missing = fixture(); delete missing.providers.kimi;
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Kimi identity/);
const duplicate = fixture(); duplicate.candidateProviders = { kimi: duplicate.providers.kimi };
assert.throws(() => verifyReleaseProviderPack(seal(duplicate), revision), /Kimi identity/);
const frozen = structuredClone(profiles); frozen.profiles.kimi.commandDigest = "sha256:" + "e".repeat(64);
const payload = fixture(); payload.providers.kimi.profileDigest = frozen.profiles.kimi.commandDigest;
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozen, distributions }), /Kimi identity/);
assert.equal(verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozen, distributions, kimiClosures }).payload, payload);
});
test("historical pending releases keep their separate candidate inventory", () => {
const historical = structuredClone(profiles);
historical.profiles.kimi = { ...historical.profiles.kimi, agentProfileVersion: 14,
commandDigest: historicalKimi.commandDigest, qualificationStatus: historicalKimi.declaration.qualificationStatus };
const payload = fixture(); payload.candidateProviders = { kimi: { ...payload.providers.kimi,
profileDigest: historicalKimi.commandDigest, qualification: "pending" } }; delete payload.providers.kimi;
const pack = seal(payload);
assert.equal(verifyReleaseProviderPack(pack, revision, "linux-x64", { profiles: historical, distributions }), pack);
});
const antigravityProfile = profiles.profiles.antigravity;
const antigravityEntry = qualification => ({ version: antigravityProfile.agentServerVersion, profileDigest: antigravityProfile.commandDigest,
closureDigest: `sha256:${antigravityDistributions.platforms["linux-x64"].closureSha256}`, qualification,
path: "provider-assets/antigravity/linux-x64", sha256: digest });
function pendingAntigravityProfiles() {
const pending = structuredClone(profiles); pending.profiles.antigravity.qualificationStatus = "pending"; return pending;
}
test("released Antigravity requires one ordinary identity and never a candidate", () => {
assert.equal(antigravityProfile.qualificationStatus, undefined);
const payload = fixture();
assert.equal(verifyReleaseProviderPack(seal(payload), revision).payload, payload);
const missing = fixture(); delete missing.providers.antigravity;
assert.throws(() => verifyReleaseProviderPack(seal(missing), revision), /Antigravity identity/);
const candidate = fixture(); delete candidate.providers.antigravity; candidate.candidateProviders = { antigravity: antigravityEntry("pending") };
assert.throws(() => verifyReleaseProviderPack(seal(candidate), revision), /Antigravity identity/);
const both = fixture(); both.candidateProviders = { antigravity: antigravityEntry("pending") };
assert.throws(() => verifyReleaseProviderPack(seal(both), revision), /Antigravity identity/);
});
test("historical pending Antigravity may ship only as one patched linux-x64 candidate", () => {
const pending = pendingAntigravityProfiles();
const expected = { profiles: pending, distributions, kimiClosures, antigravityDistributions };
const absentPayload = fixture(); delete absentPayload.providers.antigravity;
const absent = seal(absentPayload);
assert.equal(verifyReleaseProviderPack(absent, revision, "linux-x64", expected), absent);
const candidate = fixture(); delete candidate.providers.antigravity; candidate.candidateProviders = { antigravity: antigravityEntry("pending") };
assert.equal(verifyReleaseProviderPack(seal(candidate), revision, "linux-x64", expected).payload, candidate);
const promoted = fixture();
assert.throws(() => verifyReleaseProviderPack(seal(promoted), revision, "linux-x64", expected), /Antigravity identity/);
const both = fixture(); both.providers.antigravity = antigravityEntry("pending"); both.candidateProviders = { antigravity: antigravityEntry("pending") };
assert.throws(() => verifyReleaseProviderPack(seal(both), revision, "linux-x64", expected), /Antigravity identity/);
});
for (const [name, change] of [
["vendor closure", { closureDigest: `sha256:${antigravityDistributions.platforms["linux-x64"].vendorClosureSha256}` }],
["darwin closure", { closureDigest: `sha256:${antigravityDistributions.platforms["darwin-arm64"].closureSha256}` }],
["older runtime version", { version: "1.4.3" }], ["older profile", { profileDigest: digest }],
["foreign path", { path: "provider-assets/antigravity/linux-arm64" }], ["unbound tree", { sha256: "stale" }],
["qualification", { qualification: "pending" }], ["extra field", { executable: "agy_acp_server.par" }],
]) test(`rejects a released Antigravity entry with a stale ${name}`, () => {
const payload = fixture(); payload.providers.antigravity = { ...antigravityEntry("qualified"), ...change };
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision), /Antigravity identity/);
});
test("frozen Antigravity validation reads the release's own patched closure", () => {
const frozen = structuredClone(antigravityDistributions); frozen.platforms["linux-x64"].closureSha256 = "c".repeat(64);
const frozenProfiles = structuredClone(profiles); frozenProfiles.profiles.antigravity.commandDigest = "sha256:" + "e".repeat(64);
const payload = fixture(); payload.providers.antigravity = { ...antigravityEntry("qualified"),
profileDigest: frozenProfiles.profiles.antigravity.commandDigest, closureDigest: `sha256:${"c".repeat(64)}` };
// Without the release's frozen declaration a different profile fails closed.
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozenProfiles, distributions, kimiClosures }), /Antigravity identity/);
assert.equal(verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozenProfiles, distributions, kimiClosures, antigravityDistributions: frozen }).payload, payload);
const vendorAsPatched = structuredClone(frozen); vendorAsPatched.platforms["linux-x64"].vendorClosureSha256 = "c".repeat(64);
assert.throws(() => verifyReleaseProviderPack(seal(payload), revision, "linux-x64", { profiles: frozenProfiles, distributions, kimiClosures, antigravityDistributions: vendorAsPatched }), /Antigravity identity/);
});