mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 17:14:54 +01:00
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>
This commit is contained in:
1 parent
1bea1eeaed
commit
c5107f12fe
46 files changed
+560
-824
No files matched your search
@@ -25,15 +25,17 @@ describe("host ACPX qualification admission", () => {
|
||||
});
|
||||
|
||||
it.each([undefined, "malformed", JSON.stringify([{ agent: "antigravity", model: "exact-model" }])])(
|
||||
"keeps pending Antigravity closed despite host authorization (%s)", host => {
|
||||
"admits released Antigravity without candidate authority (%s)", host => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, host);
|
||||
vi.stubEnv(ACPX_QUALIFICATION_ENV, host);
|
||||
const config = { provider: "acpx", acpxAgent: "antigravity", model: "exact-model",
|
||||
env: { [ACPX_QUALIFICATION_ENV]: JSON.stringify([{ agent: "antigravity", model: "exact-model" }]) } };
|
||||
for (const resolve of [() => resolvePaperclipRunnerProviderProfile(config),
|
||||
() => resolvePaperclipRunnerNativeProviderInput({ backend: "acpx_runtime", adapterConfig: config })]) {
|
||||
expect(resolve).toThrow(expect.objectContaining({ code: "paperclip_runner_acpx_agent_unavailable" }));
|
||||
expect(resolve).toThrow("Google Antigravity is awaiting native Runner acceptance");
|
||||
}
|
||||
const config = { provider: "acpx", acpxAgent: "antigravity", model: "exact-model" };
|
||||
expect(QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion).toBe(2);
|
||||
expect(QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus).not.toBe("pending");
|
||||
expect(resolvePaperclipRunnerProviderProfile(config, { companyId: "candidate-company" })).toMatchObject(config);
|
||||
expect(resolvePaperclipRunnerNativeProviderInput({ companyId: "candidate-company", backend: "acpx_runtime", adapterConfig: config }))
|
||||
.toMatchObject({ ...config, acpxPermissionMode: "approve-all" });
|
||||
expect(() => resolvePaperclipRunnerProviderProfile({ ...config, model: "" }))
|
||||
.toThrow(expect.objectContaining({ code: "paperclip_runner_acpx_model_required" }));
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ export function resolveAntigravityCandidateAdmission(
|
||||
input: { companyId?: string; model?: string; target?: { platform: string; architecture: string } },
|
||||
hostEnvironment: NodeJS.ProcessEnv = process.env,
|
||||
): AcpxCandidateAdmission | undefined {
|
||||
if (QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus !== "pending") return undefined;
|
||||
const encoded = hostEnvironment[ANTIGRAVITY_CANDIDATE_ADMISSION_ENV];
|
||||
if (!encoded || !input.companyId) return undefined;
|
||||
const hostNative = isAntigravityNativeTarget(process.platform, process.arch);
|
||||
|
||||
@@ -21,83 +21,35 @@ const targetAdmission = (target: string) => {
|
||||
};
|
||||
const admission = () => targetAdmission(localHost ? hostTarget : "darwin-arm64");
|
||||
|
||||
describe("Antigravity operator candidate admission", () => {
|
||||
describe("released Antigravity admission ignores candidate grants", () => {
|
||||
afterEach(() => vi.unstubAllEnvs());
|
||||
|
||||
it("keeps saved configuration and runtime environment from authorizing a candidate", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, undefined);
|
||||
const injected = { ...config, candidateAdmission: admission(),
|
||||
env: { [ANTIGRAVITY_CANDIDATE_ADMISSION_ENV]: JSON.stringify(admission()) } };
|
||||
expect(() => resolvePaperclipRunnerProviderProfile(injected, { companyId }))
|
||||
.toThrow(expect.objectContaining({ code: "paperclip_runner_acpx_agent_unavailable" }));
|
||||
});
|
||||
|
||||
it("requires explicit company authority and never projects it to another company", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, JSON.stringify(admission()));
|
||||
expect(resolveAntigravityCandidateAdmission({})).toBeUndefined();
|
||||
expect(resolveAntigravityCandidateAdmission({ companyId: "another-company", model })).toBeUndefined();
|
||||
expect(() => resolvePaperclipRunnerProviderProfile(config)).toThrow(/awaiting native Runner acceptance/);
|
||||
expect(() => resolvePaperclipRunnerProviderProfile(config, { companyId: "another-company" }))
|
||||
.toThrow(/awaiting native Runner acceptance/);
|
||||
});
|
||||
|
||||
it("admits only the exact configured local candidate while leaving global release pending", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, JSON.stringify(admission()));
|
||||
expect(QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus).toBe("pending");
|
||||
if (!localHost) {
|
||||
it("admits released Antigravity without candidate authority and ignores candidate env values", () => {
|
||||
for (const value of [undefined, "malformed", JSON.stringify(admission()), JSON.stringify(targetAdmission("linux-x64"))]) {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, value);
|
||||
expect(QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion).toBe(2);
|
||||
expect(QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus).toBeUndefined();
|
||||
expect(resolveAntigravityCandidateAdmission({ companyId, model })).toBeUndefined();
|
||||
return;
|
||||
expect(resolveAntigravityCandidateAdmission({ companyId, model, target: ANTIGRAVITY_REMOTE_TARGET })).toBeUndefined();
|
||||
expect(antigravityRemoteCandidateAdmitted({ companyId, model })).toBe(false);
|
||||
expect(resolvePaperclipRunnerProviderProfile(config, { companyId })).toMatchObject(config);
|
||||
expect(resolvePaperclipRunnerNativeProviderInput({ backend: "acpx_runtime", adapterConfig: config, companyId }))
|
||||
.toMatchObject({ ...config, acpxPermissionMode: "approve-all" });
|
||||
expect(resolveNativeRuntimeMode({ enabled: false, runtimeConfig: {}, adapterConfig: config,
|
||||
agent: { id: "candidate-agent", companyId, adapterType: "paperclip_runner", status: "active" },
|
||||
issue: { id: "candidate-task", workMode: "standard" }, target: { kind: "local" }, workspaceId: null }))
|
||||
.toMatchObject({ kind: "native", profile: { backend: "acpx_runtime" } });
|
||||
}
|
||||
expect(resolveAntigravityCandidateAdmission({ companyId })).toMatchObject({ companyId, model, agent: "antigravity" });
|
||||
expect(resolvePaperclipRunnerProviderProfile(config, { companyId })).toMatchObject(config);
|
||||
expect(resolvePaperclipRunnerNativeProviderInput({ backend: "acpx_runtime", adapterConfig: config, companyId }))
|
||||
.toMatchObject({ ...config, acpxPermissionMode: "approve-all" });
|
||||
expect(() => resolvePaperclipRunnerProviderProfile({ ...config, model: "different-model" }, { companyId }))
|
||||
.toThrow(expect.objectContaining({ code: "paperclip_runner_acpx_qualification_invalid" }));
|
||||
expect(resolveNativeRuntimeMode({ enabled: false, runtimeConfig: {}, adapterConfig: config,
|
||||
agent: { id: "candidate-agent", companyId, adapterType: "paperclip_runner", status: "active" },
|
||||
issue: { id: "candidate-task", workMode: "standard" }, target: { kind: "local" }, workspaceId: null }))
|
||||
.toMatchObject({ kind: "native", profile: { backend: "acpx_runtime" } });
|
||||
});
|
||||
|
||||
it("binds a cloud grant to linux-x64 and the patched closure, for its company and model only", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, JSON.stringify(targetAdmission("linux-x64")));
|
||||
expect(resolveAntigravityCandidateAdmission({ companyId, model, target: ANTIGRAVITY_REMOTE_TARGET }))
|
||||
.toMatchObject({ companyId, model, platform: "linux", architecture: "x64" });
|
||||
expect(antigravityRemoteCandidateAdmitted({ companyId, model })).toBe(true);
|
||||
expect(antigravityRemoteCandidateAdmitted({ companyId: "another-company", model })).toBe(false);
|
||||
expect(antigravityRemoteCandidateAdmitted({ companyId, model: "gemini-3.8-flash-high" })).toBe(false);
|
||||
if (hostTarget !== "linux-x64") {
|
||||
expect(() => resolveAntigravityCandidateAdmission({ companyId, model, target: { platform: process.platform, architecture: process.arch } }))
|
||||
.toThrow(/does not match the execution target/);
|
||||
}
|
||||
for (const grant of [targetAdmission("linux-arm64"), targetAdmission("darwin-arm64"),
|
||||
{ ...targetAdmission("linux-x64"), nativeClosureDigest: `sha256:${distributions.platforms["linux-x64"].vendorClosureSha256}` }]) {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, JSON.stringify(grant));
|
||||
expect(antigravityRemoteCandidateAdmitted({ companyId, model })).toBe(false);
|
||||
it("requires an explicit Antigravity model ID", () => {
|
||||
for (const emptyModel of [undefined, "", " "]) {
|
||||
expect(() => resolvePaperclipRunnerProviderProfile({ ...config, model: emptyModel }, { companyId }))
|
||||
.toThrow(expect.objectContaining({ code: "paperclip_runner_acpx_model_required" }));
|
||||
}
|
||||
});
|
||||
|
||||
it("declares verified closures for macOS ARM and both Linux architectures", () => {
|
||||
expect(verifiedTargets.sort()).toEqual(["darwin-arm64", "linux-arm64", "linux-x64"]);
|
||||
});
|
||||
|
||||
it.runIf(localHost)("rejects another verified platform's exact record on this host", () => {
|
||||
// linux-x64 is also the cloud target, so a grant for it is a valid surface grant on any host.
|
||||
for (const target of verifiedTargets.filter(target => target !== hostTarget && target !== "linux-x64")) {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, JSON.stringify(targetAdmission(target)));
|
||||
expect(() => resolveAntigravityCandidateAdmission({ companyId, model })).toThrow(/does not match this host/);
|
||||
}
|
||||
});
|
||||
|
||||
it.runIf(localHost).each([
|
||||
{ expiresAt: 0 }, { profileDigest: `sha256:${"0".repeat(64)}` },
|
||||
{ nativeClosureDigest: `sha256:${"0".repeat(64)}` }, { platform: process.platform === "linux" ? "darwin" : "linux" },
|
||||
{ architecture: process.arch === "x64" ? "arm64" : "x64" }, { allowAll: true },
|
||||
])("rejects expired, changed or broad operator authorization %j", changes => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, JSON.stringify({ ...admission(), ...changes }));
|
||||
expect(() => resolveAntigravityCandidateAdmission({ companyId, model })).toThrow();
|
||||
expect(() => resolvePaperclipRunnerProviderProfile(config, { companyId }))
|
||||
.toThrow(expect.objectContaining({ code: "paperclip_runner_acpx_qualification_invalid" }));
|
||||
});
|
||||
});
|
||||
@@ -3,18 +3,20 @@ import { tmpdir } from "node:os";
|
||||
import { basename, join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
// Both release states are exercised against the same build: the pending
|
||||
// candidate declaration that ships today, and the qualified declaration the
|
||||
// flip produces (no qualificationStatus, profile version bumped), as the Kimi
|
||||
// probe tests stub it.
|
||||
const release = vi.hoisted(() => ({ pending: true }));
|
||||
// Both release states are exercised against the same build: the qualified
|
||||
// declaration that ships today (revision 2, no qualificationStatus), and the
|
||||
// historical pending candidate declaration (revision 1, qualificationStatus: "pending").
|
||||
const release = vi.hoisted(() => ({ pending: false }));
|
||||
vi.mock("../../vendor/paperclip-runner/index.js", async importOriginal => {
|
||||
const original = await importOriginal<typeof import("../../vendor/paperclip-runner/index.js")>();
|
||||
const { qualificationStatus: _pending, ...qualified } = original.QUALIFIED_ACPX_PROFILES.antigravity;
|
||||
const released = { ...qualified, agentProfileVersion: qualified.agentProfileVersion + 1 };
|
||||
const pending = {
|
||||
...original.QUALIFIED_ACPX_PROFILES.antigravity,
|
||||
agentProfileVersion: original.QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion - 1,
|
||||
qualificationStatus: "pending" as const,
|
||||
};
|
||||
const profiles = { ...original.QUALIFIED_ACPX_PROFILES };
|
||||
Object.defineProperty(profiles, "antigravity", { enumerable: true,
|
||||
get: () => release.pending ? original.QUALIFIED_ACPX_PROFILES.antigravity : released });
|
||||
get: () => release.pending ? pending : original.QUALIFIED_ACPX_PROFILES.antigravity });
|
||||
return { ...original, QUALIFIED_ACPX_PROFILES: profiles };
|
||||
});
|
||||
|
||||
@@ -64,48 +66,15 @@ const candidateGrant = (target = "darwin-arm64", changes: Record<string, unknown
|
||||
platform, architecture, expiresAt: Date.now() + 60_000, ...changes });
|
||||
};
|
||||
|
||||
afterEach(() => { release.pending = true; vi.unstubAllEnvs(); });
|
||||
afterEach(() => { release.pending = false; vi.unstubAllEnvs(); });
|
||||
|
||||
describe("Antigravity executor admission", () => {
|
||||
const admissible = (execution: NativeExecutionInput, changes: Partial<Parameters<typeof assertAntigravityExecutionAdmissible>[0]> = {}) =>
|
||||
() => assertAntigravityExecutionAdmissible({ execution, useRunnerd: true, remoteTarget: false, ...changes });
|
||||
|
||||
it("requires the exact local per-turn candidate grant while the profile is pending", () => {
|
||||
expect(antigravityReleasePending()).toBe(true);
|
||||
const execution = antigravityExecution();
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, undefined);
|
||||
expect(admissible(execution)).toThrow(/paperclip_runner_antigravity_candidate_ineligible/);
|
||||
if (!localHost) return;
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant());
|
||||
expect(admissible(execution)).not.toThrow();
|
||||
// A local grant never admits a cloud run.
|
||||
for (const change of [{ remoteTarget: true }, { restartRecovery: { kind: "same_run" } }, { useRunnerd: false }, { backend: {} }]) {
|
||||
expect(admissible(execution, change)).toThrow(/candidate_ineligible/);
|
||||
}
|
||||
const warm = { ...execution, session: { ...execution.session, lifecyclePolicy: { mode: "warm", idleTimeoutMs: 1 } } } as NativeExecutionInput;
|
||||
expect(admissible(warm)).toThrow(/candidate_ineligible/);
|
||||
});
|
||||
|
||||
it("admits a cloud run only with a linux-x64 grant naming the patched closure, for the granted company", () => {
|
||||
const execution = antigravityExecution();
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("linux-x64"));
|
||||
expect(admissible(execution, { remoteTarget: true })).not.toThrow();
|
||||
expect(admissible(execution, { remoteTarget: true, pluginTask: true })).toThrow(/candidate_ineligible/);
|
||||
const warm = { ...execution, session: { ...execution.session, lifecyclePolicy: { mode: "warm", idleTimeoutMs: 1 } } } as NativeExecutionInput;
|
||||
expect(admissible(warm, { remoteTarget: true })).toThrow(/candidate_ineligible/);
|
||||
expect(admissible(execution, { remoteTarget: true, restartRecovery: { kind: "reattach_remote_runner" } })).toThrow(/candidate_ineligible/);
|
||||
const otherCompany = { ...execution, binding: { ...execution.binding, companyId: "10000000-0000-4000-8000-0000000000ff" } } as NativeExecutionInput;
|
||||
expect(admissible(otherCompany, { remoteTarget: true })).toThrow(/candidate_ineligible/);
|
||||
for (const grant of [candidateGrant("linux-arm64"), candidateGrant("darwin-arm64"),
|
||||
candidateGrant("linux-x64", { nativeClosureDigest: `sha256:${distributions.platforms["linux-x64"].vendorClosureSha256}` }),
|
||||
candidateGrant("linux-x64", { model: "gemini-3.8-flash-high" })]) {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, grant);
|
||||
expect(admissible(execution, { remoteTarget: true })).toThrow(/candidate_ineligible/);
|
||||
}
|
||||
});
|
||||
|
||||
it("takes the general qualified path after the flip: no grant, restart recovery, remote and warm targets", () => {
|
||||
release.pending = false;
|
||||
it("takes the general qualified path without a candidate grant, including pluginTask and remote targets", () => {
|
||||
expect(antigravityReleasePending()).toBe(false);
|
||||
expect(QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion).toBe(2);
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, undefined);
|
||||
const execution = antigravityExecution();
|
||||
expect(admissible(execution)).not.toThrow();
|
||||
@@ -114,78 +83,44 @@ describe("Antigravity executor admission", () => {
|
||||
const preconfigured = { ...execution, homeMode: "preconfigured" } as NativeExecutionInput;
|
||||
expect(admissible(preconfigured)).not.toThrow();
|
||||
});
|
||||
|
||||
it("refuses ungranted and pluginTask execution when releasePending is forced true", () => {
|
||||
release.pending = true;
|
||||
expect(antigravityReleasePending()).toBe(true);
|
||||
const execution = antigravityExecution();
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, undefined);
|
||||
expect(admissible(execution)).toThrow(/paperclip_runner_antigravity_candidate_ineligible/);
|
||||
expect(admissible(execution, { remoteTarget: true })).toThrow(/candidate_ineligible/);
|
||||
expect(admissible(execution, { remoteTarget: true, pluginTask: true })).toThrow(/candidate_ineligible/);
|
||||
const warm = { ...execution, session: { ...execution.session, lifecyclePolicy: { mode: "warm", idleTimeoutMs: 1 } } } as NativeExecutionInput;
|
||||
expect(admissible(warm)).toThrow(/candidate_ineligible/);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Antigravity agent picker candidate", () => {
|
||||
const cloud = { driver: "sandbox", platform: "linux", architecture: "x64", libc: "glibc" as const, glibcVersion: "2.39" };
|
||||
|
||||
it("offers a cloud environment only the company's own unexpired linux-x64 grant", () => {
|
||||
it("offers no candidate once the profile is released, even if a stale grant env var is set", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("linux-x64"));
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, cloud)).toMatchObject({ model, platform: "linux", architecture: "x64" });
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { driver: "sandbox", managedCloudImage: true })).toMatchObject({ model });
|
||||
expect(antigravityCandidateForRunnerTarget("10000000-0000-4000-8000-00000000000f", cloud)).toBeUndefined();
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { ...cloud, architecture: "arm64" })).toBeUndefined();
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { driver: "plugin", runnerTasks: true })).toBeUndefined();
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("linux-x64", { expiresAt: Date.now() - 1 }));
|
||||
expect(() => antigravityCandidateForRunnerTarget(companyId, cloud)).toThrow();
|
||||
});
|
||||
|
||||
it("does not open a cloud environment with a grant for this host", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("darwin-arm64"));
|
||||
expect(() => antigravityCandidateForRunnerTarget(companyId, cloud)).toThrow(/does not match the execution target/);
|
||||
});
|
||||
|
||||
it("offers a cloud environment nothing when its Linux libc cannot run the Runner", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("linux-x64"));
|
||||
for (const target of [
|
||||
{ ...cloud, libc: "musl" as const, glibcVersion: undefined },
|
||||
{ ...cloud, libc: "unknown" as const, glibcVersion: undefined },
|
||||
{ ...cloud, glibcVersion: "2.35" },
|
||||
{ driver: "ssh", platform: "linux", architecture: "x64", libc: "glibc" as const, glibcVersion: "2.31" },
|
||||
]) expect(antigravityCandidateForRunnerTarget(companyId, target)).toBeUndefined();
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { driver: "ssh", platform: "linux", architecture: "x64", libc: "glibc", glibcVersion: "2.41" }))
|
||||
.toMatchObject({ model });
|
||||
});
|
||||
|
||||
it("offers this host only a grant that names this host", () => {
|
||||
// Pin the host to darwin-arm64 so the result does not depend on the machine
|
||||
// running the test. A cloud (linux-x64) grant is valid for an untargeted
|
||||
// lookup on every host, so only a host-bound lookup refuses it.
|
||||
const host = { platform: Object.getOwnPropertyDescriptor(process, "platform")!, arch: Object.getOwnPropertyDescriptor(process, "arch")! };
|
||||
Object.defineProperty(process, "platform", { ...host.platform, value: "darwin" });
|
||||
Object.defineProperty(process, "arch", { ...host.arch, value: "arm64" });
|
||||
try {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("linux-x64"));
|
||||
expect(() => antigravityCandidateForRunnerTarget(companyId, { driver: "local" })).toThrow(/does not match the execution target/);
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("darwin-arm64"));
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { driver: "local" })).toMatchObject({ model, platform: "darwin", architecture: "arm64" });
|
||||
} finally {
|
||||
Object.defineProperty(process, "platform", host.platform);
|
||||
Object.defineProperty(process, "arch", host.arch);
|
||||
}
|
||||
});
|
||||
|
||||
it("offers no candidate once the profile is released", () => {
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, candidateGrant("linux-x64"));
|
||||
release.pending = false;
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, cloud)).toBeUndefined();
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { driver: "local" })).toBeUndefined();
|
||||
expect(antigravityCandidateForRunnerTarget(companyId, { driver: "plugin", runnerTasks: true })).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Antigravity recovery policy and state root", () => {
|
||||
it("forces the candidate's same-session recovery and per-run root only while pending", () => {
|
||||
it("uses ordinary session-scoped state when released and per-run candidate scope only while pending", () => {
|
||||
const execution = antigravityExecution();
|
||||
const nextRun = antigravityExecution({ runId: "50000000-0000-4000-8000-000000000005" });
|
||||
expect(antigravityForcesSameSessionRecovery(execution.provider)).toBe(true);
|
||||
expect(antigravityUsesRunScopedState(execution)).toBe(true);
|
||||
expect(scopedRunnerdStateRoot(execution)).not.toBe(scopedRunnerdStateRoot(nextRun));
|
||||
|
||||
release.pending = false;
|
||||
expect(antigravityForcesSameSessionRecovery(execution.provider)).toBe(false);
|
||||
expect(antigravityUsesRunScopedState(execution)).toBe(false);
|
||||
// Qualified: one root per session scope, kept across the session's runs.
|
||||
expect(scopedRunnerdStateRoot(execution)).toBe(scopedRunnerdStateRoot(nextRun));
|
||||
|
||||
release.pending = true;
|
||||
expect(antigravityForcesSameSessionRecovery(execution.provider)).toBe(true);
|
||||
expect(antigravityUsesRunScopedState(execution)).toBe(true);
|
||||
expect(scopedRunnerdStateRoot(execution)).not.toBe(scopedRunnerdStateRoot(nextRun));
|
||||
});
|
||||
|
||||
it.each([false, true])("never shares a state root across subtasks or workspaces (pending=%s)", pending => {
|
||||
@@ -227,7 +162,8 @@ describe("Antigravity candidate same-run startup retry", () => {
|
||||
const quarantined = (root: string) => existsSync(join(stateBase, "quarantine"))
|
||||
&& readdirSync(join(stateBase, "quarantine")).some(name => name.startsWith(`${basename(root)}.identity_indeterminate.`));
|
||||
|
||||
it("retires a root whose session.open never opened a provider session, so the retry starts fresh", async () => {
|
||||
it("retires a root whose session.open never opened a provider session only while pending", async () => {
|
||||
release.pending = true;
|
||||
const execution = antigravityExecution();
|
||||
const root = writeFailedOpenRoot(execution);
|
||||
expect(await retireNeverOpenedCandidateRunRoot(execution, root)).toBe(true);
|
||||
@@ -236,6 +172,7 @@ describe("Antigravity candidate same-run startup retry", () => {
|
||||
});
|
||||
|
||||
it("keeps a root that opened a provider session or started a turn, and every root once released", async () => {
|
||||
release.pending = true;
|
||||
for (const provider of [
|
||||
{ lifecycle: "suspended", identity: { kind: "acpx", acpxRecordId: "record" } },
|
||||
{ lifecycle: "closed", identity: { kind: "acpx", acpxRecordId: "record" } },
|
||||
@@ -262,8 +199,9 @@ describe("Antigravity candidate same-run startup retry", () => {
|
||||
});
|
||||
|
||||
describe("Antigravity state saved by the pending candidate, resumed by the qualified release", () => {
|
||||
it("refuses the candidate's in-flight state permanently and by name, never as a retryable interruption", () => {
|
||||
// Saved before the deploy under the candidate's profile version.
|
||||
it("refuses the candidate's in-flight v1 state permanently and by name, never as a retryable interruption", () => {
|
||||
// Saved before the deploy under the candidate's v1 profile version.
|
||||
release.pending = true;
|
||||
const saved = antigravityExecution();
|
||||
release.pending = false;
|
||||
vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, undefined);
|
||||
@@ -280,7 +218,6 @@ describe("Antigravity state saved by the pending candidate, resumed by the quali
|
||||
});
|
||||
|
||||
it("refuses an older qualified profile version by the same name", () => {
|
||||
release.pending = false;
|
||||
const saved = antigravityExecution();
|
||||
(saved.provider as { profile: { agentProfileVersion: number } }).profile.agentProfileVersion -= 1;
|
||||
expect(() => assertAntigravityExecutionAdmissible({ execution: saved, useRunnerd: true, remoteTarget: false }))
|
||||
|
||||
@@ -344,11 +344,11 @@ vi.mock("../../vendor/paperclip-runner/index.js", async (importOriginal) => {
|
||||
const original = await importOriginal<
|
||||
typeof import("../../vendor/paperclip-runner/index.js")
|
||||
>();
|
||||
// Antigravity's release state is stubbed per test (pending today, qualified after the flip).
|
||||
const { qualificationStatus: _antigravityPending, ...antigravityReleased } = original.QUALIFIED_ACPX_PROFILES.antigravity;
|
||||
// Antigravity's release state is stubbed per test (qualified by default, pending for historical checks).
|
||||
const antigravityPending = { ...original.QUALIFIED_ACPX_PROFILES.antigravity, qualificationStatus: "pending" as const };
|
||||
const profiles = { ...original.QUALIFIED_ACPX_PROFILES };
|
||||
Object.defineProperty(profiles, "antigravity", { enumerable: true,
|
||||
get: () => antigravityPack.released ? antigravityReleased : original.QUALIFIED_ACPX_PROFILES.antigravity });
|
||||
get: () => antigravityPack.released ? original.QUALIFIED_ACPX_PROFILES.antigravity : antigravityPending });
|
||||
return {
|
||||
...original,
|
||||
QUALIFIED_ACPX_PROFILES: profiles,
|
||||
|
||||
@@ -12,11 +12,11 @@ const mocks = vi.hoisted(() => ({
|
||||
|
||||
vi.mock("../../vendor/paperclip-runner/index.js", async importOriginal => {
|
||||
const original = await importOriginal<typeof import("../../vendor/paperclip-runner/index.js")>();
|
||||
const { qualificationStatus: _pending, ...released } = original.QUALIFIED_ACPX_PROFILES.antigravity;
|
||||
const pending = { ...original.QUALIFIED_ACPX_PROFILES.antigravity, qualificationStatus: "pending" as const };
|
||||
const profiles = { ...original.QUALIFIED_ACPX_PROFILES };
|
||||
Object.defineProperty(profiles, "antigravity", {
|
||||
enumerable: true,
|
||||
get: () => mocks.released ? released : original.QUALIFIED_ACPX_PROFILES.antigravity,
|
||||
get: () => mocks.released ? original.QUALIFIED_ACPX_PROFILES.antigravity : pending,
|
||||
});
|
||||
return {
|
||||
...original,
|
||||
|
||||
@@ -49,7 +49,7 @@ export const DEFAULT_ACPX_RUNNER_MODELS = {
|
||||
|
||||
export type QualifiedPaperclipRunnerAcpxAgent =
|
||||
keyof typeof DEFAULT_ACPX_RUNNER_MODELS;
|
||||
type AdmittedPaperclipRunnerAcpxAgent = QualifiedPaperclipRunnerAcpxAgent | AcpxQualificationCandidate | "antigravity";
|
||||
type AdmittedPaperclipRunnerAcpxAgent = QualifiedPaperclipRunnerAcpxAgent | AcpxQualificationCandidate;
|
||||
|
||||
export type PaperclipRunnerProviderProfile =
|
||||
| { provider: "cursor_cloud"; backend: "cursor_cloud_api"; model: string }
|
||||
@@ -648,7 +648,7 @@ export function resolvePaperclipRunnerProviderProfile(
|
||||
}
|
||||
throw new PaperclipRunnerProviderProfileError("paperclip_runner_acpx_agent_unavailable", `${pendingAcpxProfile.label} is awaiting native Runner acceptance. Its profile is not enabled for production runs.`);
|
||||
}
|
||||
if ((acpxAgent === "cursor" || acpxAgent === "pi" || acpxAgent === "kimi") && !model) {
|
||||
if ((acpxAgent === "cursor" || acpxAgent === "pi" || acpxAgent === "kimi" || acpxAgent === "antigravity") && !model) {
|
||||
throw new PaperclipRunnerProviderProfileError("paperclip_runner_acpx_model_required", "This ACPX agent requires an explicit model ID; there is no default model.");
|
||||
}
|
||||
if (acpxAgent !== "claude" && acpxAgent !== "codex" && acpxAgent !== "grok" && acpxAgent !== "cursor" && acpxAgent !== "copilot" && acpxAgent !== "pi" && acpxAgent !== "kimi" && acpxAgent !== "antigravity") {
|
||||
|
||||
Reference in new issue
Block a user