mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 14:20:12 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The native Runner starts each agent harness and owns its lifecycle, credentials and recovery > - Google Antigravity is Google's only first-party coding harness, and it is the harness for Gemini 4 Neon > - The Runner had an Antigravity integration, but only as a pending candidate: ACP server 1.4.3, macOS ARM64 only, Google sign-in only, closed unless an operator opened it for one company and one model > - Cloud sandboxes run Linux and use API keys, so the candidate could not run there, and it had one attended test cell > - This pull request moves the integration to ACP server 1.5.2, makes it run on Linux and with a Gemini API key, adds the tests the other ACPX harnesses have, and removes the code paths that would block recovery after release > - The benefit is that the release of Antigravity becomes a small declaration change after the live suites pass. The profile stays `pending` in this pull request. ## Linked Issues or Issue Description Refs #98 Refs #6559 Refs #8523 Refs #21121 (a separate legacy-style `agy_local` adapter that uses the CLI print protocol; this pull request does not replace or include it) ## What Changed **Runtime** - Pin Antigravity ACP server 1.5.2 (was 1.4.3). Owned admission patch is `1.5.2-paperclip.2`. - Verified patched closures for `darwin-arm64`, `linux-x64` and `linux-arm64`. `darwin-x64` stays inventory-only. - The patcher reads Mach-O and ELF builds. It signs macOS output only. One admission source serves all platforms. - Platform gates in TypeScript, Rust, the sidecar schema and the server admit each host that has a verified closure. **Auth and models** - Gemini API-key auth reaches an exact-model session receipt. Admission accepts a model only when the base model and the thinking level both match the requested ID. - API-key connections get a model list on local and cloud environments. The list is generated at build time from the pinned runtime. The server starts no process to read it. - Gemini 4 Neon, Carbon, Argon and Hydrogen are selectable. The picker marks them "needs a paid Gemini API plan" for API-key connections. - One shared module maps model ID to family and thinking level. - `google/gemini-4-neon` is added to the OpenCode model list. A new model audit is in `doc/adapter-model-audit-2026-11-22.md`. **Lifecycle and failures** - A provider error no longer completes the turn. The driver classifies it: overloaded, rate limit, quota, auth rejected, model unavailable. - Overload retries are bounded (3 attempts, about 14 seconds). - A refused session reload maps to incompatible saved state, so the automatic replacement conversation applies. - Server gates that refused restart recovery, remote targets and shared state for Antigravity now apply only while the profile is pending. - A Google sign-in connection with a cloud environment is refused at save and at Test, with a plain message. - A released profile rejects candidate grants in TypeScript and in Rust. **Launch cost and integrity (all native ACPX providers)** - Each closure is verified one time into a sealed read-only store. Later launches check file identities and hash the exact executable they start. - Remote provider-pack verification is recorded per sandbox lease. Later runs check kernel identity and fall back to the full hash on any difference. - Superseded stores are removed in the background after a launch. **Provider pack and image** - The provider pack carries Antigravity for `linux-x64` as a candidate provider. It becomes an ordinary provider from the profile status alone. - The Daytona image build accepts the candidate. A credential-free smoke runs in the build. **Tests and CI** - New `antigravity-qualification` suite: 24 cells, local and Daytona. - New model lineup suites: 14 API-key cells and 14 Gemini 4 cells. Each cell requires the exact model in the Runner receipt. - Antigravity can run the `chat-features` cases with `--profile runner-acpx-antigravity`. - `runner-full-stack-e2e.yml` passes `GEMINI_API_KEY` for the new profile and derives candidate providers from the selected Daytona cells. **Docs** - `doc/plans/2026-11-22-antigravity-qualification.md` is the current release contract, acceptance ledger and operator recipe. ## Verification Commands that passed on the final revision: - `pnpm build` - Typecheck for all packages, including the runner-e2e test projects - `pnpm test:e2e:runner:unit`: 11,665 Vitest tests passed, 25 skipped; 386 node tests passed - `cargo test -p paperclip-runner-core -- --test-threads=4`: 1,199 passed, 2 failed. The 2 failures are Codex transport timing tests that pass alone and on `master`. - `cargo fmt --check`, `check:acpx-profiles`, `check:protocol-types`, `node scripts/check-maps.mjs` - Native patch tests: 9 of 9 on `darwin-arm64` and 9 of 9 on `linux-x64` - UI picker tests: 397 of 397 Known failures that also fail on `master`: - 11 runner package script tests (browser, Pi and package-boundary checks) - 6 `runtime-selection` tests that read an untracked local skill file Live evidence, without a prompt: - Clean provisioning on `darwin-arm64` and on `linux-x64` in a Daytona sandbox. The closure digests reproduce. A changed or missing file is rejected. - `initialize` reports 1.5.2. An API-key session returns a receipt for exactly `gemini-3.8-flash-low` and the exact instruction bytes, on both platforms. - All 28 model IDs (14 Gemini 3, 14 Gemini 4) return an exact receipt under an API key. - A session survives a process kill and resumes in a new process with exact receipts, on both platforms. - The server's remote path verifies the provider pack in a Daytona sandbox. - Run start to native `initialize`: 3.45 s to 1.46 s on macOS, 3.65 s to 1.74 s on Linux x64, before the per-launch executable hash was restored (about 60 ms on macOS; not measured on Linux). - Remote pack verification on a reused sandbox lease: about 4.3 s to about 0.25 s. Live evidence, with a prompt, on an already-released harness: - Pi native, `pi-native.runner-acpx-pi.local.agent-files-fresh-run`, on `darwin-arm64` at `427e9b088b`: 1 of 1 passed, 14 of 14 checks, both native runs succeeded (25.5 s and 25.7 s). The process started from the new launch store with no fallback warning. - The same cell and `native-pending-controller-restart` failed in the paid workflow on this branch and on `master` in the same way, before any native start. The workflow does not install the Pi runtime for local cells, so the agent setup check fails. That is a workflow gap, not part of this change. **Not run.** No Antigravity prompt completed on 1.5.2 on any platform. The only Gemini key available is on the free tier, and Google returned 503 or 429 for each attempt on two days. These gates are open: - All 24 `antigravity-qualification` cells - Both model lineup suites, including inference on Gemini 4 Neon - The attended Google sign-in journey on 1.5.2 - The chat cases under Antigravity - Image pull time and startup time on a published image - A native start on `linux-arm64` - A live provider-death cell for Kimi, Pi or Copilot on the new launch store (one ordinary Pi cell passed live; see above) ## Risks - **The launch store changes how every native ACPX provider starts** (Kimi, Copilot, Cursor, Pi), not only Antigravity. A review found two defects in the first version (an executable swap was possible, and Pi launches broke). Both are fixed with tests. One live Pi cell passed on this branch on macOS. No live provider-death cell and no Linux cell ran for those providers. - The profile digest changes. Saved Antigravity candidate sessions and existing candidate grants stop working. The new release refuses old state by name and starts a replacement conversation. - The Linux provider pack and the Daytona image grow by about 834 MB (about 274 MB compressed) when Antigravity is included. - The pack verification record is in server memory. The first run after a server restart pays the full hash again. - Antigravity 1.5.2 reads the workspace `GEMINI.md` and `AGENTS.md` as user rules. This is deliberate and matches Codex. Any other rule file is refused. - Orchestrator mode is not available. ACP server 1.5.2 does not expose it. - Antigravity stays `pending`. Normal users cannot run it until a later change removes the pending status. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`) planned, briefed and integrated the work, with tool use. - Claude Opus 5.5 (`claude-opus-5-5`) subagents wrote the code and ran the tests, 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
310 lines
25 KiB
TypeScript
310 lines
25 KiB
TypeScript
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { QUALIFIED_ACPX_PROFILES } from "../../packages/paperclip-runner/src/drivers/acpx/qualified-profiles.js";
|
|
import { ANTIGRAVITY_DISTRIBUTION_PINS } from "../../packages/paperclip-runner/src/drivers/acpx/generated-profiles.js";
|
|
import { antigravityCandidateAdmissionForExecution, isAntigravityAdmittedExecution } from "./antigravity-admission.js";
|
|
import { ANTIGRAVITY_API_KEY_LINEUP, ANTIGRAVITY_GEMINI4_LINEUP, antigravityLineupProfileId } from "./antigravity-qualification-cases.js";
|
|
import { runnerMatrix, runnerSuites } from "./catalog.js";
|
|
import { buildRunnerE2EProcessEnvironment, buildPaperclipServerEnvironment } from "./harness-env.js";
|
|
import { evaluateMatchers } from "./matchers.js";
|
|
import { observeActiveStopPending, readActiveStopCaller, readActiveStopSettlement, readDeniedPermissionSettlement } from "./native-active-stop-evidence.js";
|
|
import { assertProviderLossSettlement } from "./native-provider-loss-flow.js";
|
|
import { buildMatrixJobs, daytonaCandidateProviders, parseRunnerSelectors, selectRunnerExecutions } from "./selectors.js";
|
|
import { readRestartRequest } from "./server-restart-request.js";
|
|
|
|
type Row = Record<string, any>;
|
|
const suiteId = "antigravity-qualification";
|
|
const cells = runnerMatrix.filter(cell => cell.suite.id === suiteId);
|
|
const companyId = "11111111-1111-4111-8111-111111111111";
|
|
const select = (...args: string[]) => selectRunnerExecutions(parseRunnerSelectors(args));
|
|
|
|
describe("Google Antigravity explicit Product qualification", () => {
|
|
it("lists twelve journeys in local and Daytona without entering --all", () => {
|
|
expect(cells).toHaveLength(24);
|
|
expect(new Set(cells.map(cell => cell.environment.id))).toEqual(new Set(["local", "daytona"]));
|
|
expect(new Set(cells.map(cell => cell.task.id))).toEqual(new Set([
|
|
"message-marker", "plan-revise-accept", "ask-question", "structured-question-resume", "structured-question-restart-resume",
|
|
"file-edit-validate", "warm-three-turn", "stop-new-resume", "continuity-restart", "pending-permission-stop", "permission-deny-stop", "pending-permission-provider-loss",
|
|
]));
|
|
expect(select("--suite", suiteId)).toHaveLength(24);
|
|
expect(select("--all").some(cell => cell.profile.qualificationCandidate === "antigravity")).toBe(false);
|
|
expect(() => select("--profile", "runner-acpx-antigravity")).toThrow("zero executions");
|
|
expect(runnerSuites.find(suite => suite.id === suiteId)?.definitionMetadata).toMatchObject({
|
|
model: "gemini-3.8-flash-low", authentication: "gemini-api-key", scheduling: "explicit-only",
|
|
qualification: QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus === "pending" ? "pending" : "qualified",
|
|
});
|
|
});
|
|
|
|
it("reuses the shared lifecycle fixtures on per-turn Daytona leases", () => {
|
|
const lifecycle = cells.filter(cell => cell.task.flow === "native_active_stop" || cell.task.flow === "native_provider_loss");
|
|
expect(lifecycle.map(cell => cell.task.id).sort()).toEqual(["pending-permission-provider-loss", "pending-permission-provider-loss", "pending-permission-stop", "pending-permission-stop", "permission-deny-stop", "permission-deny-stop"]);
|
|
const cursorLoss = runnerMatrix.find(cell => cell.suite.id === "native-provider-loss" && cell.environment.id === "local")!;
|
|
expect(cells.find(cell => cell.task.id === "pending-permission-provider-loss")!.task.buildPrompt("n")).toBe(cursorLoss.task.buildPrompt("n"));
|
|
for (const cell of lifecycle.filter(cell => cell.environment.id === "daytona")) expect(cell.environment.configurationKey).toBeUndefined();
|
|
const warmDaytona = cells.find(cell => cell.environment.id === "daytona" && cell.task.id === "message-marker")!;
|
|
expect(warmDaytona.environment).not.toBe(lifecycle.find(cell => cell.environment.id === "daytona")!.environment);
|
|
});
|
|
|
|
it("binds only the selected encrypted Gemini key on a per-turn native agent", () => {
|
|
const ref = { type: "secret_ref" as const, secretId: "22222222-2222-4222-8222-222222222222", version: "latest" as const };
|
|
for (const cell of cells) {
|
|
expect(cell.suite.manualOnly).toBe(true);
|
|
expect(cell.task.automaticRetryPolicy).toBe("single_attempt");
|
|
expect(cell.requiredCredentials).toEqual(cell.environment.id === "local" ? ["GEMINI_API_KEY"] : ["GEMINI_API_KEY", "DAYTONA_API_KEY"]);
|
|
expect(cell.profile).toMatchObject({ id: "runner-acpx-antigravity", qualificationCandidate: "antigravity", model: "gemini-3.8-flash-low", credential: "GEMINI_API_KEY" });
|
|
expect(cell.profile.buildAgent({ executionId: cell.id, environmentId: "env", environmentFixtureId: cell.environment.id,
|
|
workspacePath: "/workspace", secretRefs: { GEMINI_API_KEY: ref } })).toMatchObject({
|
|
adapterType: "paperclip_runner", adapterConfig: { provider: "acpx", acpxAgent: "antigravity", model: "gemini-3.8-flash-low",
|
|
lifecycleMode: "per_turn", timeoutSec: 120, env: { GEMINI_API_KEY: ref } },
|
|
});
|
|
}
|
|
});
|
|
|
|
it("admits CI matrix jobs for unattended cells but still refuses the attended journey", () => {
|
|
const jobs = buildMatrixJobs(select("--suite", suiteId));
|
|
expect(jobs).toHaveLength(24);
|
|
expect(new Set(jobs.map(job => job.credentialName))).toEqual(new Set(["GEMINI_API_KEY"]));
|
|
expect(jobs.filter(job => job.needsDaytona)).toHaveLength(12);
|
|
expect(() => buildMatrixJobs(select("--suite", "antigravity-agent-journey"))).toThrow("Attended connection journeys");
|
|
});
|
|
|
|
it("asks CI for an Antigravity image and controller pack only for pending Daytona cells", () => {
|
|
const pending = QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus === "pending";
|
|
expect(daytonaCandidateProviders(select("--suite", suiteId))).toEqual(pending ? ["antigravity"] : []);
|
|
expect(daytonaCandidateProviders(select("--suite", suiteId, "--environment", "local"))).toEqual([]);
|
|
// Released providers live in the default pack and are never requested.
|
|
expect(daytonaCandidateProviders(select("--id", "rolling-web-deployment.runner-acpx-kimi.daytona.recover-controller"))).toEqual([]);
|
|
});
|
|
|
|
it("keeps candidate authority out of the shared operator list and rejects unrelated suites", () => {
|
|
const cell = cells[0]!;
|
|
const ambient = { PAPERCLIP_RUNNER_ACPX_QUALIFICATION: "ambient", PAPERCLIP_ACPX_CANDIDATE_ADMISSION: "ambient" };
|
|
const env = buildRunnerE2EProcessEnvironment(ambient, cells);
|
|
expect(env.PAPERCLIP_RUNNER_ACPX_QUALIFICATION).toBeUndefined();
|
|
expect(env.PAPERCLIP_ACPX_CANDIDATE_ADMISSION).toBeUndefined();
|
|
for (const suite of [{ ...cell.suite, manualOnly: false }, { ...cell.suite, id: "extended-harnesses" }, { ...cell.suite, id: "kimi-qualification" }]) {
|
|
expect(() => buildRunnerE2EProcessEnvironment({}, [{ ...cell, suite }])).toThrow("explicit provider qualification suite");
|
|
}
|
|
expect(() => buildRunnerE2EProcessEnvironment({}, [{ ...cell, profile: { ...cell.profile, id: "unrelated-profile" } }])).toThrow("explicit provider qualification suite");
|
|
const chat = runnerMatrix.find(row => row.suite.id === "chat-features" && row.profile.qualificationCandidate === "antigravity")!;
|
|
expect(isAntigravityAdmittedExecution(chat)).toBe(true);
|
|
expect(isAntigravityAdmittedExecution({ ...chat, profile: { ...chat.profile, explicitOnly: undefined } })).toBe(false);
|
|
});
|
|
|
|
it("removes ambient Google credentials before starting the product server", () => {
|
|
const source = { GEMINI_API_KEY: "selected", GOOGLE_API_KEY: "ambient", GOOGLE_APPLICATION_CREDENTIALS: "/adc.json", GEMINI_HOME: "/login" };
|
|
const server = buildPaperclipServerEnvironment(source);
|
|
for (const name of Object.keys(source)) expect(server[name]).toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe("Antigravity company-bound candidate grant", () => {
|
|
const local = cells.find(cell => cell.environment.id === "local")!;
|
|
const remote = cells.find(cell => cell.environment.id === "daytona")!;
|
|
const pending = QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus === "pending";
|
|
|
|
it.runIf(pending)("binds the disposable company, exact model, digests and darwin-arm64 target", () => {
|
|
const now = Date.now();
|
|
expect(antigravityCandidateAdmissionForExecution(local, companyId, now, { platform: "darwin", arch: "arm64" })).toMatchObject({
|
|
schema: "paperclip.acpx-candidate-admission.v1", companyId, agent: "antigravity", model: "gemini-3.8-flash-low",
|
|
profileDigest: QUALIFIED_ACPX_PROFILES.antigravity.commandDigest, platform: "darwin", architecture: "arm64", expiresAt: now + 3_600_000,
|
|
});
|
|
expect(() => antigravityCandidateAdmissionForExecution(local, "not-a-company")).toThrow("exact disposable company");
|
|
expect(() => antigravityCandidateAdmissionForExecution({ ...local, suite: { ...local.suite, id: "extended-harnesses" } }, companyId)).toThrow("explicit Antigravity suite");
|
|
expect(antigravityCandidateAdmissionForExecution({ ...local, profile: { ...local.profile, qualificationCandidate: "kimi" } }, companyId)).toBeUndefined();
|
|
});
|
|
|
|
it.runIf(pending)("stages a linux-x64 grant with the patched closure for a Daytona cell on any controller host", () => {
|
|
const now = Date.now();
|
|
for (const host of [{ platform: "darwin", arch: "arm64" }, { platform: "linux", arch: "x64" }] as const) {
|
|
expect(antigravityCandidateAdmissionForExecution(remote, companyId, now, host)).toMatchObject({
|
|
companyId, agent: "antigravity", model: "gemini-3.8-flash-low", platform: "linux", architecture: "x64",
|
|
nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["linux-x64"].closureSha256}`, expiresAt: now + 3_600_000,
|
|
});
|
|
}
|
|
});
|
|
|
|
it.runIf(pending)("fails before provider spend on a target without an admitted closure", () => {
|
|
expect(() => antigravityCandidateAdmissionForExecution(local, companyId, Date.now(), { platform: "win32", arch: "x64" })).toThrow(/no admitted runtime closure|does not match/i);
|
|
});
|
|
|
|
it.runIf(pending)("stages the grant only for a selected Antigravity cell and its model", async () => {
|
|
const root = await mkdtemp(join(tmpdir(), "antigravity-restart-"));
|
|
try {
|
|
const path = join(root, "request.json"), grant = antigravityCandidateAdmissionForExecution(local, companyId, Date.now(), process)!;
|
|
if (`${process.platform}-${process.arch}` !== "darwin-arm64") return;
|
|
await writeFile(path, JSON.stringify({ requestId: "antigravity-startup", kimiCandidateAdmission: grant }));
|
|
await expect(readRestartRequest(path, [local.id])).resolves.toMatchObject({ kimiCandidateAdmission: { agent: "antigravity", companyId } });
|
|
await expect(readRestartRequest(path, [runnerMatrix.find(cell => cell.suite.id === "kimi-qualification")!.id])).rejects.toThrow("explicit Kimi or Antigravity");
|
|
await writeFile(path, JSON.stringify({ requestId: "antigravity-startup", kimiCandidateAdmission: { ...grant, model: "gemini-3.1-pro-low" } }));
|
|
await expect(readRestartRequest(path, [local.id])).rejects.toThrow("does not match the selected execution");
|
|
} finally { await rm(root, { recursive: true, force: true }); }
|
|
expect(remote.environment.expectedExecutionTarget.kind).toBe("remote");
|
|
});
|
|
|
|
it.runIf(!pending)("needs no grant once the profile is released", () => {
|
|
expect(antigravityCandidateAdmissionForExecution(local, companyId)).toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe("Antigravity model lineups", () => {
|
|
it("parameterises one exact-model cell per API-key and Gemini 4 model", () => {
|
|
for (const [suite, models] of [["antigravity-model-lineup", ANTIGRAVITY_API_KEY_LINEUP], ["antigravity-model-lineup-gemini4", ANTIGRAVITY_GEMINI4_LINEUP]] as const) {
|
|
const lineup = runnerMatrix.filter(cell => cell.suite.id === suite);
|
|
expect(lineup.map(cell => cell.profile.model)).toEqual(models);
|
|
expect(lineup.every(cell => cell.environment.id === "local" && cell.task.id === "model-receipt" && cell.id === `${suite}.${antigravityLineupProfileId(cell.profile.model)}.local.model-receipt`)).toBe(true);
|
|
expect(lineup.every(cell => cell.id.split(".").length === 4)).toBe(true);
|
|
expect(select("--suite", suite)).toHaveLength(models.length);
|
|
expect(lineup.every(isAntigravityAdmittedExecution)).toBe(true);
|
|
expect(() => buildRunnerE2EProcessEnvironment({}, lineup)).not.toThrow();
|
|
expect(buildMatrixJobs(lineup).every(job => job.credentialName === "GEMINI_API_KEY" && !job.needsDaytona)).toBe(true);
|
|
}
|
|
// Exactly what a 1.5.2 `gemini-api-key` session lists (live, prompt-free).
|
|
expect(ANTIGRAVITY_API_KEY_LINEUP).toEqual([
|
|
"gemini-3.8-flash-high", "gemini-3.8-flash-medium", "gemini-3.8-flash-low",
|
|
"gemini-3.7-flash-high", "gemini-3.7-flash-medium", "gemini-3.7-flash-low",
|
|
"gemini-3.6-flash-high", "gemini-3.6-flash-medium", "gemini-3.6-flash-low",
|
|
"gemini-3.5-flash-high", "gemini-3.5-flash-medium", "gemini-3.5-flash-low",
|
|
"gemini-3.1-pro-high", "gemini-3.1-pro-low",
|
|
]);
|
|
expect(ANTIGRAVITY_API_KEY_LINEUP).not.toContain("gemini-3.1-pro-extra_high");
|
|
// Each Gemini 4 family keeps its own levels; none offers minimal.
|
|
expect(ANTIGRAVITY_GEMINI4_LINEUP).toEqual([
|
|
"gemini-4-carbon-medium", "gemini-4-carbon-high", "gemini-4-carbon-low",
|
|
"gemini-4-neon-high", "gemini-4-neon-extra_high", "gemini-4-neon-medium", "gemini-4-neon-low",
|
|
"gemini-4-hydrogen-high", "gemini-4-hydrogen-extra_high", "gemini-4-hydrogen-medium", "gemini-4-hydrogen-low",
|
|
"gemini-4-argon-high", "gemini-4-argon-medium", "gemini-4-argon-low",
|
|
]);
|
|
expect(() => antigravityLineupProfileId("auto")).toThrow("Invalid Antigravity model ID");
|
|
});
|
|
|
|
it("requires the Runner's exact-model receipt, not merely a reply", async () => {
|
|
const cell = runnerMatrix.find(row => row.suite.id === "antigravity-model-lineup-gemini4" && row.profile.model === "gemini-4-neon-high")!;
|
|
const receiptMatchers = cell.task.buildMatchers("nonce", cell).filter(matcher => matcher.kind === "json_path");
|
|
expect(receiptMatchers).toHaveLength(4);
|
|
const run = (effectiveModel: string) => ({ runnerProfileJson: { nativeExecutionInput: { provider: { kind: "acpx", agent: "antigravity", model: "gemini-4-neon-high" } },
|
|
sessionCheckpoint: { providerIdentity: { requestedModel: "gemini-4-neon-high", effectiveModel } } } });
|
|
const grade = (value: Row) => evaluateMatchers(receiptMatchers, { message: "", json: { run: value } } as never);
|
|
expect((await grade(run("gemini-4-neon-high"))).every(result => result.passed)).toBe(true);
|
|
expect((await grade(run("gemini-4-neon-low"))).every(result => result.passed)).toBe(false);
|
|
expect((await grade({})).some(result => result.passed)).toBe(false);
|
|
});
|
|
});
|
|
|
|
describe("Antigravity opt-in profiles in shared eval suites", () => {
|
|
it.each(["chat-features", "native-completion"])("%s keeps Antigravity behind an explicit profile selector", suite => {
|
|
const all = select("--suite", suite);
|
|
expect(all.some(cell => cell.profile.qualificationCandidate === "antigravity")).toBe(false);
|
|
const opted = select("--suite", suite, "--profile", "runner-acpx-antigravity");
|
|
expect(opted.length).toBeGreaterThan(0);
|
|
expect(opted.every(cell => cell.profile.qualificationCandidate === "antigravity" && cell.profile.explicitOnly === true)).toBe(true);
|
|
expect(() => buildRunnerE2EProcessEnvironment({}, opted.slice(0, 1))).not.toThrow();
|
|
});
|
|
});
|
|
|
|
describe("Antigravity pending-permission lifecycle evidence", () => {
|
|
const caller = readActiveStopCaller({ deploymentMode: "local_trusted" }, { session: { userId: "local-board", id: "paperclip:local_implicit:local-board" } });
|
|
const cancellationRequestId = "11111111-2222-4333-8444-555555555555";
|
|
function fixture() {
|
|
const scope = { provider: "antigravity" as const, companyId: "company", issueId: "issue", runId: "run", target: "pc-denied/active-stop.txt" };
|
|
const row = (eventType: string, payload: Row): Row => {
|
|
const seq = events.length + 1;
|
|
return { companyId: "company", runId: "run", seq, eventType, protocolSchemaVersion: 1,
|
|
payload: { prpEvent: { schema: "paperclip.prp.event.v1", schemaVersion: 1, sourceKind: "runner", eventType, runId: "run", turnId: "turn",
|
|
normalizedSessionId: "session", sourceInstanceId: "runner", sourceSeq: seq, sourceEventId: `runner:run:${seq}`, emittedAt: "2026-11-22T00:00:00Z", payload } } };
|
|
};
|
|
const tool = (executionId: string, operation: string, target: string | null, status = "running") => ({ schema: "paperclip.tool.execution.v1", executionId, transport: "builtin", name: null, operation, target, status });
|
|
const events: Row[] = [];
|
|
const push = (eventType: string, payload: Row) => { events.push(row(eventType, payload)); };
|
|
push("tool.execution.started", tool("read-1", "read", "README.md"));
|
|
push("tool.execution.completed", tool("read-1", "read", "README.md", "completed"));
|
|
push("tool.execution.started", tool("write-1", "edit", scope.target));
|
|
push("runtime_request.created", { request: { schema: "paperclip.runtime_request.v2", type: "permission", requestKind: "permission_approval", status: "pending",
|
|
requestId: "request", turnId: "turn", itemId: "item", prompt: `Edit ${scope.target}`, details: { toolCallId: "write-1" },
|
|
choices: [{ key: "accept" }, { key: "decline" }], origin: { adapter: "acpx-runtime-sidecar", provider: "antigravity", method: "session/request_permission" } } });
|
|
const run: Row = { id: "run", companyId: "company", nativeIssueId: "issue", runtimeMode: "native", status: "running", resultJson: {}, error: null };
|
|
const issue: Row = { id: "issue", companyId: "company", status: "in_progress" };
|
|
const observe = () => observeActiveStopPending({ events, run, issue, scope, caller, cancellationRequestId });
|
|
return { scope, events, run, issue, push, tool, observe };
|
|
}
|
|
|
|
it("observes the exact pending native edit from canonical events alone", () => {
|
|
const f = fixture();
|
|
expect(f.observe()).toMatchObject({ requestId: "request", toolCallId: "write-1", turnId: "turn", normalizedSessionId: "session" });
|
|
});
|
|
|
|
it("rejects an extra mutation, a completed write, a foreign provider or a missing target", () => {
|
|
const extra = fixture(); extra.events.splice(2, 0, ...[]); extra.push("tool.execution.started", extra.tool("write-2", "edit", "other.txt"));
|
|
expect(() => extra.observe()).toThrow(/extra native operation/);
|
|
const done = fixture(); done.push("tool.execution.completed", done.tool("write-1", "edit", done.scope.target, "completed"));
|
|
expect(() => done.observe()).toThrow(/mutation lifecycle/);
|
|
const foreign = fixture(); foreign.events[3]!.payload.prpEvent.payload.request.origin.provider = "cursor";
|
|
expect(() => foreign.observe()).toThrow(/permission identity/);
|
|
const elsewhere = fixture(); elsewhere.events[2]!.payload.prpEvent.payload.target = null; elsewhere.events[3]!.payload.prpEvent.payload.request.prompt = "Edit file";
|
|
expect(() => elsewhere.observe()).toThrow(/mutation lifecycle/);
|
|
});
|
|
|
|
it("requires cancellation of the retained request for Stop and expiry for provider loss", () => {
|
|
const stop = fixture(), pending = stop.observe(), dispatchMonotonicNs = (BigInt(pending.observedMonotonicNs) + 1n).toString();
|
|
stop.push("runtime_request.cancelled", { requestId: "request", requestKind: "permission_approval", turnId: "turn", itemId: "item", reason: "turn_terminal" });
|
|
stop.push("turn.cancelled", { status: "cancelled", error: null });
|
|
expect(() => readActiveStopSettlement({ events: stop.events, run: stop.run, issue: stop.issue, pending, dispatchMonotonicNs })).toThrow(/acknowledgement/);
|
|
stop.run.status = "cancelled";
|
|
stop.run.resultJson = { startupCancellation: { cancellationRequestId, requestedBy: { type: "board", userId: "local-board" } }, nativeCancellation: {
|
|
schema: "paperclip.native-cancellation.v1", intentId: `native-cancellation:${cancellationRequestId}`, companyId: "company", runId: "run", issueId: "issue", scope: "run",
|
|
dispatched: true, dispatchState: "acknowledged", reasonCode: "cancellation_run_only", effects: ["release_run_resources"], intentAuditId: "intent", acknowledgementAuditId: "ack" } };
|
|
expect(readActiveStopSettlement({ events: stop.events, run: stop.run, issue: stop.issue, pending, dispatchMonotonicNs })).toMatchObject({ branch: "pending_permission_cancelled", replayAllowed: false });
|
|
|
|
const loss = fixture(), lost = loss.observe();
|
|
loss.push("runtime_request.expired", { requestId: "request", requestKind: "permission_approval", turnId: "turn", reason: "provider_process_lost", replayAllowed: false });
|
|
loss.push("turn.failed", { error: { code: "provider_transport_lost" } });
|
|
Object.assign(loss.run, { status: "failed", error: "Provider transport lost" }); loss.issue.status = "blocked";
|
|
expect(assertProviderLossSettlement(loss.run, loss.issue, loss.events, lost)).toMatchObject({ requestClosure: "runtime_request.expired", replayAllowed: false });
|
|
loss.push("tool.execution.completed", loss.tool("write-1", "edit", loss.scope.target, "completed"));
|
|
expect(() => assertProviderLossSettlement(loss.run, loss.issue, loss.events, lost)).toThrow(/completed mutation/);
|
|
});
|
|
|
|
it("requires a delivered decline of the exact request, no completed mutation and the operator's Stop", () => {
|
|
const acknowledged = (run: Row) => Object.assign(run, { status: "cancelled", resultJson: {
|
|
startupCancellation: { cancellationRequestId, requestedBy: { type: "board", userId: "local-board" } }, nativeCancellation: {
|
|
schema: "paperclip.native-cancellation.v1", intentId: `native-cancellation:${cancellationRequestId}`, companyId: "company", runId: "run", issueId: "issue", scope: "run",
|
|
dispatched: true, dispatchState: "acknowledged", reasonCode: "cancellation_run_only", effects: ["release_run_resources"], intentAuditId: "intent", acknowledgementAuditId: "ack" } } });
|
|
const denied = () => {
|
|
const f = fixture(), pending = f.observe();
|
|
f.push("runtime_request.resolved", { requestId: "request", requestKind: "permission_approval", turnId: "turn", itemId: "item", action: "decline" });
|
|
f.push("tool.execution.completed", f.tool("write-1", "edit", f.scope.target, "failed"));
|
|
return { ...f, pending };
|
|
};
|
|
const stopped = denied();
|
|
stopped.push("turn.cancelled", { status: "cancelled", error: null }); acknowledged(stopped.run);
|
|
expect(readDeniedPermissionSettlement({ events: stopped.events, run: stopped.run, issue: stopped.issue, pending: stopped.pending, stopDispatched: true }))
|
|
.toMatchObject({ branch: "denied_then_stopped", requestId: "request", replayAllowed: false });
|
|
// A cancellation nobody asked for is not this journey.
|
|
expect(() => readDeniedPermissionSettlement({ events: stopped.events, run: stopped.run, issue: stopped.issue, pending: stopped.pending, stopDispatched: false })).toThrow(/without the operator's Stop/);
|
|
|
|
const finished = denied();
|
|
finished.push("turn.completed", { status: "completed" }); finished.run.status = "succeeded";
|
|
expect(readDeniedPermissionSettlement({ events: finished.events, run: finished.run, issue: finished.issue, pending: finished.pending, stopDispatched: false }))
|
|
.toMatchObject({ branch: "denied_then_finished" });
|
|
finished.issue.status = "done";
|
|
expect(() => readDeniedPermissionSettlement({ events: finished.events, run: finished.run, issue: finished.issue, pending: finished.pending, stopDispatched: false })).toThrow(/claims completion/);
|
|
|
|
const accepted = fixture(), acceptedPending = accepted.observe();
|
|
accepted.push("runtime_request.resolved", { requestId: "request", requestKind: "permission_approval", turnId: "turn", itemId: "item", action: "accept" });
|
|
accepted.push("turn.cancelled", { status: "cancelled", error: null }); acknowledged(accepted.run);
|
|
expect(() => readDeniedPermissionSettlement({ events: accepted.events, run: accepted.run, issue: accepted.issue, pending: acceptedPending, stopDispatched: true })).toThrow(/denial was not delivered/);
|
|
|
|
const cancelledOnly = fixture(), cancelledPending = cancelledOnly.observe();
|
|
cancelledOnly.push("runtime_request.cancelled", { requestId: "request", requestKind: "permission_approval", turnId: "turn", itemId: "item", reason: "turn_terminal" });
|
|
cancelledOnly.push("turn.cancelled", { status: "cancelled", error: null }); acknowledged(cancelledOnly.run);
|
|
expect(() => readDeniedPermissionSettlement({ events: cancelledOnly.events, run: cancelledOnly.run, issue: cancelledOnly.issue, pending: cancelledPending, stopDispatched: true })).toThrow(/denial was not delivered/);
|
|
|
|
const written = denied();
|
|
written.events.pop(); written.push("tool.execution.completed", written.tool("write-1", "edit", written.scope.target, "completed"));
|
|
written.push("turn.cancelled", { status: "cancelled", error: null }); acknowledged(written.run);
|
|
expect(() => readDeniedPermissionSettlement({ events: written.events, run: written.run, issue: written.issue, pending: written.pending, stopDispatched: true })).toThrow();
|
|
});
|
|
});
|