From c5107f12feb3ebfcf53ed927ff48807cd61f0c52 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:02:06 -0600 Subject: [PATCH] feat(runner): flip Google Antigravity ACPX profile to qualified (#22939) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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 --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 --- .../2026-11-22-antigravity-qualification.md | 41 +++-- .../2026-11-25-antigravity-cloud-rollout.md | 26 +++- maps/agent-access-map/instance-operations.md | 7 +- maps/feature-map/instance-operations.md | 7 +- .../src/paperclip-runner-permissions.test.ts | 4 +- .../src/paperclip-runner-permissions.ts | 2 +- .../codex-local/src/ui/build-config.test.ts | 19 +-- .../codex-local/src/ui/build-config.ts | 2 +- packages/paperclip-runner/README.md | 42 ++--- packages/paperclip-runner/acpx-profiles.json | 5 +- .../src/acpx_candidate_admission.rs | 101 +++++-------- .../runner-core/src/acpx_provider_backend.rs | 13 +- .../runner-core/src/acpx_provider_session.rs | 82 +++------- .../runner-core/src/bin/paperclip-runnerd.rs | 5 +- .../crates/runner-core/src/durable/mod.rs | 8 +- .../crates/runner-core/src/durable/runner.rs | 8 +- .../src/generated_acpx_profiles.rs | 2 +- .../src/native_provider_backend.rs | 17 +-- .../tests/native_provider_backend.rs | 87 ++++++++--- .../antigravity-provider-pack-smoke.test.mjs | 6 +- .../scripts/candidate-provider-pack.test.mjs | 55 ++++--- .../scripts/release-provider-pack.test.mjs | 57 +++---- .../src/cli/acpx-runtime-sidecar.test.ts | 47 +++--- .../drivers/acpx/antigravity-models.test.ts | 45 +++--- ...date-admission.antigravity-release.test.ts | 5 +- .../drivers/acpx/candidate-admission.test.ts | 97 +++++------- .../src/drivers/acpx/capability-profiles.ts | 3 +- .../src/drivers/acpx/generated-profiles.ts | 3 +- .../acpx/profile-compatibility.test.ts | 3 +- .../antigravity-candidate-startup.test.ts | 131 +++------------- server/src/__tests__/adapter-routes.test.ts | 62 +++----- .../agent-adapter-validation-routes.test.ts | 44 ++---- .../antigravity-connection-probe.test.ts | 6 +- .../antigravity-save-refusal.test.ts | 55 +++---- server/src/routes/agents.ts | 4 +- .../native-runtime/acpx-qualification.test.ts | 18 ++- .../native-runtime/acpx-qualification.ts | 1 + .../antigravity-candidate-admission.test.ts | 86 +++-------- .../antigravity-release.test.ts | 143 +++++------------- .../native-session-executor.test.ts | 6 +- .../plugin-runner-probe-antigravity.test.ts | 4 +- .../native-runtime/provider-profile.ts | 4 +- tests/runner-e2e/catalog.test.ts | 6 +- .../controller-rolling-deployment.test.ts | 4 +- ui/src/lib/cloud-harness-policy.test.ts | 7 +- ui/src/lib/native-model-catalog.test.ts | 4 +- 46 files changed, 560 insertions(+), 824 deletions(-) diff --git a/doc/plans/2026-11-22-antigravity-qualification.md b/doc/plans/2026-11-22-antigravity-qualification.md index dd781c25cdc..67e0a53c8ac 100644 --- a/doc/plans/2026-11-22-antigravity-qualification.md +++ b/doc/plans/2026-11-22-antigravity-qualification.md @@ -155,8 +155,17 @@ Order: 1 and 2 in parallel; then 3, 4 and 5; then 6. ## Acceptance ledger -Profile state: **pending**. The qualification flip has not happened and must -not happen until every row marked NOT RUN below has passed live. +Profile state: **qualified** (profile revision `2`, flipped on 2026-11-25). + +**Owner waiver (2026-11-25):** The owner waived the `runner-e2e-paid` live +paid-key qualification gate as a blocker for flipping the profile from +`pending` to `qualified` so Antigravity can ship to `paperclip.staging` and be +tested there. All paid-key / Daytona / unattended rows below remain honestly +marked **NOT RUN** (deferred to staging and post-waiver paid verification; no +evidence is fabricated). `ACPX_CAPABILITY_PROFILES.antigravity.recovery` +remains `"unverified"` because no live `session/load` call has been observed. +Profile revision `2` refuses candidate-era v1 saved state permanently as +`provider_state_incompatible`. **First prompts completed on 1.5.2 on 2026-11-23, local darwin-arm64 only, Google sign-in route, model `gemini-3.8-flash-low`** (see "First live tasks" @@ -221,14 +230,18 @@ automatic retries, with no user action. This exposed three product issues: No live `session/load` call was observed in the logs, so the profile still must not claim `recovery: "session-load"`. -### Must pass live before the qualification flip +### Deferred live verification (waived as flip blocker on 2026-11-25) + +These items were waived by the owner on 2026-11-25 as blockers for the +`pending` -> `qualified` flip so Antigravity can be tested on +`paperclip.staging`, and remain NOT RUN until observed live: 1. All 24 `antigravity-qualification` cells, local (darwin-arm64) and Daytona (linux-x64). 2. The 14-cell API-key lineup, each with an accepted prompt. 3. The Gemini 4 lineup, including Neon at every level, on a paid key. 4. A live `session/load` observed before the profile claims - `recovery: "session-load"`. + `recovery: "session-load"` (profile keeps `recovery: "unverified"`). 5. The attended Google sign-in journey on 1.5.2 (local only). 6. Daytona image pull and startup time, measured. @@ -255,15 +268,12 @@ must not claim `recovery: "session-load"`. 4. Not supported: Google sign-in in a cloud sandbox, warm sessions, the Orchestrator model, `/swarm`, darwin-x64. -While the profile is pending, a cloud (Daytona) run needs an operator grant -for the company and exact model that names linux-x64 and the patched linux-x64 -closure, with an API-key connection, per-turn. The runner E2E harness stages -that grant for Daytona cells; a local cell's grant names the host instead. -With that grant, the agent picker offers Google Antigravity for a Core sandbox -or SSH environment that is linux-x64 with a supported glibc (or the managed -cloud image), and for this host only a grant that names this host. It offers -nothing for a plugin Runner-task environment (the warm Agent Computer in -Paperclip Cloud): that path cannot launch Antigravity yet (see Open decisions). +After the 2026-11-25 qualification flip (profile revision `2`), no operator +candidate grant is needed: ordinary runs and Core's `linux-x64` remote provider +pack admit Antigravity directly under `providers.antigravity`, and candidate +grants are rejected. A plugin Runner-task environment (the warm Agent Computer +in Paperclip Cloud) still requires the Cloud rollout items (SDK credential, +plugin/Launcher harness wiring, and ROM pin). ### Launch integrity follow-up (2026-11-22) @@ -423,8 +433,9 @@ this computer, and the experimental flag on. Then, on a task for that agent: Not proven live: Stop or kill on a Neon swarm; pressing Retry on a swarm (recovery never needed it); typing `/swarm` in the browser composer (the live runs used the comments API with the composer's structured request); the Linux -and cloud sandbox routes; the paid qualification cells and lineup suites. The -profile stays **pending** until an operator grants the flip. +and cloud sandbox routes; the paid qualification cells and lineup suites. +(The owner waived `runner-e2e-paid` on 2026-11-25 to flip the profile to +**qualified** for staging testing; these paid cells remain NOT RUN.) Facts above: local darwin-arm64 instance at commit 438ae60922, 2026-11-25, Google subscription sign-in. diff --git a/doc/plans/2026-11-25-antigravity-cloud-rollout.md b/doc/plans/2026-11-25-antigravity-cloud-rollout.md index 7424e9aa1f3..c2c55e885af 100644 --- a/doc/plans/2026-11-25-antigravity-cloud-rollout.md +++ b/doc/plans/2026-11-25-antigravity-cloud-rollout.md @@ -15,6 +15,11 @@ Owner decisions (2026-11-25): [harness availability](../harness-availability.md)). Cloud's harness list is a fleet `env_config` campaign on `PAPERCLIP_AVAILABLE_HARNESSES`; the canonical ID is `antigravity_runtime`. +- Waive `runner-e2e-paid` (item 7) as a blocker for the item 8 qualification + flip (`pending` to `qualified`, profile revision `2`, `recovery: "unverified"`) + so Antigravity can ship to `paperclip.staging` and be tested there. Paid-key + qualification rows stay marked NOT RUN in the qualification ledger until + actually executed. Evidence below was read on 2026-11-25 from Core `master` at `87083fe982` and paperclip-cloud `master` at `f3b9e76`. Between `87083fe982` and this PR's base, @@ -36,8 +41,10 @@ Copied from the kickoff success criteria. Re-read before saying "done". thread. 2. Recovery holds in Cloud: Stop works; a mid-run deploy or restart resumes, or Retry works (0% needed-retry target). -3. The profile is qualified (pending to qualified) on live evidence, per the - ledger rule, not on local-only proof. This needs a paid Gemini API key. +3. The profile is qualified (pending to qualified, profile revision `2`, + `recovery: "unverified"`) under the owner's 2026-11-25 waiver of + `runner-e2e-paid` so staging testing can proceed; the paid-key rows stay + marked NOT RUN in the ledger until run. 4. Cloud policy lists `antigravity_runtime` through a fleet `env_config` campaign: staging first and verified, production after. 5. Credentials: a person's Google token placed in a sandbox is scoped to that @@ -256,8 +263,12 @@ Reuse the Claude delivery for the token and the Codex path for write-back: ## 4. The qualification flip -Rule (ledger "Acceptance ledger"): the profile stays pending until every NOT -RUN row passes live. +Original rule (ledger "Acceptance ledger"): the profile stayed pending until +every NOT RUN row passed live. **Owner waiver (2026-11-25):** the owner waived +`runner-e2e-paid` as a flip blocker so item 8 can flip the profile to +`qualified` (profile revision `2`, keeping `recovery: "unverified"`) and ship +to `paperclip.staging` for live testing there. Every NOT RUN row below remains +NOT RUN (deferred, never marked passed). | NOT RUN row | Needs a paid Gemini key? | Can the sign-in route satisfy it? | | --- | --- | --- | @@ -332,8 +343,8 @@ in that repository. | 4 | Hosted Google sign-in (spike, then route and UI) | Core | `server/src/routes/ai-connections.ts`, `server/src/services/local-ai-login.ts`, `local-ai-browser-login.ts`, Runner `antigravity-auth.ts`, UI connection dialog | Spike answers the loopback question first. Then: on an authenticated public instance, a user completes Google sign-in by pasting the redirect; wrong `state`, reused code and another user's attempt are refused; the connection lists models | none | A | | 5 | Delete the saved Google sign-in on disconnect (no revoke at Google, see G10) | Core | AI connection removal and grant revocation paths, activity log | Disconnect deletes the saved sign-in (a shared one is kept; a failed delete keeps a retryable reference), the activity entry says in plain words that the sign-in stays valid at Google until the person removes it there, a later run asks to reconnect | none | A | | 6 | Allow Antigravity on plugin Runner-task and remote sign-in targets | Core | `antigravity-release.ts`, `antigravity-connection-probe.ts` (use the plugin probe path, `server/src/services/native-runtime/plugin-runner-probe.ts`), `antigravity-connection-policy.ts`, `antigravity-runner-credentials.ts`, `agents.ts` | Tested against a released-profile fixture (the real profile is still pending when this merges): picker offers Antigravity on a plugin environment; Test runs the plugin probe; save and run accept sign-in on remote targets when 2 is present. The Core sandbox path gets the same sign-in support. Re-verified live in item 12 | 1, 2, 3 | C | -| 7 | Qualification runs on a paid key | Core (ledger) | `doc/plans/2026-11-22-antigravity-qualification.md` | All NOT RUN rows in section 4 pass live (24 cells local and Daytona, both lineups, session-load or no claim, attended sign-in journey, image pull time) | paid key (owner) | A (starts when the key exists) | -| 8 | Flip Antigravity from pending to qualified | Core | `packages/paperclip-runner` release declaration and generated profiles, capability profile, docs, UI copy | Ledger rule met; the Core image's provider pack includes the closure without a candidate flag; no operator grant needed | 7, 3 | D | +| 7 | Qualification runs on a paid key (waived as item 8 blocker on 2026-11-25; deferred) | Core (ledger) | `doc/plans/2026-11-22-antigravity-qualification.md` | All NOT RUN rows in section 4 pass live (24 cells local and Daytona, both lineups, session-load or no claim, attended sign-in journey, image pull time) | paid key (owner) | A (deferred) | +| 8 | Flip Antigravity from pending to qualified | Core | `packages/paperclip-runner` release declaration and generated profiles (profile v2), capability profile (`recovery: "unverified"`), adapter-utils, server routes/profile/qualification, docs | Owner waiver recorded honestly in ledger; the Core image's `linux-x64` provider pack includes the closure without a candidate flag; no operator grant needed | 3 (7 waived on 2026-11-25) | D | | 9 | Run Antigravity on agent computers through ACPX | Cloud | `extensions/plugin-agent-computer/src/harnesses.ts`, `agent-computer/harness/harnesses.json`, `harness.go`, Launcher `task_credentials.go`, `configured_environment.go`, `agent-computer/runtime/select-pack.mjs`, `assemble.mjs`, `pack-manifest.mjs`, `verify*.mjs`, tests (copy Cloud #1696) | Row `antigravity`: driver `acpx`, `acpxAgent: "antigravity"`, `projectAuthProvider: "google"`, credential `task-env` with key sets `GEMINI_API_KEY` or the sign-in key, reserved prefixes `GEMINI_` and `GOOGLE_`, reserved exact key `PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET` with a negative test (a configured or project environment that sets it is refused), blocked project settings for `.gemini/settings.json` endpoint and key fields, the Runner's runtime root (so `agentHomeDirectory`) in the private task path, with a test that a concurrent task of the same agent cannot read the staged file, `/proc//environ` or Runner memory, per-turn, closure under `provider-assets/antigravity/linux-x64` copied into the ROM. Tests pin the two tables together | 1, 2 (types); ROM content needs 8 | B (code), E (ROM) | | 10 | Pin the Runner ROM to a Core with the flip | Cloud | `agent-computer/runner-source.lock.json`, `runner-pnpm-lock.yaml` | ROM and fleet sandbox image build; closure verified at build; ROM size, build time, boot and first-token time recorded before and after | 8, 9 | E | | 11 | Staging policy campaign | Fleet (operator action, no code) | `env_config` campaign with the full array plus `antigravity_runtime`, canary first | Staging `/api/health` lists the exact array; picker shows Google Antigravity | 10 deployed on staging, 6 deployed | F | @@ -355,7 +366,8 @@ broader or production exposure (items 13 and 14). ## 7. Waiting on the owner - **Paid Gemini API key** in the `runner-e2e-paid` environment's - `GEMINI_API_KEY` secret. Blocks 7, therefore 8 onward. + `GEMINI_API_KEY` secret. Waived as an item 8 flip blocker on 2026-11-25; + still needed for deferred unattended paid-key CI runs (item 7). - **Ledger rule:** accept either the API-key-only suite as written, or allow attended sign-in evidence for the lifecycle rows (section 4). - **Production go-ahead** for item 14 (outward-facing). diff --git a/maps/agent-access-map/instance-operations.md b/maps/agent-access-map/instance-operations.md index 3e16c8f9306..5ebc5107f3f 100644 --- a/maps/agent-access-map/instance-operations.md +++ b/maps/agent-access-map/instance-operations.md @@ -256,10 +256,11 @@ Verification: `not-run` — Inspect setup identity/path and repeat reuse on an o Gaps: Source-checkout setup, different platforms, remote Cursor, provider execution, and published-package acceptance remain separate scopes. Local fixture materialization does not establish remote model readiness. -Antigravity addition (2026-10-28): `paperclipai runtime setup antigravity` stages +Antigravity addition (2026-10-28; updated 2026-11-25): `paperclipai runtime setup antigravity` stages the verified official and patched two-executable closures on macOS ARM64. The -operator-only authority above is unchanged. The native profile remains pending -at API, driver, sidecar and Rust admission; a company grant cannot enable it. +operator-only authority above is unchanged. The native profile is qualified +(revision 2, `recovery: "unverified"`) at API, driver, sidecar and Rust admission +under the 2026-11-25 owner waiver of `runner-e2e-paid` for staging verification. Google AI API-key binding is distinct from Workspace OAuth. Evidence remains `source-only` for agent access: [setup](../../cli/src/commands/runtime.ts), [provisioner](../../packages/paperclip-runner/scripts/provision-antigravity.mjs), diff --git a/maps/feature-map/instance-operations.md b/maps/feature-map/instance-operations.md index eed5ba4161b..93b409c99c5 100644 --- a/maps/feature-map/instance-operations.md +++ b/maps/feature-map/instance-operations.md @@ -33,7 +33,7 @@ Use currently visible instance settings for experiments/access and `paperclipai ### `runtime-provisioning` -On an owned published server installation, use `paperclipai runtime setup pi`, `paperclipai runtime setup cursor`, `paperclipai runtime setup antigravity`, or `paperclipai runtime import-remote --sha256 `. Run as the OS user operating that installation; this is separate from source-checkout dependency installation. Antigravity setup stages a pinned patched macOS ARM64 runtime; it remains unavailable for tasks until native acceptance passes. +On an owned published server installation, use `paperclipai runtime setup pi`, `paperclipai runtime setup cursor`, `paperclipai runtime setup antigravity`, or `paperclipai runtime import-remote --sha256 `. Run as the OS user operating that installation; this is separate from source-checkout dependency installation. Antigravity setup stages a pinned patched macOS ARM64 runtime; the native profile is qualified (revision 2, `recovery: "unverified"`) with paid-key qualification suites deferred to staging. ## Driving it with Playwright and the Paperclip CLI @@ -109,9 +109,8 @@ Sources: [Runtime CLI](../../cli/src/commands/runtime.ts), [instance-config bypa Antigravity: [provisioning](../../packages/paperclip-runner/scripts/provision-antigravity.mjs), [closure/integrity regressions](../../packages/paperclip-runner/scripts/materialize-antigravity-distribution.test.mjs), -and [pending admission tests](../../packages/paperclip-runner/src/drivers/acpx/antigravity-models.test.ts). -Exercise public-layout setup and verify both native files and cleanup; separately -verify that configuration/API/driver/sidecar reject the pending provider. These +and [model/admission tests](../../packages/paperclip-runner/src/drivers/acpx/antigravity-models.test.ts). +Exercise public-layout setup and verify both native files and cleanup. These checks do not establish authenticated task execution. ## Gotchas diff --git a/packages/adapter-utils/src/paperclip-runner-permissions.test.ts b/packages/adapter-utils/src/paperclip-runner-permissions.test.ts index b06823c854c..95b8ee16043 100644 --- a/packages/adapter-utils/src/paperclip-runner-permissions.test.ts +++ b/packages/adapter-utils/src/paperclip-runner-permissions.test.ts @@ -12,9 +12,11 @@ import { } from "./paperclip-runner-permissions.js"; describe("Paperclip Runner permission defaults", () => { - it("exposes qualified Kimi Code with an explicit runtime credential", () => { + it("exposes qualified Kimi Code and Google Antigravity with explicit runtime credentials", () => { expect(PAPERCLIP_RUNNER_ACPX_PROFILES.find(profile => profile.value === "kimi")) .toMatchObject({ qualified: true, credentialEnvironment: ["KIMI_API_KEY"] }); + expect(PAPERCLIP_RUNNER_ACPX_PROFILES.find(profile => profile.value === "antigravity")) + .toMatchObject({ qualified: true, credentialEnvironment: ["GEMINI_API_KEY"] }); }); it("marks Pi and Copilot qualified with their provider credential bindings", () => { expect(PAPERCLIP_RUNNER_ACPX_PROFILES.find(profile => profile.value === "pi")) diff --git a/packages/adapter-utils/src/paperclip-runner-permissions.ts b/packages/adapter-utils/src/paperclip-runner-permissions.ts index fd55f4804e9..d34e7be58f1 100644 --- a/packages/adapter-utils/src/paperclip-runner-permissions.ts +++ b/packages/adapter-utils/src/paperclip-runner-permissions.ts @@ -268,7 +268,7 @@ export const PAPERCLIP_RUNNER_ACPX_PROFILES = Object.freeze([ { value: "copilot", label: "GitHub Copilot", qualified: true, credentialEnvironment: ["COPILOT_GITHUB_TOKEN"] }, { value: "pi", label: "Pi", qualified: true, credentialEnvironment: ["OPENROUTER_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GEMINI_API_KEY"] }, { value: "kimi", label: "Kimi Code", qualified: true, credentialEnvironment: ["KIMI_API_KEY"] }, - { value: "antigravity", label: "Google Antigravity", qualified: false, credentialEnvironment: ["GEMINI_API_KEY"] }, + { value: "antigravity", label: "Google Antigravity", qualified: true, credentialEnvironment: ["GEMINI_API_KEY"] }, ] as const); /** Exact Pi native thinking levels; aliases that silently clamp are not configuration. */ diff --git a/packages/adapters/codex-local/src/ui/build-config.test.ts b/packages/adapters/codex-local/src/ui/build-config.test.ts index 512c533d8d7..f8a6a801203 100644 --- a/packages/adapters/codex-local/src/ui/build-config.test.ts +++ b/packages/adapters/codex-local/src/ui/build-config.test.ts @@ -54,18 +54,15 @@ describe("buildCodexLocalConfig", () => { expect(() => buildPaperclipRunnerConfig(makeValues({ model: "", adapterSchemaValues: { provider: "acpx", acpxAgent: "kimi" } }))) .toThrow("kimi requires an explicit provider model"); }); - it("refuses pending Antigravity selection before saving Runner config", () => { - expect(() => buildPaperclipRunnerConfig(makeValues({ model: "exact-antigravity-model", + it("round-trips qualified Google Antigravity with its exact selected model", () => { + const first = buildPaperclipRunnerConfig(makeValues({ model: "exact-antigravity-model", + adapterSchemaValues: { provider: "acpx", acpxAgent: "antigravity" } })); + const reopened = buildPaperclipRunnerConfig(makeValues({ model: "", adapterSchemaValues: JSON.parse(JSON.stringify(first)) })); + expect(reopened).toMatchObject({ provider: "acpx", acpxAgent: "antigravity", model: "exact-antigravity-model" }); + expect(first).not.toHaveProperty("candidateHarnesses"); + expect(() => buildPaperclipRunnerConfig(makeValues({ model: "", adapterSchemaValues: { provider: "acpx", acpxAgent: "antigravity" } }))) - .toThrow("Google Antigravity is not enabled for production"); - }); - it("builds only the exact candidate model from non-persisted UI context", () => { - const values = makeValues({ model: "exact-antigravity-model", adapterSchemaValues: { provider: "acpx", acpxAgent: "antigravity" } }); - const context = { candidateHarnesses: [{ agent: "antigravity" as const, model: "exact-antigravity-model" }] }; - expect(buildPaperclipRunnerConfig(values, context)).toMatchObject({ provider: "acpx", acpxAgent: "antigravity", model: values.model }); - expect(buildPaperclipRunnerConfig(values, context)).not.toHaveProperty("candidateHarnesses"); - expect(() => buildPaperclipRunnerConfig({ ...values, model: "another-model" }, context)).toThrow(); - expect(() => buildPaperclipRunnerConfig(values)).toThrow(); + .toThrow("antigravity requires an explicit provider model"); }); it("preserves explicitly disabled hosted search in native Codex configuration", () => { diff --git a/packages/adapters/codex-local/src/ui/build-config.ts b/packages/adapters/codex-local/src/ui/build-config.ts index 3da01e754a3..6d3e5dbf538 100644 --- a/packages/adapters/codex-local/src/ui/build-config.ts +++ b/packages/adapters/codex-local/src/ui/build-config.ts @@ -143,7 +143,7 @@ export function buildPaperclipRunnerConfig(v: CreateConfigValues, context?: { if (provider === "acpx" && acpxAgent === "copilot" && (!configuredModel && !schemaModel || ["auto", "default"].includes((configuredModel || schemaModel).toLowerCase()))) { throw new Error("Select an available Copilot model before saving."); } - if (provider === "acpx" && ["cursor", "pi", "kimi"].includes(acpxAgent) && !configuredModel && !schemaModel) { + if (provider === "acpx" && ["cursor", "pi", "kimi", "antigravity"].includes(acpxAgent) && !configuredModel && !schemaModel) { throw new Error(`${acpxAgent} requires an explicit provider model`); } const managedProfileId = typeof schemaValues.managedProfileId === "string" diff --git a/packages/paperclip-runner/README.md b/packages/paperclip-runner/README.md index dfea449bb16..669281e3426 100644 --- a/packages/paperclip-runner/README.md +++ b/packages/paperclip-runner/README.md @@ -307,29 +307,29 @@ blocks new imports rather than resetting the budget. See the [local qualification record](../../doc/plans/2026-10-28-cursor-cloud-native-runner.md) for runnable acceptance cells and the remaining live qualification gates. -Google Antigravity is an **unqualified, pending** native ACPX integration on -Google's official ACP server 1.5.2 with Paperclip's owned admission patch -(`1.5.2-paperclip.2`). The explicit `paperclipai runtime setup antigravity` -command installs it on macOS ARM64, Linux x64 and Linux ARM64; macOS Intel stays -inventory-only (no native host). Setup verifies both the official vendor closure -and the separately pinned patched closure; npm installation downloads no -Antigravity runtime. The Daytona image and remote provider pack carry the Linux -x64 closure only when built with `--candidate-providers=antigravity`; while the -profile is pending it is listed under `candidateProviders`. +Google Antigravity is a **qualified** (profile revision `2`, `recovery: +"unverified"`) native ACPX integration on Google's official ACP server 1.5.2 +with Paperclip's owned admission patch (`1.5.2-paperclip.2`). The explicit +`paperclipai runtime setup antigravity` command installs it on macOS ARM64, +Linux x64 and Linux ARM64; macOS Intel stays inventory-only (no native host). +Setup verifies both the official vendor closure and the separately pinned +patched closure; npm installation downloads no Antigravity runtime. The Core +image's `linux-x64` remote provider pack includes the patched Linux x64 closure +under `providers.antigravity` without any candidate flag. Two connection routes exist: a Gemini API key (`gemini-api-key`, locally and in -a cloud environment once released) and personal Google sign-in (Paperclip host -only, one turn at a time). Agent save and Test refuse any other combination in -plain language. Models are the server's own catalog. The 1.5.2 catalog lists -Gemini 4 families only for Agent Platform, but patch `1.5.2-paperclip.2` admits -an exact requested model ID under an API key, so Gemini 4 (Neon included) runs -on the API-key route with a paid key; a refused model is named with its fix. Global release qualification remains pending and normal execution -admission stays closed: an isolated operator can admit one company, exact -model, execution platform (this host, or linux-x64 for a cloud environment with -an API key) and pinned patched closure/profile, per-turn only, until a fixed -expiry through trusted server startup authority. Live acceptance on 1.5.2 (API key, Linux, -Daytona, the model lineups) has not passed yet. Google Workspace OAuth does not -substitute for a runtime credential. See the +a cloud environment) and personal Google sign-in (Paperclip host only, one turn +at a time). Agent save and Test refuse any other combination in plain language. +Models are the server's own catalog. The 1.5.2 catalog lists Gemini 4 families +only for Agent Platform, but patch `1.5.2-paperclip.2` admits an exact +requested model ID under an API key, so Gemini 4 (Neon included) runs on the +API-key route with a paid key; a refused model is named with its fix. Release +qualification was flipped on 2026-11-25 under an owner waiver of the +`runner-e2e-paid` gate so Antigravity can be tested on staging; no operator +candidate grant is accepted or needed, candidate-era v1 saved state is refused +as `provider_state_incompatible`, and paid-key qualification suites remain +deferred/NOT RUN in the ledger. Google Workspace OAuth does not substitute for +a runtime credential. See the [current qualification plan](../../doc/plans/2026-11-22-antigravity-qualification.md) and the [October integration record](../../doc/plans/2026-10-28-antigravity-integration.md). diff --git a/packages/paperclip-runner/acpx-profiles.json b/packages/paperclip-runner/acpx-profiles.json index 72a4f5874e6..1c9313a77c8 100644 --- a/packages/paperclip-runner/acpx-profiles.json +++ b/packages/paperclip-runner/acpx-profiles.json @@ -5,14 +5,13 @@ "protocolVersion": 1, "profiles": { "antigravity": { - "agentProfileVersion": 1, + "agentProfileVersion": 2, "agentServerPackage": "native:antigravity-acp", "agentServerVersion": "1.5.2", "agentRuntimePackage": "native:antigravity-localharness", "agentRuntimeVersion": "1.5.2", "commandDigest": "sha256:61ac14bf03ce4bbf8afe1f5a263b854517ec588d8407fe2d8f17c9fc0c037c4b", - "requiresProviderPolicy": true, - "qualificationStatus": "pending" + "requiresProviderPolicy": true }, "grok": { "agentProfileVersion": 20, diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_candidate_admission.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_candidate_admission.rs index 56fbe151ae5..d38d8341283 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_candidate_admission.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_candidate_admission.rs @@ -23,51 +23,8 @@ fn native_host_matches(platform: &str, architecture: &str, os: &str, host_arch: } /// The generated release profile that runtime qualification gates read. -/// -/// Every gate that depends on `qualification_pending` reads it here, so tests -/// can exercise the released state of a still-pending profile exactly as the -/// declaration change at qualification would produce it. pub(crate) fn release_profile(agent: &str) -> Option { - #[allow(unused_mut)] - let mut profile = acpx_release_profile(agent)?; - #[cfg(test)] - if released_for_test::contains(agent) { - profile.qualification_pending = false; - } - Some(profile) -} - -/// Test-only simulation of a profile flipped to released on this thread. -#[cfg(test)] -pub(crate) mod released_for_test { - use std::cell::RefCell; - - thread_local! { - static RELEASED: RefCell> = const { RefCell::new(Vec::new()) }; - } - - pub(crate) fn contains(agent: &str) -> bool { - RELEASED.with(|released| released.borrow().iter().any(|name| name == agent)) - } - - /// Treats `agent` as released until the guard drops. - pub(crate) fn release(agent: &str) -> Guard { - RELEASED.with(|released| released.borrow_mut().push(agent.to_owned())); - Guard(agent.to_owned()) - } - - pub(crate) struct Guard(String); - - impl Drop for Guard { - fn drop(&mut self) { - RELEASED.with(|released| { - let mut released = released.borrow_mut(); - if let Some(index) = released.iter().position(|name| *name == self.0) { - released.remove(index); - } - }); - } - } + acpx_release_profile(agent) } /// Operator authority supplied only through trusted process startup. Company @@ -267,13 +224,23 @@ mod tests { ("linux", "arm64", "linux", "aarch64"), ]; + fn pending_antigravity_profile() -> AcpxReleaseProfile { + AcpxReleaseProfile { + qualification_pending: true, + ..acpx_release_profile("antigravity").unwrap() + } + } + #[test] fn candidate_record_is_strict_and_pinned_to_native_host_and_time() { assert!(antigravity_native_closure("darwin", "x64").is_none()); + let pending = pending_antigravity_profile(); for (platform, architecture, os, host_arch) in ANTIGRAVITY_HOSTS { let candidate = antigravity_admission(platform, architecture); let now = candidate.expires_at - 1; - candidate.validate_at(now, os, host_arch).unwrap(); + candidate + .validate_against_profile(&pending, now, os, host_arch) + .unwrap(); for (other_os, other_arch) in [ ("macos", "aarch64"), ("macos", "x86_64"), @@ -282,14 +249,21 @@ mod tests { ("windows", "x86_64"), ] { if (other_os, other_arch) != (os, host_arch) { - assert!(candidate.validate_at(now, other_os, other_arch).is_err()); + assert!(candidate + .validate_against_profile(&pending, now, other_os, other_arch) + .is_err()); } } assert!(candidate - .validate_at(candidate.expires_at, os, host_arch) + .validate_against_profile(&pending, candidate.expires_at, os, host_arch) .is_err()); assert!(candidate - .validate_at(candidate.expires_at - MAX_LIFETIME_MS - 1, os, host_arch) + .validate_against_profile( + &pending, + candidate.expires_at - MAX_LIFETIME_MS - 1, + os, + host_arch, + ) .is_err()); let other_platform = if platform == "linux" { "darwin" @@ -317,7 +291,9 @@ mod tests { changed[field] = value; let changed: AcpxCandidateAdmission = serde_json::from_value(changed).unwrap(); assert!( - changed.validate_at(now, os, host_arch).is_err(), + changed + .validate_against_profile(&pending, now, os, host_arch) + .is_err(), "{platform}-{architecture}: {field}" ); } @@ -339,9 +315,9 @@ mod tests { ))] fn candidate_binds_actual_launch_and_does_not_echo_bad_input() { let candidate = test_admission("run-1", "session-1"); - candidate + assert!(candidate .validate_binding("antigravity", "explicit-model", "run-1", "session-1") - .unwrap(); + .is_err()); for expected in [ ("copilot", "explicit-model", "run-1", "session-1"), ("antigravity", "another-model", "run-1", "session-1"), @@ -356,20 +332,11 @@ mod tests { assert!(!error.to_string().contains("private")); } - /// The generated Antigravity profile with its qualification flipped to - /// released, exactly as the declaration change at qualification would. - pub(crate) fn released_antigravity_profile() -> AcpxReleaseProfile { - AcpxReleaseProfile { - qualification_pending: false, - ..acpx_release_profile("antigravity").unwrap() - } - } - #[test] fn released_antigravity_rejects_candidate_records_on_every_native_platform() { - let pending = acpx_release_profile("antigravity").unwrap(); - assert!(pending.qualification_pending); - let released = released_antigravity_profile(); + let released = acpx_release_profile("antigravity").unwrap(); + assert!(!released.qualification_pending); + let pending = pending_antigravity_profile(); for (platform, architecture, os, host_arch) in ANTIGRAVITY_HOSTS { let candidate = antigravity_admission(platform, architecture); let now = candidate.expires_at - 1; @@ -382,6 +349,10 @@ mod tests { .is_err(), "{platform}-{architecture}" ); + assert!( + candidate.validate_at(now, os, host_arch).is_err(), + "{platform}-{architecture}" + ); let mut next = candidate.clone(); next.run_id = "run-2".to_owned(); assert!(next @@ -399,14 +370,12 @@ mod tests { ) ))] fn released_antigravity_rejects_startup_and_binding_records() { - let current = test_admission("run-1", "session-1"); - current.validate().unwrap(); - let _released = released_for_test::release("antigravity"); assert!( !release_profile("antigravity") .unwrap() .qualification_pending ); + let current = test_admission("run-1", "session-1"); assert!(current.validate().is_err()); assert!(current .validate_binding("antigravity", "explicit-model", "run-1", "session-1") diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs index d4f9f067991..407f3dff8d7 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_backend.rs @@ -6262,17 +6262,16 @@ mod tests { config.validate().map_err(|error| error.to_string())?; Ok::<_, String>(config) }; - // Pending: an ordinary launch is refused until an operator grant. - let pending = launch(profile).unwrap_err(); - assert!(pending.contains("qualification is pending"), "{pending}"); + assert!( + !crate::generated_acpx_profiles::acpx_release_profile("antigravity") + .unwrap() + .qualification_pending + ); let mut granted = profile.clone(); granted.candidate_admission = Some(antigravity_grant("run-1")); let mut candidate_config = config.clone(); candidate_config.acpx_launch_profile = Some(granted.clone()); - candidate_config.validate().unwrap(); - launch(&granted).unwrap(); - let _released = crate::acpx_candidate_admission::released_for_test::release("antigravity"); // Released: the ordinary launch needs no grant ... let ordinary = launch(profile).unwrap(); assert!(ordinary.candidate_admission.is_none()); @@ -6288,7 +6287,6 @@ mod tests { #[test] #[cfg(unix)] fn released_antigravity_without_grant_restores_suspends_and_attaches_a_prior_activation() { - let _released = crate::acpx_candidate_admission::released_for_test::release("antigravity"); let (directory, config, value, sentinel) = ordinary_antigravity_fixture("antigravity-released-cold", "run-2"); let mut recovered = AcpxCommandExecutor::with_runner_config(&directory, &config); @@ -6322,7 +6320,6 @@ mod tests { #[test] #[cfg(unix)] fn released_antigravity_without_grant_rotates_a_live_runner_authority() { - let _released = crate::acpx_candidate_admission::released_for_test::release("antigravity"); let (directory, config, value, sentinel) = ordinary_antigravity_fixture("antigravity-released-warm", "run-1"); let mut executor = AcpxCommandExecutor::with_runner_config(&directory, &config); diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs index 7e2f1936e28..d01a8908cff 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/acpx_provider_session.rs @@ -2504,77 +2504,35 @@ mod mode_tests { } } #[test] - fn pending_profile_cannot_launch_even_with_explicit_policy() { + fn released_antigravity_launches_with_explicit_policy_and_without_candidate_grant() { let mut config = config(); config.agent = "antigravity".to_owned(); + config.mode = None; config.pi_thinking_level = None; - assert!(config - .validate() - .unwrap_err() - .to_string() - .contains("qualification is pending")); - } - - #[test] - #[cfg(any( - all(target_os = "macos", target_arch = "aarch64"), - all( - target_os = "linux", - any(target_arch = "x86_64", target_arch = "aarch64") - ) - ))] - fn candidate_admission_is_bound_and_carried_through_both_bootstrap_requests() { - let mut cfg = config(); - assert!(initialize_params(&cfg).get("candidateAdmission").is_none()); - assert!(session_open_params(&cfg, &[]) + config.validate().unwrap(); + assert!(initialize_params(&config) .get("candidateAdmission") .is_none()); - cfg.agent = "antigravity".to_owned(); - cfg.mode = None; - let admission = crate::acpx_candidate_admission::test_admission( - &cfg.run_id, - &cfg.normalized_session_id, - ); - cfg.candidate_admission = Some(admission.clone()); - cfg.validate().unwrap(); - assert_eq!( - initialize_params(&cfg)["candidateAdmission"], - json!(admission) - ); - assert_eq!( - session_open_params(&cfg, &[])["candidateAdmission"], - json!(admission) - ); - // A granted /swarm turn keeps the same grant and names its provider mode; + assert!(session_open_params(&config, &[]) + .get("candidateAdmission") + .is_none()); + // A /swarm turn keeps no candidate grant and names its provider mode; // the sidecar, not the Runner, decides which agent modes it accepts. - let mut swarm = cfg.clone(); + let mut swarm = config.clone(); swarm.mode = Some("swarm".to_owned()); swarm.validate().unwrap(); - let open = session_open_params(&swarm, &[]); - assert_eq!(open["candidateAdmission"], json!(admission)); - assert_eq!(open["mode"], json!("swarm")); - assert_eq!( - initialize_params(&swarm)["candidateAdmission"], - json!(admission) + assert_eq!(session_open_params(&swarm, &[])["mode"], json!("swarm")); + assert!(session_open_params(&swarm, &[]) + .get("candidateAdmission") + .is_none()); + // Released Antigravity refuses any injected candidate grant. + let admission = crate::acpx_candidate_admission::test_admission( + &config.run_id, + &config.normalized_session_id, ); - for (field, value) in [ - ("run", "different-run"), - ("session", "different-session"), - ("model", "different-model"), - ("agent", "codex"), - ] { - let mut invalid = cfg.clone(); - match field { - "run" => invalid.run_id = value.to_owned(), - "session" => invalid.normalized_session_id = value.to_owned(), - "model" => invalid.model = value.to_owned(), - "agent" => invalid.agent = value.to_owned(), - _ => unreachable!(), - } - assert!(invalid.validate().is_err(), "{field}"); - } - cfg.candidate_admission.as_mut().unwrap().expires_at = 0; - assert!(cfg.validate().is_err()); + let mut granted = config.clone(); + granted.candidate_admission = Some(admission); + assert!(granted.validate().is_err()); } #[test] diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/bin/paperclip-runnerd.rs b/packages/paperclip-runner/runner/crates/runner-core/src/bin/paperclip-runnerd.rs index ff41d9a0481..63fdfc7c0d9 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/bin/paperclip-runnerd.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/bin/paperclip-runnerd.rs @@ -935,8 +935,9 @@ mod tests { "--acpx-sidecar-script-sha256".to_owned(), format!("sha256:{}", "c".repeat(64)), ]); - let parsed = acpx_launch_profile(&args).unwrap().unwrap(); - assert_eq!(parsed.candidate_admission.unwrap().run_id, "run-1"); + // Released Antigravity refuses any candidate startup grant even with a + // complete launch profile. + assert!(acpx_launch_profile(&args).is_err()); assert!(acpx_launch_profile(&[]).unwrap().is_none()); } diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs b/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs index 956b70d426d..a8e31052635 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/durable/mod.rs @@ -499,8 +499,14 @@ mod tests { let candidate = profile.canonical_digest().unwrap(); assert_ne!(ordinary, candidate); let mut config = config(); - config.acpx_launch_profile = Some(profile.clone()); + config.acpx_launch_profile = Some(AcpxLaunchProfile { + candidate_admission: None, + ..profile.clone() + }); config.validate().unwrap(); + // Released Antigravity rejects any candidate grant attached to config. + config.acpx_launch_profile = Some(profile.clone()); + assert!(config.validate().is_err()); config.run_id = "wrong-run".to_owned(); assert!(config.validate().is_err()); profile.candidate_admission.as_mut().unwrap().company_id = "company-2".to_owned(); diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs b/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs index 0ca7a47526d..d29b8bb6389 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/durable/runner.rs @@ -6574,6 +6574,11 @@ mod tests { ) ))] fn released_antigravity_handoff_uses_ordinary_authority_and_rejects_candidate_injection() { + assert!( + !crate::generated_acpx_profiles::acpx_release_profile("antigravity") + .unwrap() + .qualification_pending + ); let directory = std::env::temp_dir().join(format!("antigravity-grant-handoff-{}", std::process::id())); let mut current = config(directory); @@ -6596,10 +6601,7 @@ mod tests { candidate_admission: Some(grant.clone()), ..ordinary.clone() }); - // Pending: the grant admits this run's startup. - candidate.validate().unwrap(); - let _released = crate::acpx_candidate_admission::released_for_test::release("antigravity"); current.acpx_launch_profile = Some(ordinary); current.validate().unwrap(); let mut next_grant = grant.clone(); diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs b/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs index 24549f50bc6..5530cbbfc4d 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/generated_acpx_profiles.rs @@ -53,7 +53,7 @@ pub(crate) fn acpx_release_profile(agent: &str) -> Option { command_digest: "sha256:61ac14bf03ce4bbf8afe1f5a263b854517ec588d8407fe2d8f17c9fc0c037c4b", requires_provider_policy: true, - qualification_pending: true, + qualification_pending: false, }, "grok" => AcpxReleaseProfile { agent_server_package: "builtin:grok-acp", diff --git a/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs index c674d654b1a..2a2f98fcac7 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/src/native_provider_backend.rs @@ -658,6 +658,11 @@ mod tests { ) ))] fn released_antigravity_without_grant_recovers_a_prior_activation() { + assert!( + !crate::generated_acpx_profiles::acpx_release_profile("antigravity") + .unwrap() + .qualification_pending + ); let directory = std::env::temp_dir().join(format!( "paperclip-native-released-antigravity-{}", uuid::Uuid::new_v4() @@ -684,18 +689,6 @@ mod tests { ..ordinary.clone() }, ); - candidate.validate().unwrap(); - let refused = NativeProviderCommandExecutor::with_runner_config(&directory, &candidate) - .select_recovery() - .unwrap_err(); - assert!( - refused - .to_string() - .contains("cannot adopt a prior durable runner activation"), - "{refused}" - ); - - let _released = crate::acpx_candidate_admission::released_for_test::release("antigravity"); assert!(candidate.validate().is_err()); let ordinary = config(&directory, ordinary); ordinary.validate().unwrap(); diff --git a/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs b/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs index b72b30952e4..a0c21f38c9a 100644 --- a/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs +++ b/packages/paperclip-runner/runner/crates/runner-core/tests/native_provider_backend.rs @@ -185,7 +185,10 @@ fn acpx_config(state_dir: &Path, mode: &str) -> DurableRunnerConfig { any(target_arch = "x86_64", target_arch = "aarch64") ) ))] -fn candidate_fixture(directory: &Path) -> (DurableRunnerConfig, Value) { +fn antigravity_fixture( + directory: &Path, + with_candidate_admission: bool, +) -> (DurableRunnerConfig, Value) { use paperclip_runner_core::acpx_candidate_admission::AcpxCandidateAdmission; let profiles: Value = serde_json::from_str(include_str!("../../../../acpx-profiles.json")).unwrap(); @@ -199,17 +202,47 @@ fn candidate_fixture(directory: &Path) -> (DurableRunnerConfig, Value) { } else { ("linux", "arm64") }; - let admission = AcpxCandidateAdmission::parse_json(&json!({ - "schema":"paperclip.acpx-candidate-admission.v1", "companyId":"company-1", - "agent":"antigravity", "model":"explicit-test-model", "profileDigest":profile["commandDigest"], - "nativeClosureDigest":format!("sha256:{}",distributions["platforms"][format!("{platform}-{architecture}")]["closureSha256"].as_str().unwrap()), - "platform":platform, "architecture":architecture, "expiresAt":SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64 + 60_000, - "runId":"run-1", "normalizedSessionId":"session-1" - }).to_string()).unwrap(); + let digest = profile["commandDigest"].as_str().unwrap().to_owned(); let mut config = acpx_config(directory, "turns-reserved-result-terminal"); let launch = config.acpx_launch_profile.as_mut().unwrap(); - *launch.args.last_mut().unwrap() = admission.profile_digest.clone(); - launch.candidate_admission = Some(admission); + *launch.args.last_mut().unwrap() = digest.clone(); + if with_candidate_admission { + let closure = format!( + "sha256:{}", + distributions["platforms"][format!("{platform}-{architecture}")]["closureSha256"] + .as_str() + .unwrap() + ); + let expires_at = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis() as u64 + + 60_000; + let encoded = json!({ + "schema":"paperclip.acpx-candidate-admission.v1", "companyId":"company-1", + "agent":"antigravity", "model":"explicit-test-model", "profileDigest":digest, + "nativeClosureDigest":closure, "platform":platform, "architecture":architecture, + "expiresAt":expires_at, "runId":"run-1", "normalizedSessionId":"session-1" + }) + .to_string(); + assert!( + AcpxCandidateAdmission::parse_json(&encoded).is_err(), + "released Antigravity profile must reject candidate grants at parse_json" + ); + launch.candidate_admission = Some(AcpxCandidateAdmission { + schema: "paperclip.acpx-candidate-admission.v1".to_owned(), + company_id: "company-1".to_owned(), + agent: "antigravity".to_owned(), + model: "explicit-test-model".to_owned(), + profile_digest: digest, + native_closure_digest: closure, + platform: platform.to_owned(), + architecture: architecture.to_owned(), + expires_at, + run_id: "run-1".to_owned(), + normalized_session_id: "session-1".to_owned(), + }); + } let mut payload = prepare_payload(directory, "antigravity"); let provider = &mut payload["provider"]; for field in [ @@ -236,7 +269,7 @@ fn candidate_fixture(directory: &Path) -> (DurableRunnerConfig, Value) { ))] fn candidate_cannot_change_provider_kind_or_adopt_prior_activation() { let directory = temporary_directory("candidate-provider-authority"); - let (config, mut payload) = candidate_fixture(&directory); + let (config, mut payload) = antigravity_fixture(&directory, true); for kind in [ "codex", "opencode", @@ -264,11 +297,16 @@ fn candidate_cannot_change_provider_kind_or_adopt_prior_activation() { } payload["paperclipNextAuthority"] = json!({}); let mut executor = NativeProviderCommandExecutor::with_runner_config(&directory, &config); - assert!(executor + let attach_error = executor .execute(&command(1, "run.attach", payload)) .unwrap_err() - .to_string() - .contains("cannot rotate a live runner authority")); + .to_string(); + assert!( + attach_error.contains("cannot rotate a live runner authority") + || attach_error + .contains("ACPX candidate admission is missing, expired, or does not match"), + "unexpected run.attach error: {attach_error}" + ); assert!(!directory.join("acpx-provider-state.json").exists()); fs::write(directory.join("codex-provider-state.json"), b"{}").unwrap(); let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config); @@ -288,9 +326,16 @@ fn candidate_cannot_change_provider_kind_or_adopt_prior_activation() { any(target_arch = "x86_64", target_arch = "aarch64") ) ))] -fn candidate_verified_cold_session_retires_on_suspend_instead_of_warm_adoption() { - let directory = temporary_directory("candidate-cold-session"); - let (config, payload) = candidate_fixture(&directory); +fn qualified_antigravity_session_opens_without_candidate_grant_and_suspends_cleanly() { + let directory = temporary_directory("antigravity-qualified-session"); + let (stale_config, stale_payload) = antigravity_fixture(&directory, true); + let mut stale_executor = + NativeProviderCommandExecutor::with_runner_config(&directory, &stale_config); + assert!(stale_executor + .execute(&command(1, "run.prepare", stale_payload)) + .is_err()); + + let (config, payload) = antigravity_fixture(&directory, false); let mut executor = NativeProviderCommandExecutor::with_runner_config(&directory, &config); executor .execute(&command(1, "run.prepare", payload)) @@ -299,17 +344,15 @@ fn candidate_verified_cold_session_retires_on_suspend_instead_of_warm_adoption() .execute(&command(2, "session.open", json!({}))) .unwrap(); assert_eq!(opened.result["status"], "started"); - let closed = executor + let suspended = executor .execute(&command(3, "runner.suspend", json!({}))) .unwrap(); - assert_eq!(closed.result["status"], "closed"); + assert_eq!(suspended.result["status"], "completed"); let state: Value = serde_json::from_slice(&fs::read(directory.join("acpx-provider-state.json")).unwrap()) .unwrap(); - assert_eq!(state["lifecycle"], "closed"); + assert_eq!(state["lifecycle"], "suspended"); executor.shutdown().unwrap(); - let mut recovered = NativeProviderCommandExecutor::with_runner_config(&directory, &config); - assert!(recovered.poll_events().is_err()); fs::remove_dir_all(directory).unwrap(); } diff --git a/packages/paperclip-runner/scripts/antigravity-provider-pack-smoke.test.mjs b/packages/paperclip-runner/scripts/antigravity-provider-pack-smoke.test.mjs index 0a188da8ccc..ee1ee713d08 100644 --- a/packages/paperclip-runner/scripts/antigravity-provider-pack-smoke.test.mjs +++ b/packages/paperclip-runner/scripts/antigravity-provider-pack-smoke.test.mjs @@ -7,7 +7,7 @@ import distributions from "../antigravity-distributions.json" with { type: "json const pins = Object.fromEntries(Object.entries(distributions.platforms).filter(([, platform]) => platform.provisioning === "verified-closure") .map(([target, platform]) => [target, { closureSha256: platform.closureSha256 }])); -const released = () => { const { qualificationStatus: _pending, ...profile } = profiles.profiles.antigravity; return profile; }; +const pending = () => ({ ...profiles.profiles.antigravity, qualificationStatus: "pending" }); function fixture(profile, target = "linux-x64") { const [platform, architecture] = target.split("-"); @@ -19,8 +19,8 @@ function fixture(profile, target = "linux-x64") { } for (const [name, profile, inventory, other] of [ - ["pending", profiles.profiles.antigravity, "candidateProviders", "providers"], - ["released", released(), "providers", "candidateProviders"], + ["pending", pending(), "candidateProviders", "providers"], + ["released", profiles.profiles.antigravity, "providers", "candidateProviders"], ]) { test(`${name} smoke accepts only the ${inventory} entry with the patched linux-x64 closure`, () => { const manifest = fixture(profile); diff --git a/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs b/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs index c8148fa66ac..59646d31586 100644 --- a/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs +++ b/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs @@ -72,7 +72,11 @@ test("Kimi's candidate builder rejects invalid paths before any public download" }); test("normal packs include Cursor and Copilot on their three pinned targets without breaking other hosts", () => { for (const [platform, architecture] of [["darwin", "arm64"], ["darwin", "x64"], ["linux", "x64"]]) { - assert.deepEqual(providerPackProviders(platform, architecture, []), ["pi", "cursor", "copilot", ...((platform === "darwin" && architecture === "arm64") || platform === "linux" ? ["kimi"] : [])]); + assert.deepEqual(providerPackProviders(platform, architecture, []), [ + "pi", "cursor", "copilot", + ...((platform === "darwin" && architecture === "arm64") || platform === "linux" ? ["kimi"] : []), + ...(platform === "linux" && architecture === "x64" ? ["antigravity"] : []), + ]); assert.deepEqual(providerPackProviders(platform, architecture, ["cursor"]), providerPackProviders(platform, architecture, [])); } assert.deepEqual(providerPackProviders("linux", "arm64", []), []); @@ -117,41 +121,42 @@ test("Pi pack selection reaches its pinned builder and rejects unsafe output bef assert.equal(requests, 0); }); -test("pending Antigravity is an explicit linux-x64 candidate and never an ordinary provider", () => { - const antigravity = { version: "1.5.2", qualification: "pending", profileDigest: "sha256:profile", closureDigest: "sha256:closure" }; - assert.equal(profiles.profiles.antigravity.qualificationStatus, "pending"); +test("released Antigravity enters ordinary linux-x64 inventory without a candidate flag", () => { + const antigravity = { version: "1.5.2", qualification: "qualified", profileDigest: "sha256:profile", closureDigest: "sha256:closure" }; + assert.equal(profiles.profiles.antigravity.qualificationStatus, undefined); assert.deepEqual(parseProviderPackArguments(["/pack", "--candidate-providers=antigravity"]), { output: "/pack", candidates: ["antigravity"] }); - assert.equal(providerPackProviders("linux", "x64", []).includes("antigravity"), false); + assert.equal(providerPackProviders("linux", "x64", []).filter(provider => provider === "antigravity").length, 1); assert.equal(providerPackProviders("linux", "x64", ["antigravity"]).filter(provider => provider === "antigravity").length, 1); for (const [platform, architecture] of [["darwin", "arm64"], ["darwin", "x64"], ["linux", "arm64"], ["win32", "x64"]]) { assert.equal(providerPackProviders(platform, architecture, []).includes("antigravity"), false); assert.throws(() => providerPackProviders(platform, architecture, ["antigravity"]), /only for linux-x64/); } - assert.equal(providerPackQualification("antigravity"), "pending"); - const fields = providerPackManifestFields({ antigravity }, ["antigravity"]); - assert.deepEqual(fields.candidateProviders, { antigravity }); - assert.equal(fields.providers?.antigravity, undefined); - assert.equal(providerPackManifestFields({ antigravity }, []).candidateProviders?.antigravity, undefined); - assert.equal(digest(JSON.parse(JSON.stringify(fields))), digest(fields)); + assert.equal(providerPackQualification("antigravity"), "qualified"); + for (const candidates of [[], ["antigravity"]]) { + const fields = providerPackManifestFields({ antigravity }, candidates); + assert.equal(fields.providers.antigravity, antigravity); + assert.equal(fields.candidateProviders?.antigravity, undefined); + assert.equal(digest(JSON.parse(JSON.stringify(fields))), digest(fields)); + } }); -test("released Antigravity flips to ordinary linux-x64 inventory with its profile status alone", () => { - const antigravity = { version: "1.5.2", qualification: "qualified", profileDigest: "sha256:profile", closureDigest: "sha256:closure" }; +test("pending Antigravity stays an explicit linux-x64 candidate when marked pending", () => { + const antigravity = { version: "1.5.2", qualification: "pending", profileDigest: "sha256:profile", closureDigest: "sha256:closure" }; const original = profiles.profiles.antigravity.qualificationStatus; try { - delete profiles.profiles.antigravity.qualificationStatus; - assert.equal(providerPackProviders("linux", "x64", []).filter(provider => provider === "antigravity").length, 1); + profiles.profiles.antigravity.qualificationStatus = "pending"; + assert.equal(providerPackProviders("linux", "x64", []).includes("antigravity"), false); assert.equal(providerPackProviders("linux", "x64", ["antigravity"]).filter(provider => provider === "antigravity").length, 1); - for (const [platform, architecture] of [["darwin", "arm64"], ["linux", "arm64"]]) { - assert.equal(providerPackProviders(platform, architecture, []).includes("antigravity"), false); - } - assert.equal(providerPackQualification("antigravity"), "qualified"); - for (const candidates of [[], ["antigravity"]]) { - const fields = providerPackManifestFields({ antigravity }, candidates); - assert.equal(fields.providers.antigravity, antigravity); - assert.equal(fields.candidateProviders?.antigravity, undefined); - } - } finally { profiles.profiles.antigravity.qualificationStatus = original; } + assert.equal(providerPackQualification("antigravity"), "pending"); + const fields = providerPackManifestFields({ antigravity }, ["antigravity"]); + assert.deepEqual(fields.candidateProviders, { antigravity }); + assert.equal(fields.providers?.antigravity, undefined); + assert.equal(providerPackManifestFields({ antigravity }, []).candidateProviders?.antigravity, undefined); + assert.equal(digest(JSON.parse(JSON.stringify(fields))), digest(fields)); + } finally { + if (original === undefined) delete profiles.profiles.antigravity.qualificationStatus; + else profiles.profiles.antigravity.qualificationStatus = original; + } }); test("Antigravity pack builder keeps only this release's patched closure", async () => { diff --git a/packages/paperclip-runner/scripts/release-provider-pack.test.mjs b/packages/paperclip-runner/scripts/release-provider-pack.test.mjs index fd8e09b87f7..19865fe9c98 100644 --- a/packages/paperclip-runner/scripts/release-provider-pack.test.mjs +++ b/packages/paperclip-runner/scripts/release-provider-pack.test.mjs @@ -31,6 +31,10 @@ function fixture() { 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, @@ -209,32 +213,33 @@ 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 releasedAntigravityProfiles() { - const released = structuredClone(profiles); delete released.profiles.antigravity.qualificationStatus; return released; +function pendingAntigravityProfiles() { + const pending = structuredClone(profiles); pending.profiles.antigravity.qualificationStatus = "pending"; return pending; } -test("pending Antigravity may ship only as one patched linux-x64 candidate", () => { - assert.equal(antigravityProfile.qualificationStatus, "pending"); - const absent = seal(fixture()); - assert.equal(verifyReleaseProviderPack(absent, revision), absent); - const candidate = fixture(); candidate.candidateProviders = { antigravity: antigravityEntry("pending") }; - assert.equal(verifyReleaseProviderPack(seal(candidate), revision).payload, candidate); - const promoted = fixture(); promoted.providers.antigravity = antigravityEntry("qualified"); - assert.throws(() => verifyReleaseProviderPack(seal(promoted), revision), /Antigravity identity/); - const both = fixture(); both.providers.antigravity = antigravityEntry("pending"); both.candidateProviders = { antigravity: antigravityEntry("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("released Antigravity requires one ordinary identity and never a candidate", () => { - const released = releasedAntigravityProfiles(); - const expected = { profiles: released, distributions, kimiClosures, antigravityDistributions }; - const payload = fixture(); payload.providers.antigravity = antigravityEntry("qualified"); - assert.equal(verifyReleaseProviderPack(seal(payload), revision, "linux-x64", expected).payload, payload); - const missing = fixture(); - assert.throws(() => verifyReleaseProviderPack(seal(missing), revision, "linux-x64", expected), /Antigravity identity/); - const candidate = fixture(); candidate.candidateProviders = { antigravity: antigravityEntry("pending") }; - assert.throws(() => verifyReleaseProviderPack(seal(candidate), revision, "linux-x64", expected), /Antigravity identity/); - const both = structuredClone(payload); both.candidateProviders = { antigravity: antigravityEntry("pending") }; +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/); }); @@ -243,17 +248,17 @@ for (const [name, change] of [ ["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: "qualified" }], ["extra field", { executable: "agy_acp_server.par" }], -]) test(`rejects an Antigravity candidate with a stale ${name}`, () => { - const payload = fixture(); payload.candidateProviders = { antigravity: { ...antigravityEntry("pending"), ...change } }; + ["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.candidateProviders = { antigravity: { ...antigravityEntry("pending"), - profileDigest: frozenProfiles.profiles.antigravity.commandDigest, closureDigest: `sha256:${"c".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); diff --git a/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts b/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts index 4b59557162c..c29cb5f5398 100644 --- a/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts +++ b/packages/paperclip-runner/src/cli/acpx-runtime-sidecar.test.ts @@ -2118,50 +2118,41 @@ describe("qualified ACPX runtime sidecar", () => { expect(await sidecar.next(value => value.id === 2)).toMatchObject({ ok: false, error: { message: expect.stringContaining("candidate admission") } }); }); - it("refuses pending Antigravity bootstrap before any native process opens", async () => { + it("initializes qualified Antigravity without a candidate grant and rejects any injected candidate grant", async () => { const sidecar = startSidecar(); - sidecar.write(initializeRequest(1, "antigravity", "caller-exact-model")); - expect(await sidecar.next(frame => frame.id === 1)).toMatchObject({ id: 1, ok: false, - error: { message: expect.stringContaining("qualification is pending"), retryable: false } }); - }); + const model = "caller-exact-model"; + const profile = resolveQualifiedAcpxProfile("antigravity", model); + expect(profile.agentProfileVersion).toBe(2); + expect(profile.qualificationStatus).toBeUndefined(); + sidecar.write(initializeRequest(1, "antigravity", model)); + expect(await sidecar.next(frame => frame.id === 1)).toMatchObject({ id: 1, ok: true, result: { profile } }); - it.skipIf(process.platform !== "darwin" || process.arch !== "arm64")("admits only matching candidate startup and rejects session replay before provider launch", async () => { - const sidecar = startSidecar(); - const model = "gemini-3.8-flash-low"; - const candidateAdmission = bindAcpxCandidateAdmission({ schema: "paperclip.acpx-candidate-admission.v1", companyId: "company-candidate", agent: "antigravity", model, - profileDigest: resolveQualifiedAcpxProfile("antigravity", model).commandDigest, + const withGrant = startSidecar(); + const candidateAdmission = { schema: "paperclip.acpx-candidate-admission.v1", companyId: "company-candidate", agent: "antigravity", model, + profileDigest: profile.commandDigest, nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["darwin-arm64"].closureSha256}`, - platform: "darwin", architecture: "arm64", expiresAt: Date.now() + 60_000 }, { runId: "run-candidate", normalizedSessionId: "session-candidate" }); + platform: "darwin", architecture: "arm64", expiresAt: Date.now() + 60_000, runId: "run-candidate", normalizedSessionId: "session-candidate" }; const request = initializeRequest(1, "antigravity", model); - sidecar.write({ ...request, params: { ...request.params, candidateAdmission } }); - expect(await sidecar.next(frame => frame.id === 1)).toMatchObject({ ok: true, result: { profile: { agent: "antigravity", qualificationStatus: "pending", reportedModelId: model } } }); - sidecar.write({ protocolVersion: ACPX_SIDECAR_PROTOCOL_VERSION, id: 2, command: "session.open", params: { - runtimeDirectory: "/unused", workingDirectory: "/unused", normalizedSessionId: "other-session", agent: "antigravity", model, - candidateAdmission, permissionMode: "deny-all", permissionModePinned: true, providerPolicy: { readOnly: true }, systemInstructions: "", tools: [], - } }); - expect(await sidecar.next(frame => frame.id === 2)).toMatchObject({ ok: false, error: { message: expect.stringContaining("candidate admission") } }); + withGrant.write({ ...request, params: { ...request.params, candidateAdmission } }); + expect(await withGrant.next(frame => frame.id === 1)).toMatchObject({ id: 1, ok: false, + error: { message: expect.stringContaining("candidate admission"), retryable: false } }); }); // Live /swarm runs failed here: the open parser accepted a provider mode only - // for Cursor, so a granted swarm session.open never reached the swarm route. + // for Cursor, so an Antigravity swarm session.open never reached the swarm route. it.skipIf(!Object.hasOwn(ANTIGRAVITY_DISTRIBUTION_PINS, `${process.platform}-${process.arch}`))( - "carries a granted Antigravity swarm session.open to the swarm route and its typed refusal", async () => { + "carries a qualified Antigravity swarm session.open to the swarm route and its typed refusal", async () => { const model = "gemini-3.8-flash-low", sessionId = "session-swarm"; const root = realpathSync(mkdtempSync(join(tmpdir(), "acpx-swarm-open-"))); for (const directory of ["runtime-2", "workspace"]) mkdirSync(join(root, directory), { mode: 0o700 }); - const platform = process.platform as "darwin" | "linux", architecture = process.arch as "arm64" | "x64"; - const candidateAdmission = bindAcpxCandidateAdmission({ schema: "paperclip.acpx-candidate-admission.v1", companyId: "company-candidate", agent: "antigravity", model, - profileDigest: resolveQualifiedAcpxProfile("antigravity", model).commandDigest, - nativeClosureDigest: `sha256:${(ANTIGRAVITY_DISTRIBUTION_PINS as Record)[`${platform}-${architecture}`]!.closureSha256}`, - platform, architecture, expiresAt: Date.now() + 60_000 }, { runId: "run-swarm", normalizedSessionId: sessionId }); const open = (sidecar: SidecarProcess, id: number, mode: string) => sidecar.write({ protocolVersion: ACPX_SIDECAR_PROTOCOL_VERSION, id, command: "session.open", params: { runtimeDirectory: join(root, `runtime-${id}`), workingDirectory: join(root, "workspace"), normalizedSessionId: sessionId, agent: "antigravity", model, mode, - candidateAdmission, permissionMode: "approve-all", permissionModePinned: false, providerPolicy: { readOnly: false }, systemInstructions: "Paperclip instructions", tools: [] } }); + permissionMode: "approve-all", permissionModePinned: false, providerPolicy: { readOnly: false }, systemInstructions: "Paperclip instructions", tools: [] } }); try { // A Gemini API key run (no Google sign-in binding): the swarm route itself refuses, typed, with a plain message. const sidecar = startSidecar(); const request = initializeRequest(1, "antigravity", model); - sidecar.write({ ...request, params: { ...request.params, candidateAdmission } }); + sidecar.write(request); expect(await sidecar.next(frame => frame.id === 1)).toMatchObject({ ok: true }); open(sidecar, 2, "swarm"); const refused = await sidecar.next(frame => frame.id === 2); @@ -2172,7 +2163,7 @@ describe("qualified ACPX runtime sidecar", () => { // Only the registered provider modes pass the parser; the refusal names its contract. const other = startSidecar(); - other.write({ ...request, params: { ...request.params, candidateAdmission } }); + other.write(request); expect(await other.next(frame => frame.id === 1)).toMatchObject({ ok: true }); open(other, 2, "plan"); expect(await other.next(frame => frame.id === 2)).toMatchObject({ ok: false, diff --git a/packages/paperclip-runner/src/drivers/acpx/antigravity-models.test.ts b/packages/paperclip-runner/src/drivers/acpx/antigravity-models.test.ts index bae59ea0f9f..6efcfaf824f 100644 --- a/packages/paperclip-runner/src/drivers/acpx/antigravity-models.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/antigravity-models.test.ts @@ -138,46 +138,45 @@ describe("Antigravity session-free account model discovery", () => { }, 40_000); }); -describe("Antigravity pending release boundaries", () => { - it("retains release admission for existing providers, including Copilot's separate capability status", () => { - for (const agent of ["claude", "codex", "grok", "cursor", "pi", "copilot"] as const) { +describe("Antigravity qualified release boundaries", () => { + it("retains release admission for all qualified providers, including Copilot's separate capability status", () => { + for (const agent of ["claude", "codex", "grok", "cursor", "pi", "copilot", "kimi", "antigravity"] as const) { expect(() => assertAcpxProfileReleased(agent)).not.toThrow(); } expect(acpxCapabilities("copilot")).toMatchObject({ typedEvents: true, dynamicTools: true }); }); - it("preserves the caller's exact model separately from release admission", () => { - expect(resolveQualifiedAcpxProfile("antigravity", "caller-exact-model")).toMatchObject({ - agent: "antigravity", qualificationStatus: "pending", qualificationModel: "caller-exact-model", reportedModelId: "caller-exact-model", + it("preserves the caller's exact model under the qualified revision 2 profile", () => { + const profile = resolveQualifiedAcpxProfile("antigravity", "caller-exact-model"); + expect(profile).toMatchObject({ + agent: "antigravity", agentProfileVersion: 2, qualificationModel: "caller-exact-model", reportedModelId: "caller-exact-model", }); + expect(profile.qualificationStatus).toBeUndefined(); expect(validateAcpxDriverConfig({ agent: "antigravity", model: "caller-exact-model" })) - .toMatchObject({ ok: false, issues: [{ path: "agent", code: "qualification_pending" }] }); - expect(() => assertAcpxProfileReleased("antigravity")).toThrow(expect.objectContaining({ code: "ACPX_PROFILE_QUALIFICATION_PENDING" })); + .toEqual({ ok: true, config: { agent: "antigravity", model: "caller-exact-model", permissionMode: "approve-all" }, issues: [] }); + expect(() => assertAcpxProfileReleased("antigravity")).not.toThrow(); }); - it("advertises no accepted runtime or context capabilities", () => { + it("advertises qualified runtime capabilities while keeping recovery and usage unverified", () => { expect(acpxDriverDescriptor("antigravity")).toMatchObject({ displayName: "Google Antigravity via ACPX", - runtimeContextCapabilities: { instructions: "unsupported", skills: "unsupported", mcp: "unsupported" } }); - for (const value of Object.values(acpxCapabilities("antigravity"))) { - if (typeof value === "boolean") expect(value).toBe(false); - } + runtimeContextCapabilities: { instructions: "native", skills: "native", mcp: "native" } }); + expect(acpxCapabilities("antigravity")).toMatchObject({ + resume: false, toolRefreshOnResume: false, typedEvents: true, interruption: true, + structuredResult: true, read: true, reconciliation: true, usage: false, + dynamicTools: true, runtimeRequestResolution: true, runtimeRequestHandoff: true, + }); }); - it("rejects direct construction before opening a runtime host", () => { + it("constructs directly without opening a runtime host eagerly", () => { const openHost = vi.fn(); expect(() => new CodexAcpxDriver({ agent: "antigravity", model: "caller-exact-model", runtimeDirectory: "/unused", - providerPolicy: { readOnly: false } }, { openHost })) - .toThrow(expect.objectContaining({ code: "ACPX_PROFILE_QUALIFICATION_PENDING" })); + providerPolicy: { readOnly: false } }, { openHost })).not.toThrow(); expect(openHost).not.toHaveBeenCalled(); }); - it("refuses raw installation lookup even after a caller strips the pending marker", async () => { - const profile = { ...resolveQualifiedAcpxProfile("antigravity", "caller-exact-model"), qualificationStatus: undefined }; + it("rejects raw npm installation lookup when the caller omits a resolved package path", async () => { + const profile = resolveQualifiedAcpxProfile("antigravity", "caller-exact-model"); const resolvePackage = vi.fn(); - await expect(verifyQualifiedAcpxInstallation(profile, resolvePackage)) - .rejects.toMatchObject({ code: "ACPX_PROFILE_QUALIFICATION_PENDING" }); - await expect(verifyAcpxProfileInstallation(profile)) - .rejects.toMatchObject({ code: "ACPX_PROFILE_QUALIFICATION_PENDING" }); - expect(resolvePackage).not.toHaveBeenCalled(); + await expect(verifyQualifiedAcpxInstallation(profile, resolvePackage)).rejects.toThrow(); }); }); diff --git a/packages/paperclip-runner/src/drivers/acpx/candidate-admission.antigravity-release.test.ts b/packages/paperclip-runner/src/drivers/acpx/candidate-admission.antigravity-release.test.ts index fad91ede069..c951cace59b 100644 --- a/packages/paperclip-runner/src/drivers/acpx/candidate-admission.antigravity-release.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/candidate-admission.antigravity-release.test.ts @@ -7,9 +7,8 @@ vi.mock("./qualified-profiles.js", async importOriginal => { const actual = await importOriginal(); const profile = (agent: string) => { const value = actual.QUALIFIED_ACPX_PROFILES[agent as keyof typeof actual.QUALIFIED_ACPX_PROFILES]; - if (agent !== "antigravity" || !status.released) return value; - const { qualificationStatus: _pending, ...released } = value; - return released; + if (agent !== "antigravity" || status.released) return value; + return { ...value, qualificationStatus: "pending" as const }; }; const QUALIFIED_ACPX_PROFILES = Object.fromEntries(Object.keys(actual.QUALIFIED_ACPX_PROFILES).map(agent => [agent, undefined])); for (const agent of Object.keys(QUALIFIED_ACPX_PROFILES)) Object.defineProperty(QUALIFIED_ACPX_PROFILES, agent, { get: () => profile(agent), enumerable: true }); diff --git a/packages/paperclip-runner/src/drivers/acpx/candidate-admission.test.ts b/packages/paperclip-runner/src/drivers/acpx/candidate-admission.test.ts index 5ad97d944b9..262197742c6 100644 --- a/packages/paperclip-runner/src/drivers/acpx/candidate-admission.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/candidate-admission.test.ts @@ -21,14 +21,34 @@ const candidate = (): AcpxCandidateAdmission => ({ schema: "paperclip.acpx-candi nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["darwin-arm64"].closureSha256}`, platform: "darwin", architecture: "arm64", expiresAt: now + 60_000 }); -describe("operator candidate execution admission", () => { - it("binds an exact company/model/profile/native closure without changing release admission", () => { - const source = candidate(); - const value = parseAcpxCandidateAdmission(source, expected, now); - expect(value).toEqual(source); - expect(value).not.toBe(source); - expect(() => assertAcpxProfileReleased("antigravity")).toThrow("qualification is pending"); - expect(() => assertAcpxExecutionAdmission(resolveQualifiedAcpxProfile("antigravity", expected.model))).toThrow("qualification is pending"); +describe("released Antigravity admission rejects candidate grants", () => { + it("admits released Antigravity without candidate authority and rejects every candidate grant", () => { + const profile = resolveQualifiedAcpxProfile("antigravity", expected.model); + expect(profile.agentProfileVersion).toBe(2); + expect(profile.qualificationStatus).toBeUndefined(); + expect(() => assertAcpxProfileReleased("antigravity")).not.toThrow(); + expect(() => assertAcpxExecutionAdmission(profile)).not.toThrow(); + expect(() => parseAcpxCandidateAdmission(candidate(), expected, now)) + .toThrow(expect.objectContaining({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" })); + expect(() => bindAcpxCandidateAdmission({ ...candidate(), expiresAt: Date.now() + 60_000 }, { runId: "actual-run", normalizedSessionId: "actual-session" })) + .toThrow(expect.objectContaining({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" })); + const staleStartup = { ...candidate(), expiresAt: Date.now() + 60_000, runId: "actual-run", normalizedSessionId: "actual-session" }; + expect(() => parseAcpxCandidateStartupAdmission(staleStartup, { ...expected, runId: "actual-run", normalizedSessionId: "actual-session" })) + .toThrow(expect.objectContaining({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" })); + expect(() => assertAcpxExecutionAdmission(profile, staleStartup)) + .toThrow(expect.objectContaining({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" })); + for (const agent of ["codex", "claude", "grok", "cursor", "pi", "copilot", "kimi", "antigravity"] as const) { + expect(() => assertAcpxExecutionAdmission(resolveQualifiedAcpxProfile(agent, "caller-selected-model"))).not.toThrow(); + } + }); + + it("declares verified native targets and rejects darwin-x64", () => { + expect(Object.keys(ANTIGRAVITY_DISTRIBUTION_PINS).sort()).toEqual(["darwin-arm64", "linux-arm64", "linux-x64"]); + for (const target of Object.keys(ANTIGRAVITY_DISTRIBUTION_PINS)) { + const [platform, architecture] = target.split("-"); + expect(isAntigravityNativeTarget(platform, architecture)).toBe(true); + } + expect(isAntigravityNativeTarget("darwin", "x64")).toBe(false); }); it.each([ @@ -36,59 +56,21 @@ describe("operator candidate execution admission", () => { { profileDigest: `sha256:${"a".repeat(64)}` }, { nativeClosureDigest: `sha256:${"b".repeat(64)}` }, { platform: "linux" }, { architecture: "x64" }, { expiresAt: now }, { expiresAt: now + 86_400_001 }, { expiresAt: "1800000060000" }, { unknown: true }, { runId: "injected-run" }, { model: "auto" }, - ])("rejects mismatched or broadened authority %j", change => { + ])("rejects candidate authority %j", change => { expect(() => parseAcpxCandidateAdmission({ ...candidate(), ...change }, expected, now)).toThrow(expect.objectContaining({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" })); }); - - it("admits each verified native closure only for its own platform", () => { - expect(Object.keys(ANTIGRAVITY_DISTRIBUTION_PINS).sort()).toEqual(["darwin-arm64", "linux-arm64", "linux-x64"]); - for (const target of Object.keys(ANTIGRAVITY_DISTRIBUTION_PINS) as Array) { - const [platform, architecture] = target.split("-"); - const record = { ...candidate(), platform, architecture, nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS[target].closureSha256}` }; - expect(parseAcpxCandidateAdmission(record, expected, now)).toEqual(record); - expect(isAntigravityNativeTarget(platform, architecture)).toBe(true); - for (const other of Object.keys(ANTIGRAVITY_DISTRIBUTION_PINS).filter(other => other !== target) as Array) { - expect(() => parseAcpxCandidateAdmission({ ...record, nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS[other].closureSha256}` }, expected, now)).toThrow(); - } - } - expect(isAntigravityNativeTarget("darwin", "x64")).toBe(false); - expect(() => parseAcpxCandidateAdmission({ ...candidate(), architecture: "x64" }, expected, now)).toThrow(); - }); - - it("binds actual startup run/session and refuses replay against another identity", () => { - const current = { ...candidate(), expiresAt: Date.now() + 60_000 }; - const startup = bindAcpxCandidateAdmission(current, { runId: "actual-run", normalizedSessionId: "actual-session" }); - expect(parseAcpxCandidateStartupAdmission(startup, { ...expected, runId: "actual-run", normalizedSessionId: "actual-session" })).toEqual(startup); - for (const identity of [{ runId: "other-run" }, { normalizedSessionId: "other-session" }, { model: "other-model" }]) { - expect(() => parseAcpxCandidateStartupAdmission(startup, { ...expected, ...identity })).toThrow(); - } - expect(() => parseAcpxCandidateStartupAdmission({ ...startup, trusted: true }, expected)).toThrow(); - expect(() => parseAcpxCandidateStartupAdmission(startup, expected, startup.expiresAt)).toThrow(); - }); - - it("permits only the pinned native candidate at the execution exception", () => { - const startup = bindAcpxCandidateAdmission({ ...candidate(), expiresAt: Date.now() + 60_000 }, { runId: "actual-run", normalizedSessionId: "actual-session" }); - const profile = resolveQualifiedAcpxProfile("antigravity", expected.model); - if (process.platform === "darwin" && process.arch === "arm64") expect(() => assertAcpxExecutionAdmission(profile, startup)).not.toThrow(); - else expect(() => assertAcpxExecutionAdmission(profile, startup)).toThrow(); - expect(() => assertAcpxExecutionAdmission(resolveQualifiedAcpxProfile("codex", expected.model), startup)).toThrow(); - expect(() => assertAcpxExecutionAdmission({ ...profile, commandDigest: `sha256:${"c".repeat(64)}` }, startup)).toThrow(); - for (const agent of ["codex", "claude", "grok", "cursor", "pi", "copilot"] as const) { - expect(() => assertAcpxExecutionAdmission(resolveQualifiedAcpxProfile(agent, "caller-selected-model"))).not.toThrow(); - } - }); }); -describe("candidate installation remains cryptographically verified", () => { +describe("released Antigravity installation remains cryptographically verified", () => { const profile = resolveQualifiedAcpxProfile("antigravity", "gemini-3.8-flash-low"); - const admission = () => bindAcpxCandidateAdmission({ schema: "paperclip.acpx-candidate-admission.v1", companyId: "company-candidate", agent: "antigravity", model: profile.qualificationModel, + const staleAdmission = () => ({ schema: "paperclip.acpx-candidate-admission.v1" as const, companyId: "company-candidate", agent: "antigravity" as const, model: profile.qualificationModel, profileDigest: profile.commandDigest, nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["darwin-arm64"].closureSha256}`, - platform: "darwin", architecture: "arm64", expiresAt: Date.now() + 60_000 }, { runId: "run-candidate", normalizedSessionId: "session-candidate" }); + platform: "darwin" as const, architecture: "arm64" as const, expiresAt: Date.now() + 60_000, runId: "run-candidate", normalizedSessionId: "session-candidate" }); - it.skipIf(process.platform !== "darwin" || process.arch !== "arm64")("delegates the admitted exception to the exact complete native closure verifier", async () => { + it.skipIf(process.platform !== "darwin" || process.arch !== "arm64")("delegates released Antigravity to the exact complete native closure verifier without a candidate grant", async () => { const native = { commandDigest: "native-closure-verifier-result" } as integrity.VerifiedAcpxInstallation; vi.mocked(integrity.verifyNativeAcpxInstallation).mockResolvedValue(native); - const result = await verifyAcpxProfileInstallation(profile, admission()); + const result = await verifyAcpxProfileInstallation(profile); expect(result.commandDigest).toBe(profile.commandDigest); expect(integrity.verifyNativeAcpxInstallation).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ expectedClosureSha256: ANTIGRAVITY_DISTRIBUTION_PINS["darwin-arm64"].closureSha256, @@ -96,17 +78,16 @@ describe("candidate installation remains cryptographically verified", () => { })); }); - it("denies absent, altered, or other-provider authority before any native files are opened", async () => { + it("denies any injected candidate authority before any native files are opened", async () => { vi.mocked(integrity.verifyNativeAcpxInstallation).mockClear(); - await expect(verifyAcpxProfileInstallation(profile)).rejects.toMatchObject({ code: "ACPX_PROFILE_QUALIFICATION_PENDING" }); - await expect(verifyAcpxProfileInstallation(profile, { ...admission(), model: "gemini-3.8-flash-high" })).rejects.toMatchObject({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" }); - await expect(verifyAcpxProfileInstallation(resolveQualifiedAcpxProfile("codex", profile.qualificationModel), admission())).rejects.toMatchObject({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" }); + await expect(verifyAcpxProfileInstallation(profile, staleAdmission())).rejects.toMatchObject({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" }); + await expect(verifyAcpxProfileInstallation(resolveQualifiedAcpxProfile("codex", profile.qualificationModel), staleAdmission())).rejects.toMatchObject({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" }); expect(integrity.verifyNativeAcpxInstallation).not.toHaveBeenCalled(); }); - it("rejects a candidate session mismatch before installation, credentials, or runtime acquisition", async () => { + it("rejects any candidate admission at AcpxRuntimeHost.open before installation, credentials, or runtime acquisition", async () => { const verifyInstallation = vi.fn(), openRuntime = vi.fn(); - await expect(AcpxRuntimeHost.open({ candidateAdmission: admission(), runtimeDirectory: "/unused", normalizedSessionId: "another-session", workingDirectory: "/unused", agent: "antigravity", model: profile.qualificationModel, + await expect(AcpxRuntimeHost.open({ candidateAdmission: staleAdmission(), runtimeDirectory: "/unused", normalizedSessionId: "session-candidate", workingDirectory: "/unused", agent: "antigravity", model: profile.qualificationModel, permissionMode: "deny-all", providerPolicy: { readOnly: true } }, { verifyInstallation, openRuntime, retainAdmissionCleanup: () => {}, reportRetainedCleanupFailure: () => {} })).rejects.toMatchObject({ code: "ACPX_CANDIDATE_ADMISSION_INVALID" }); expect(verifyInstallation).not.toHaveBeenCalled(); expect(openRuntime).not.toHaveBeenCalled(); diff --git a/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts index 5518dce8e0f..5b6d9ec9ed3 100644 --- a/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts +++ b/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts @@ -27,7 +27,8 @@ export interface AcpxCapabilityProfile { /** These are runner integration claims, not a proxy for everything a harness can do. */ export const ACPX_CAPABILITY_PROFILES: Readonly> = { antigravity: { - displayName: "Google Antigravity", qualification: "pending", models: "unverified", + displayName: "Google Antigravity", qualification: ANTIGRAVITY_RELEASED ? "qualified" : "pending", + models: ANTIGRAVITY_RELEASED ? "explicit-provider-verified" : "unverified", permissions: ANTIGRAVITY_RELEASED ? "interactive" : "unverified", questions: ANTIGRAVITY_RELEASED ? "form" : "not-exposed", plans: "semantic-only", tools: "unverified", recovery: "unverified", usage: "unverified", steering: "unsupported", followUp: "controller-queue", diff --git a/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts index c50d3cad2cc..1d785e09b04 100644 --- a/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts +++ b/packages/paperclip-runner/src/drivers/acpx/generated-profiles.ts @@ -9,13 +9,12 @@ export const QUALIFIED_ACPX_PROFILE_DATA = { "protocolVersion": 1, "acpxVersion": "0.22.0", "agent": "antigravity", - "agentProfileVersion": 1, + "agentProfileVersion": 2, "agentServerPackage": "native:antigravity-acp", "agentServerVersion": "1.5.2", "agentRuntimePackage": "native:antigravity-localharness", "agentRuntimeVersion": "1.5.2", "commandDigest": "sha256:61ac14bf03ce4bbf8afe1f5a263b854517ec588d8407fe2d8f17c9fc0c037c4b", - "qualificationStatus": "pending", "permissionPolicy": "interactive" }, "grok": { diff --git a/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts b/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts index cb38eec8b12..a205bb05bb2 100644 --- a/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/profile-compatibility.test.ts @@ -8,7 +8,8 @@ import { isSupportedAcpxProfileVersion } from "./profile-compatibility.js"; // release changes the commandDigest and keeps the version; a new provider starts // at 1. Update this table, with the reason, only for a deliberate reset. const PROFILE_VERSIONS: Readonly> = { - antigravity: 1, claude: 1, codex: 1, copilot: 92, cursor: 17, grok: 20, pi: 37, + // Released Antigravity uses revision 2 to refuse saved pending-candidate sessions. + antigravity: 2, claude: 1, codex: 1, copilot: 92, cursor: 17, grok: 20, pi: 37, // Released Kimi uses revision 17 to refuse saved pending-candidate sessions. // The upstream-only attestation migration retains that existing revision. kimi: 17, diff --git a/packages/paperclip-runner/src/live/antigravity-candidate-startup.test.ts b/packages/paperclip-runner/src/live/antigravity-candidate-startup.test.ts index 4b840ddc2a0..c528d42bb5f 100644 --- a/packages/paperclip-runner/src/live/antigravity-candidate-startup.test.ts +++ b/packages/paperclip-runner/src/live/antigravity-candidate-startup.test.ts @@ -1,11 +1,10 @@ import { mkdtemp, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { describe, expect, it, vi } from "vitest"; -import { spawnRunner, type RunnerProcessLaunchSpec } from "../control-plane/durable-prp-control-plane.js"; +import { describe, expect, it } from "vitest"; import { bindAcpxCandidateAdmission, type AcpxCandidateAdmission } from "../drivers/acpx/candidate-admission.js"; import { ANTIGRAVITY_DISTRIBUTION_PINS } from "../drivers/acpx/generated-profiles.js"; -import { resolveQualifiedAcpxProfile } from "../drivers/acpx/qualified-profiles.js"; +import { QUALIFIED_ACPX_PROFILES, resolveQualifiedAcpxProfile } from "../drivers/acpx/qualified-profiles.js"; import { createRunnerdCodexTransport, runnerdLaunchProfileInternals } from "./runnerd-codex-transport.js"; const identity = { runnerInstanceId: "runner-candidate", environmentLeaseId: "lease-candidate", runId: "run-candidate", normalizedSessionId: "session-candidate", turnId: "turn-candidate", itemId: "item-candidate" }; @@ -13,114 +12,32 @@ const candidate = (): AcpxCandidateAdmission => ({ schema: "paperclip.acpx-candi profileDigest: resolveQualifiedAcpxProfile("antigravity", "gemini-3.8-flash-low").commandDigest, nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["darwin-arm64"].closureSha256}`, platform: "darwin", architecture: "arm64", expiresAt: Date.now() + 60_000 }); -const supported = process.platform === "darwin" && process.arch === "arm64"; +const linuxCandidate = (): AcpxCandidateAdmission => ({ ...candidate(), platform: "linux", architecture: "x64", + nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["linux-x64"].closureSha256}` }); -describe("Antigravity candidate trusted startup", () => { - it("bounds argv and structured launches by the absolute candidate expiry across replacement", () => { - let now = Date.now(); - const clock = vi.spyOn(Date, "now").mockImplementation(() => now); - try { - const admission = bindAcpxCandidateAdmission({ ...candidate(), expiresAt: now + 2_000 }, identity); - const launches: RunnerProcessLaunchSpec[] = []; - const handle = spawnRunner({ connectUrl: "ws://127.0.0.1:43127", stateDirectory: "/unused/candidate", identity, - ticket: "inert-ticket", maxOutboxBytes: 262144, p0ReserveBytes: 65536, maxRuntimeMs: 0, maxLifetimeMs: 10_000, - runnerVersion: "fixture", runnerDigest: `sha256:${"f".repeat(64)}`, - acpxLaunchProfile: { candidateAdmission: admission, authorityDigest: `sha256:${"d".repeat(64)}`, command: "/owned/node", commandSha256: `sha256:${"b".repeat(64)}`, - sidecarScript: "/owned/sidecar.cjs", sidecarScriptSha256: `sha256:${"c".repeat(64)}` }, - processLauncher: spec => { launches.push(spec); return { child: { pid: 42, exitCode: 0, signalCode: null, kill: () => true }, - completion: Promise.resolve({ code: 0, signal: null, stdout: "", stderr: "" }) }; }, - }); - expect(launches[0]!.args).not.toContain("--max-lifetime-ms"); - expect(launches[0]!.args.slice(-2)).toEqual(["--max-runtime-ms", "2000"]); - expect(launches[0]!.nativeRunner).toMatchObject({ maxRuntimeMs: 2000, maxLifetimeMs: 2000 }); - now += 1_500; - handle.restart!("replacement-ticket"); - expect(launches[1]!.args.slice(-2)).toEqual(["--max-runtime-ms", "500"]); - expect(launches[1]!.nativeRunner).toMatchObject({ maxRuntimeMs: 500, maxLifetimeMs: 500 }); - now += 501; - expect(() => handle.restart!("expired-ticket")).toThrow("runner_process_lifetime_expired"); - expect(launches).toHaveLength(2); - } finally { clock.mockRestore(); } +describe("Antigravity qualified startup", () => { + it("rejects stale candidate grants once Antigravity is qualified", () => { + expect(QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus).toBeUndefined(); + expect(() => bindAcpxCandidateAdmission(candidate(), identity)).toThrow("ACPX candidate admission is missing, expired, or does not match"); + expect(() => bindAcpxCandidateAdmission(linuxCandidate(), identity)).toThrow("ACPX candidate admission is missing, expired, or does not match"); + expect(runnerdLaunchProfileInternals.openedThreadModelProvider("acpx", "antigravity", "gemini-3.8-flash-low")).toBe("google"); }); - it.skipIf(!supported)("allows an explicit cold local owner while rejecting absent and broadened authority", async () => { - const root = await mkdtemp(join(tmpdir(), "antigravity-candidate-startup-")); + it("opens ordinary local and remote Antigravity transports without a candidate grant while refusing stale grants", async () => { + const root = await mkdtemp(join(tmpdir(), "antigravity-qualified-startup-")); try { - const options = { provider: "acpx" as const, acpxAgent: "antigravity" as const, stateDirectory: root, acpxCandidateAdmission: candidate() }; - expect(() => createRunnerdCodexTransport({ ...options, acpxCandidateAdmission: undefined })).toThrow("evaluation opt-in"); - const owner = createRunnerdCodexTransport(options); - await owner.transport.close(); - for (const change of [{ lifecyclePolicy: { mode: "warm" as const, idleTimeoutMs: 1000 } }, { runnerFilesystemRoot: "/guest" }, - { homeMode: "preconfigured" as const }, { resumeProviderSession: { driverSessionId: "old-session" } }, - { provider: "codex" as const }, - { acpxCandidateAdmission: { ...candidate(), nativeClosureDigest: `sha256:${"a".repeat(64)}` } }]) { - expect(() => createRunnerdCodexTransport({ ...options, ...change })).toThrow(); - } + const localOptions = { provider: "acpx" as const, acpxAgent: "antigravity" as const, stateDirectory: root }; + const localOwner = createRunnerdCodexTransport(localOptions); + expect(localOwner.transport.prepareConversationResume).toBeUndefined(); + await localOwner.transport.close(); + + expect(() => createRunnerdCodexTransport({ ...localOptions, acpxCandidateAdmission: candidate() })).toThrow(); + expect(() => createRunnerdCodexTransport({ ...localOptions, homeMode: "preconfigured" as const })).toThrow("preconfigured_home_unsupported_provider"); + + const remoteOptions = { ...localOptions, runnerFilesystemRoot: "/owned-runner" }; + const remoteOwner = createRunnerdCodexTransport(remoteOptions); + await remoteOwner.transport.close(); + expect(() => createRunnerdCodexTransport({ ...remoteOptions, acpxCandidateAdmission: linuxCandidate() })).toThrow(); } finally { await rm(root, { recursive: true, force: true }); } }); - - it.skipIf(!supported)("loads a settled native conversation only through a fresh current-run owner", async () => { - const root = await mkdtemp(join(tmpdir(), "antigravity-candidate-continuation-")); - const admission = candidate(); - const retained = { driverSessionId: "driver-retained", providerSessionId: "native-retained", providerIdentity: { - kind: "acpx" as const, normalizedSessionId: identity.normalizedSessionId, - acpxRecordId: "acpx-retained", backendSessionId: "backend-retained", agentSessionId: "native-retained", - workspaceDigest: `sha256:${"e".repeat(64)}`, providerLifetimeFenceCandidates: [1, 2, 3] as const, - // The recovery binding digest is distinct from the release command digest. - profileDigest: `sha256:${"a".repeat(64)}`, requestedModel: admission.model, effectiveModel: admission.model, - } }; - try { - const options = { provider: "acpx" as const, acpxAgent: "antigravity" as const, stateDirectory: root, - acpxCandidateAdmission: admission, prpIdentity: identity, resumeWorkingDirectory: root, - resumeProviderSession: retained, providerRecoveryPolicy: "allow_replacement_after_governed_wait" as const }; - const owner = createRunnerdCodexTransport(options); - expect(owner.transport.prepareConversationResume).toBeTypeOf("function"); - await expect(owner.transport.prepareConversationResume!({ threadId: retained.driverSessionId, model: "wrong-model", cwd: root })).rejects.toThrow("exact current conversation"); - await expect(owner.transport.prepareConversationResume!({ threadId: retained.driverSessionId, model: admission.model, cwd: "/wrong-workspace" })).rejects.toThrow("exact current conversation"); - await owner.transport.close(); - expect(() => createRunnerdCodexTransport({ ...options, resumeActiveTurnId: "stale-active-turn" })).toThrow("fresh isolated per-turn"); - expect(() => createRunnerdCodexTransport({ ...options, resumeProviderSession: { ...retained, - providerIdentity: { ...retained.providerIdentity, effectiveModel: "wrong-model" } } })).toThrow("exact retained native conversation"); - } finally { await rm(root, { recursive: true, force: true }); } - }); - - it("admits a remote owner only with a linux-x64 grant, per-turn, on any controller host", async () => { - const root = await mkdtemp(join(tmpdir(), "antigravity-candidate-remote-")); - const linux = (): AcpxCandidateAdmission => ({ ...candidate(), platform: "linux", architecture: "x64", - nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["linux-x64"].closureSha256}` }); - try { - const options = { provider: "acpx" as const, acpxAgent: "antigravity" as const, stateDirectory: root, - runnerFilesystemRoot: "/owned-runner", acpxCandidateAdmission: linux() }; - const owner = createRunnerdCodexTransport(options); - await owner.transport.close(); - for (const change of [{ acpxCandidateAdmission: candidate() }, - { acpxCandidateAdmission: { ...linux(), nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["darwin-arm64"].closureSha256}` } }, - { acpxCandidateAdmission: { ...linux(), architecture: "arm64" as const, nativeClosureDigest: `sha256:${ANTIGRAVITY_DISTRIBUTION_PINS["linux-arm64"].closureSha256}` } }, - { lifecyclePolicy: { mode: "warm" as const, idleTimeoutMs: 1000 } }, { homeMode: "preconfigured" as const }]) { - expect(() => createRunnerdCodexTransport({ ...options, ...change })).toThrow(); - } - // The same linux-x64 grant never admits a local owner on another host. - if (process.platform !== "linux" || process.arch !== "x64") { - expect(() => createRunnerdCodexTransport({ ...options, runnerFilesystemRoot: undefined })).toThrow("on its admitted platform"); - } - } finally { await rm(root, { recursive: true, force: true }); } - }); - - it("binds the startup authority to the actual Runner identity and keeps it out of provider configuration", () => { - const admission = bindAcpxCandidateAdmission(candidate(), identity); - const launches: RunnerProcessLaunchSpec[] = []; - spawnRunner({ connection: { mode: "connect", connectUrl: "ws://127.0.0.1:43127" }, stateDirectory: "/unused/candidate", identity, - ticket: "inert-ticket", maxOutboxBytes: 262144, p0ReserveBytes: 65536, runnerVersion: "fixture", runnerDigest: `sha256:${"f".repeat(64)}`, - acpxLaunchProfile: { candidateAdmission: admission, authorityDigest: `sha256:${"d".repeat(64)}`, command: "/owned/node", commandSha256: `sha256:${"b".repeat(64)}`, sidecarScript: "/owned/sidecar.cjs", sidecarScriptSha256: `sha256:${"c".repeat(64)}` }, - environment: {}, processLauncher: spec => { launches.push(spec); return { child: { pid: 42, exitCode: 0, signalCode: null, kill: () => true }, completion: Promise.resolve({ code: 0, signal: null, stdout: "", stderr: "" }) }; }, - }); - expect(launches).toHaveLength(1); - const launch = launches[0]!; - const flag = launch.args.indexOf("--acpx-candidate-admission-json"); - expect(flag).toBeGreaterThan(0); - expect(JSON.parse(launch.args[flag + 1]!)).toEqual({ ...candidate(), ...admission }); - expect(launch.nativeRunner?.acpxLaunchProfile?.candidateAdmission).toEqual(admission); - expect(JSON.stringify(launch.environment)).not.toContain(admission.schema); - expect(runnerdLaunchProfileInternals.openedThreadModelProvider("acpx", "antigravity", admission.model)).toBe("google"); - }); }); diff --git a/server/src/__tests__/adapter-routes.test.ts b/server/src/__tests__/adapter-routes.test.ts index b2e986ee9fd..f85b660e20e 100644 --- a/server/src/__tests__/adapter-routes.test.ts +++ b/server/src/__tests__/adapter-routes.test.ts @@ -23,7 +23,7 @@ const mockPluginLoader = vi.hoisted(() => ({ getOrExtractUiParserSource: vi.fn(), reloadExternalAdapter: vi.fn(), })); -const mockCandidateAdmission = vi.hoisted(() => vi.fn()); +const mockCandidateForRunnerTarget = vi.hoisted(() => vi.fn()); const overridingConfigSchemaAdapter: ServerAdapterModule = { type: "claude_local", @@ -55,9 +55,8 @@ let adapterRoutes: typeof import("../routes/adapters.js").adapterRoutes; let errorHandler: typeof import("../middleware/index.js").errorHandler; function registerModuleMocks() { - vi.doMock("../services/native-runtime/acpx-qualification.js", async () => ({ - ...await vi.importActual("../services/native-runtime/acpx-qualification.js"), - resolveAntigravityCandidateAdmission: mockCandidateAdmission, + vi.doMock("../services/native-runtime/antigravity-release.js", () => ({ + antigravityCandidateForRunnerTarget: (...args: unknown[]) => mockCandidateForRunnerTarget(...args), })); vi.doMock("node:child_process", async () => vi.importActual("node:child_process")); vi.doMock("../adapters/plugin-loader.js", () => mockPluginLoader); @@ -66,6 +65,7 @@ function registerModuleMocks() { function resetAdapterMocks() { vi.resetAllMocks(); + mockCandidateForRunnerTarget.mockReturnValue(undefined); mockAdapterPluginStore.listAdapterPlugins.mockReturnValue([]); mockAdapterPluginStore.addAdapterPlugin.mockResolvedValue(undefined); mockAdapterPluginStore.removeAdapterPlugin.mockReturnValue(false); @@ -153,8 +153,16 @@ describe("adapter routes", () => { expect(typeof adapter.capabilities.supportsAcp).toBe("boolean"); } }); - it("projects only the enabled company-local candidate and exact model", async () => { - mockCandidateAdmission.mockImplementation(({ companyId }) => companyId === "company-1" + it("omits candidateHarnesses when no candidate grant is active", async () => { + const local = createApp({}, { resolveRunnerTarget: async () => ({ driver: "local" }) }); + const scoped = await request(local).get("/api/adapters?companyId=company-1"); + expect(scoped.status).toBe(200); + expect(scoped.body.every((adapter: any) => adapter.candidateHarnesses === undefined)).toBe(true); + expect(mockCandidateForRunnerTarget).toHaveBeenCalledWith("company-1", { driver: "local" }); + }); + + it("projects only the enabled company-local candidate and exact model when a candidate grant is returned", async () => { + mockCandidateForRunnerTarget.mockImplementation((companyId, target) => companyId === "company-1" && target.driver === "local" ? { agent: "antigravity", model: "exact-google-model", profileDigest: "private-profile", nativeClosureDigest: "private-closure" } : undefined); const local = createApp({}, { resolveRunnerTarget: async () => ({ driver: "local" }) }); const scoped = await request(local).get("/api/adapters?companyId=company-1"); @@ -177,35 +185,7 @@ describe("adapter routes", () => { expect(disabled.body.find((adapter: any) => adapter.type === "paperclip_runner").candidateHarnesses).toBeUndefined(); }); - it("offers a cloud environment the candidate only for the company's linux-x64 grant", async () => { - // The real resolver binds a grant to the execution target it names. - const grant = (platform: string, architecture: string) => (input: { companyId?: string; target?: { platform: string; architecture: string } }) => { - if (input.companyId !== "company-1") return undefined; - if (input.target && (input.target.platform !== platform || input.target.architecture !== architecture)) { - throw new Error("Antigravity candidate admission does not match the execution target"); - } - return { agent: "antigravity", model: "exact-google-model", platform, architecture }; - }; - const candidates = async (target: RunnerTarget, companyId = "company-1") => { - const response = await request(createApp({}, { resolveRunnerTarget: async () => target })) - .get(`/api/adapters?companyId=${companyId}&environmentId=cloud`); - expect(response.status).toBe(200); - return response.body.find((adapter: any) => adapter.type === "paperclip_runner").candidateHarnesses; - }; - const offered = [{ agent: "antigravity", model: "exact-google-model" }]; - - mockCandidateAdmission.mockImplementation(grant("linux", "x64")); - expect(await candidates({ driver: "sandbox", platform: "linux", architecture: "x64", libc: "glibc", glibcVersion: "2.39" })).toEqual(offered); - expect(mockCandidateAdmission).toHaveBeenLastCalledWith({ companyId: "company-1", target: { platform: "linux", architecture: "x64" } }); - expect(await candidates({ driver: "sandbox", managedCloudImage: true })).toEqual(offered); - expect(await candidates({ driver: "ssh", platform: "linux", architecture: "x64", libc: "glibc", glibcVersion: "2.39" })).toEqual(offered); - expect(await candidates({ driver: "ssh", platform: "linux", architecture: "x64", libc: "musl" })).toBeUndefined(); - expect(await candidates({ driver: "ssh", platform: "linux", architecture: "x64", libc: "glibc", glibcVersion: "2.31" })).toBeUndefined(); - // Another company, another platform, or no Computer gets nothing. - expect(await candidates({ driver: "sandbox", platform: "linux", architecture: "x64" }, "other-company")).toBeUndefined(); - expect(await candidates({ driver: "sandbox", platform: "linux", architecture: "arm64" })).toBeUndefined(); - expect(await candidates({ driver: "sandbox" })).toBeUndefined(); - expect(await candidates({ driver: "unavailable" })).toBeUndefined(); + it("exposes paperclip_runner on a plugin Runner-task environment without any pending candidate grant", async () => { // A plugin Runner-task environment offers no pending candidate grant (the plugin // launch contract carries none), while still exposing paperclip_runner so released // ACPX profiles like Copilot and released Antigravity are offered without a grant. @@ -216,14 +196,9 @@ describe("adapter routes", () => { expect(pluginRunner).toMatchObject({ type: "paperclip_runner", loaded: true, disabled: false }); expect(pluginRunner.supportedRunners.length).toBeGreaterThan(0); expect(pluginRunner.candidateHarnesses).toBeUndefined(); - - // A grant for this host does not open a cloud environment. - mockCandidateAdmission.mockImplementation(grant("darwin", "arm64")); - expect(await candidates({ driver: "sandbox", platform: "linux", architecture: "x64" })).toBeUndefined(); }); - it("keeps ordinary adapter discovery available after candidate startup authority expires", async () => { - mockCandidateAdmission.mockImplementation(() => { throw new Error("ACPX candidate startup authorization expired"); }); + mockCandidateForRunnerTarget.mockImplementation(() => { throw new Error("ACPX candidate startup authorization expired"); }); const app = createApp({}, { resolveRunnerTarget: async () => ({ driver: "local" }) }); const response = await request(app).get("/api/adapters?companyId=company-1"); expect(response.status).toBe(200); @@ -236,10 +211,10 @@ describe("adapter routes", () => { const warn = vi.spyOn(logger, "warn").mockImplementation(() => undefined); const app = createApp({}, { resolveRunnerTarget: async () => ({ driver: "local" }) }); try { - mockCandidateAdmission.mockImplementation(() => { throw new Error("ACPX candidate startup authorization expired"); }); + mockCandidateForRunnerTarget.mockImplementation(() => { throw new Error("ACPX candidate startup authorization expired"); }); expect((await request(app).get("/api/adapters?companyId=company-1")).status).toBe(200); expect(warn).not.toHaveBeenCalled(); - mockCandidateAdmission.mockImplementation(() => { throw new Error("Invalid Antigravity candidate admission"); }); + mockCandidateForRunnerTarget.mockImplementation(() => { throw new Error("Invalid Antigravity candidate admission"); }); for (let index = 0; index < 2; index++) { const response = await request(app).get("/api/adapters?companyId=company-1"); expect(response.status).toBe(200); @@ -565,6 +540,7 @@ describe("adapter routes", () => { { value: "copilot", label: "GitHub Copilot" }, { value: "pi", label: "Pi" }, { value: "kimi", label: "Kimi Code" }, + { value: "antigravity", label: "Google Antigravity" }, ], }); expect(JSON.stringify(res.body)).not.toContain("Codex via ACPX"); diff --git a/server/src/__tests__/agent-adapter-validation-routes.test.ts b/server/src/__tests__/agent-adapter-validation-routes.test.ts index 3f704b129c9..31875c51126 100644 --- a/server/src/__tests__/agent-adapter-validation-routes.test.ts +++ b/server/src/__tests__/agent-adapter-validation-routes.test.ts @@ -491,7 +491,7 @@ describe("agent routes adapter validation", () => { expect(mockAntigravityModels).not.toHaveBeenCalled(); }); - it("lists Antigravity models for a Gemini API key on a cloud environment, but keeps account discovery on the host", async () => { + it("lists Antigravity models for both Gemini API keys and Google sign-in on a cloud environment once qualified", async () => { const environments = await import("../services/environments.js"); const cloud = { id: "env-cloud", companyId: "company-1", driver: "daytona" }; vi.spyOn(environments, "environmentService").mockReturnValue({ getById: vi.fn(async () => cloud), @@ -508,49 +508,35 @@ describe("agent routes adapter validation", () => { binding: { provider: "google", method: "api_key", mode: "responsible_user" } })); mockAntigravityModels.mockClear(); const signIn = await requestApp(app, base => request(base).get(url("subscription"))); - expect(signIn.status).toBe(422); - expect(signIn.body.error).toContain("requires the Paperclip host"); - expect(mockAntigravityModels).not.toHaveBeenCalled(); + expect(signIn.status, JSON.stringify(signIn.body)).toBe(200); + expect(signIn.body).toEqual(catalog); + expect(mockAntigravityModels).toHaveBeenLastCalledWith(expect.anything(), expect.objectContaining({ + binding: { provider: "google", method: "subscription", mode: "responsible_user" } })); }); - it.each(["create", "hire", "edit"])("refuses pending Antigravity %s before persistence", async action => { - mockInstanceSettingsService.getExperimental.mockResolvedValue({ enableNativeRunner: true }); + it.each(["create", "hire", "edit"])("admits qualified Antigravity %s without an operator candidate grant", async action => { const app = await createApp(); const adapterConfig = { provider: "acpx", acpxAgent: "antigravity", model: "exact-antigravity-model" }; const response = action === "edit" ? await requestApp(app, base => request(base).patch("/api/agents/11111111-1111-4111-8111-111111111111").send({ adapterType: "paperclip_runner", adapterConfig })) : await requestApp(app, base => request(base).post(`/api/companies/company-1/${action === "hire" ? "agent-hires" : "agents"}`).send({ name: "Antigravity", adapterType: "paperclip_runner", adapterConfig })); - expect(response.status, JSON.stringify(response.body)).toBe(422); - expect(response.body.details).toMatchObject({ code: "paperclip_runner_acpx_agent_unavailable" }); - expect(mockAgentService.create).not.toHaveBeenCalled(); - expect(mockAgentService.update).not.toHaveBeenCalled(); - expect(mockApprovalService.create).not.toHaveBeenCalled(); + expect(response.status, JSON.stringify(response.body)).toBe(action === "edit" ? 200 : 201); }); - it.runIf(process.platform === "darwin" && process.arch === "arm64")("saves only the exact company-authorized Antigravity candidate without persisting operator authority", async () => { - const [{ QUALIFIED_ACPX_PROFILES }, distributionJson] = await Promise.all([ - import("../vendor/paperclip-runner/index.js"), - readFile(new URL("../../../packages/paperclip-runner/antigravity-distributions.json", import.meta.url), "utf8"), - ]); - const distributions = JSON.parse(distributionJson); + it("creates a qualified Google Antigravity agent without an operator candidate grant or experimental Runner flag", async () => { + const { QUALIFIED_ACPX_PROFILES } = await import("../vendor/paperclip-runner/index.js"); + expect(QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion).toBe(2); + expect(QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus).toBeUndefined(); const adapterConfig = { provider: "acpx", acpxAgent: "antigravity", model: "exact-antigravity-model" }; - const admission = { schema: "paperclip.acpx-candidate-admission.v1", companyId: "company-1", agent: "antigravity", - model: adapterConfig.model, profileDigest: QUALIFIED_ACPX_PROFILES.antigravity.commandDigest, - nativeClosureDigest: `sha256:${distributions.platforms["darwin-arm64"].closureSha256}`, - platform: "darwin", architecture: "arm64", expiresAt: Date.now() + 60_000 }; - vi.stubEnv("PAPERCLIP_ACPX_CANDIDATE_ADMISSION", JSON.stringify(admission)); + vi.stubEnv("PAPERCLIP_ACPX_CANDIDATE_ADMISSION", undefined); const app = await createApp(); - const created = await requestApp(app, base => request(base).post("/api/companies/company-1/agents").send({ name: "Antigravity candidate", adapterType: "paperclip_runner", adapterConfig })); + const created = await requestApp(app, base => request(base).post("/api/companies/company-1/agents").send({ name: "Antigravity agent", adapterType: "paperclip_runner", adapterConfig })); expect(created.status, JSON.stringify(created.body)).toBe(201); expect(mockAgentService.create).toHaveBeenCalledWith("company-1", expect.objectContaining({ adapterConfig: expect.objectContaining(adapterConfig) }), expect.any(Object)); expect(JSON.stringify(mockAgentService.create.mock.calls)).not.toContain("paperclip.acpx-candidate-admission"); - expect(QUALIFIED_ACPX_PROFILES.antigravity.qualificationStatus).toBe("pending"); mockAgentService.create.mockClear(); - for (const changed of [{ ...admission, companyId: "another-company" }, { ...admission, model: "another-model" }]) { - vi.stubEnv("PAPERCLIP_ACPX_CANDIDATE_ADMISSION", JSON.stringify(changed)); - const denied = await requestApp(app, base => request(base).post("/api/companies/company-1/agents").send({ name: "Antigravity candidate", adapterType: "paperclip_runner", adapterConfig })); - expect(denied.status, JSON.stringify(denied.body)).toBe(422); - } + const missingModel = await requestApp(app, base => request(base).post("/api/companies/company-1/agents").send({ name: "Antigravity agent", adapterType: "paperclip_runner", adapterConfig: { provider: "acpx", acpxAgent: "antigravity" } })); + expect(missingModel.status, JSON.stringify(missingModel.body)).toBe(422); expect(mockAgentService.create).not.toHaveBeenCalled(); }); diff --git a/server/src/__tests__/antigravity-connection-probe.test.ts b/server/src/__tests__/antigravity-connection-probe.test.ts index 6c57c1fed74..04419c37c6e 100644 --- a/server/src/__tests__/antigravity-connection-probe.test.ts +++ b/server/src/__tests__/antigravity-connection-probe.test.ts @@ -8,11 +8,11 @@ const mocks = vi.hoisted(() => ({ probe: vi.fn(), pluginProbe: vi.fn(), admissio vi.mock("../middleware/logger.js", () => ({ logger: { warn: mocks.warn } })); vi.mock("../vendor/paperclip-runner/index.js", async importOriginal => { const original = await importOriginal(); - // Pending today; the flip removes qualificationStatus and bumps the profile. - const { qualificationStatus: _pending, ...released } = original.QUALIFIED_ACPX_PROFILES.antigravity; + // Tests keep mocks.released = false for the pending-candidate suite and flip mocks.released = true for the qualified release suite. + 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, QUALIFIED_ACPX_PROFILES: profiles, probeNativeRunnerEnvironment: mocks.probe }; }); vi.mock("@paperclipai/adapter-utils/execution-target", async importOriginal => ({ diff --git a/server/src/__tests__/antigravity-save-refusal.test.ts b/server/src/__tests__/antigravity-save-refusal.test.ts index 2616f96c3be..13de81dc97a 100644 --- a/server/src/__tests__/antigravity-save-refusal.test.ts +++ b/server/src/__tests__/antigravity-save-refusal.test.ts @@ -27,11 +27,25 @@ const grant = (companyId: string, target: string) => { platform, architecture, expiresAt: Date.now() + 60_000 }); }; -const release = vi.hoisted(() => ({ pending: true })); +const release = vi.hoisted(() => ({ pending: false, remoteCandidateAdmitted: false })); vi.mock("../services/native-runtime/antigravity-release.js", async importOriginal => ({ ...await importOriginal(), antigravityReleasePending: () => release.pending, })); +vi.mock("../services/native-runtime/acpx-qualification.js", async importOriginal => { + const original = await importOriginal(); + return { + ...original, + resolveAntigravityCandidateAdmission: (...args: Parameters) => + release.remoteCandidateAdmitted && args[0]?.target?.platform === "linux" + ? { schema: "paperclip.acpx-candidate-admission.v1", companyId: args[0].companyId ?? "", agent: "antigravity", + model: args[0].model ?? "gemini-3.8-flash-high", profileDigest: "", nativeClosureDigest: "", + platform: "linux", architecture: "x64", expiresAt: Date.now() + 60_000 } + : original.resolveAntigravityCandidateAdmission(...args), + antigravityRemoteCandidateAdmitted: (...args: Parameters) => + release.remoteCandidateAdmitted || original.antigravityRemoteCandidateAdmitted(...args), + }; +}); const support = await getEmbeddedPostgresTestSupport(); const describePostgres = support.supported ? describe : describe.skip; @@ -63,7 +77,8 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { }, 90_000); beforeEach(async () => { - release.pending = true; + release.pending = false; + release.remoteCandidateAdmitted = false; const companyId = randomUUID(); await db.insert(companies).values({ id: companyId, name: "Antigravity save", issuePrefix: `AS${++fixtureNumber}` }); await db.insert(companyMemberships).values({ companyId, principalId: userId, principalType: "user", status: "active", membershipRole: "member" }); @@ -124,6 +139,8 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { } it("refuses Google sign-in on a cloud environment while pending even with a linux-x64 grant", async () => { + release.pending = true; + release.remoteCandidateAdmitted = true; vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, grant(agent.companyId, "linux-x64")); const binding = await saveGoogleConnection("subscription"); const response = await request(app).patch(`/api/agents/${agent.id}`).send({ defaultEnvironmentId: cloud.id, runtimeConfig: { aiConnection: binding } }); @@ -138,6 +155,7 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { }); it("refuses a plugin Runner-task environment while pending even with a linux-x64 grant", async () => { + release.pending = true; vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, grant(agent.companyId, "linux-x64")); const pluginEnv = await insertPluginTaskEnvironment(); const binding = await saveGoogleConnection("api_key"); @@ -147,7 +165,8 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { expect((await readAgent()).defaultEnvironmentId).toBeNull(); }); - it("refuses any cloud environment while the release is pending", async () => { + it("refuses any cloud environment when releasePending is forced true", async () => { + release.pending = true; const binding = await saveGoogleConnection("api_key"); const response = await request(app).patch(`/api/agents/${agent.id}`).send({ defaultEnvironmentId: cloud.id, runtimeConfig: { aiConnection: binding } }); expect(response.status, JSON.stringify(response.body)).toBe(422); @@ -156,37 +175,15 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { expect((await readAgent()).defaultEnvironmentId).toBeNull(); }); - it("saves a Gemini API key on a cloud environment while pending when the operator granted linux-x64", async () => { - vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, grant(agent.companyId, "linux-x64")); - const binding = await saveGoogleConnection("api_key"); - const response = await request(app).patch(`/api/agents/${agent.id}`).send({ defaultEnvironmentId: cloud.id, runtimeConfig: { aiConnection: binding } }); - expect(response.status, JSON.stringify(response.body)).toBe(200); - expect((await readAgent()).defaultEnvironmentId).toBe(cloud.id); - expect(allocate).not.toHaveBeenCalled(); expect(probe).not.toHaveBeenCalled(); - }); - - it("refuses a cloud environment when the grant is for another company or another platform", async () => { - const binding = await saveGoogleConnection("api_key"); - for (const value of [grant(randomUUID(), "linux-x64"), grant(agent.companyId, "linux-arm64")]) { - vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, value); - const response = await request(app).patch(`/api/agents/${agent.id}`).send({ defaultEnvironmentId: cloud.id, runtimeConfig: { aiConnection: binding } }); - expect(response.status, JSON.stringify(response.body)).toBe(422); - expect(response.body.details).toMatchObject({ code: "antigravity_remote_unavailable" }); - } - expect((await readAgent()).defaultEnvironmentId).toBeNull(); - }); - - it.skipIf(process.platform === "linux" && process.arch === "x64")("refuses a host agent when the company holds only a cloud grant", async () => { + it("ignores stale candidate grants and saves a host agent normally once released", async () => { vi.stubEnv(ANTIGRAVITY_CANDIDATE_ADMISSION_ENV, grant(agent.companyId, "linux-x64")); const response = await request(app).patch(`/api/agents/${agent.id}`) .send({ adapterConfig: { provider: "acpx", acpxAgent: "antigravity", model: "gemini-3.8-flash-high" } }); - expect(response.status, JSON.stringify(response.body)).toBe(422); - expect(response.body.error).toBe("Google Antigravity is enabled only for cloud environments in this company for now. Choose a cloud environment for this agent."); - expect(await db.select().from(agentConfigRevisions).where(eq(agentConfigRevisions.agentId, agent.id))).toHaveLength(0); + expect(response.status, JSON.stringify(response.body)).toBe(200); + expect(allocate).not.toHaveBeenCalled(); expect(probe).not.toHaveBeenCalled(); }); it("saves a Gemini API key and Google sign-in on a Core sandbox once released", async () => { - release.pending = false; for (const method of ["api_key", "subscription"] as const) { const binding = await saveGoogleConnection(method); const response = await request(app).patch(`/api/agents/${agent.id}`).send({ defaultEnvironmentId: cloud.id, runtimeConfig: { aiConnection: binding } }); @@ -199,7 +196,6 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { }); it("saves a Gemini API key and Google sign-in on a plugin Runner-task environment once released", async () => { - release.pending = false; const pluginEnv = await insertPluginTaskEnvironment(); for (const method of ["api_key", "subscription"] as const) { const binding = await saveGoogleConnection(method); @@ -213,7 +209,6 @@ describePostgres("Google Antigravity connection refusal at agent save", () => { }); it("creates a released Antigravity agent on a plugin Runner-task environment without enableNativeRunner", async () => { - release.pending = false; const pluginEnv = await insertPluginTaskEnvironment(); const binding = await saveGoogleConnection("subscription"); const response = await request(app).post(`/api/companies/${agent.companyId}/agents`).send({ diff --git a/server/src/routes/agents.ts b/server/src/routes/agents.ts index 15522905dcd..817e86becf2 100644 --- a/server/src/routes/agents.ts +++ b/server/src/routes/agents.ts @@ -2039,7 +2039,7 @@ export function agentRoutes( throw unprocessable("Select a Paperclip Runner provider before converting this agent."); } const next = { ...defaults, ...input.nextAdapterConfig }; - if (next.provider === "acpx" && (next.acpxAgent === "pi" || next.acpxAgent === "kimi")) { + if (next.provider === "acpx" && (next.acpxAgent === "pi" || next.acpxAgent === "kimi" || next.acpxAgent === "antigravity")) { next.model = input.nextAdapterConfig.model ?? (input.previousAdapterType === `${next.acpxAgent}_local` ? input.previousAdapterConfig.model : ""); } else if (!asNonEmptyString(next.model)) next.model = defaults.model; @@ -2279,7 +2279,7 @@ export function agentRoutes( const incompleteModelSetup = input.setupOnly && input.adapterType === "paperclip_runner" && (normalizedAdapterConfig.provider === "opencode" || normalizedAdapterConfig.provider === "cursor_cloud" - || (normalizedAdapterConfig.provider === "acpx" && ["pi", "kimi"].includes(String(normalizedAdapterConfig.acpxAgent)))) + || (normalizedAdapterConfig.provider === "acpx" && ["pi", "kimi", "antigravity"].includes(String(normalizedAdapterConfig.acpxAgent)))) && (normalizedAdapterConfig.model === undefined || normalizedAdapterConfig.model === ""); // Inactive drafts can precede model selection. Test/hire always validate the complete profile. if (!incompleteModelSetup) await assertAdapterConfigConstraints( diff --git a/server/src/services/native-runtime/acpx-qualification.test.ts b/server/src/services/native-runtime/acpx-qualification.test.ts index fbcd0de0fd7..05fd7e4a2fe 100644 --- a/server/src/services/native-runtime/acpx-qualification.test.ts +++ b/server/src/services/native-runtime/acpx-qualification.test.ts @@ -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" })); }, ); diff --git a/server/src/services/native-runtime/acpx-qualification.ts b/server/src/services/native-runtime/acpx-qualification.ts index ebc8013adf7..27388fc26c3 100644 --- a/server/src/services/native-runtime/acpx-qualification.ts +++ b/server/src/services/native-runtime/acpx-qualification.ts @@ -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); diff --git a/server/src/services/native-runtime/antigravity-candidate-admission.test.ts b/server/src/services/native-runtime/antigravity-candidate-admission.test.ts index 77812bb2ffa..82cf57def10 100644 --- a/server/src/services/native-runtime/antigravity-candidate-admission.test.ts +++ b/server/src/services/native-runtime/antigravity-candidate-admission.test.ts @@ -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" })); - }); }); diff --git a/server/src/services/native-runtime/antigravity-release.test.ts b/server/src/services/native-runtime/antigravity-release.test.ts index 47524ba2b04..6369f5082e2 100644 --- a/server/src/services/native-runtime/antigravity-release.test.ts +++ b/server/src/services/native-runtime/antigravity-release.test.ts @@ -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(); - 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 { release.pending = true; vi.unstubAllEnvs(); }); +afterEach(() => { release.pending = false; vi.unstubAllEnvs(); }); describe("Antigravity executor admission", () => { const admissible = (execution: NativeExecutionInput, changes: Partial[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 })) diff --git a/server/src/services/native-runtime/native-session-executor.test.ts b/server/src/services/native-runtime/native-session-executor.test.ts index 2bfd423b190..a91cb067833 100644 --- a/server/src/services/native-runtime/native-session-executor.test.ts +++ b/server/src/services/native-runtime/native-session-executor.test.ts @@ -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, diff --git a/server/src/services/native-runtime/plugin-runner-probe-antigravity.test.ts b/server/src/services/native-runtime/plugin-runner-probe-antigravity.test.ts index 25e9bbb715e..f8d91ee53d1 100644 --- a/server/src/services/native-runtime/plugin-runner-probe-antigravity.test.ts +++ b/server/src/services/native-runtime/plugin-runner-probe-antigravity.test.ts @@ -12,11 +12,11 @@ const mocks = vi.hoisted(() => ({ vi.mock("../../vendor/paperclip-runner/index.js", async importOriginal => { const original = await importOriginal(); - 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, diff --git a/server/src/services/native-runtime/provider-profile.ts b/server/src/services/native-runtime/provider-profile.ts index 163a91967db..3354c9fb57c 100644 --- a/server/src/services/native-runtime/provider-profile.ts +++ b/server/src/services/native-runtime/provider-profile.ts @@ -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") { diff --git a/tests/runner-e2e/catalog.test.ts b/tests/runner-e2e/catalog.test.ts index 26c895d71d2..56010d78d70 100644 --- a/tests/runner-e2e/catalog.test.ts +++ b/tests/runner-e2e/catalog.test.ts @@ -330,9 +330,9 @@ describe("runner E2E catalog", () => { expect(localIntegrityTasks).toHaveLength(2); expect(openRouterBreadthTasks).toHaveLength(3); expect(runnerSuites.map((suite) => suite.expectedMatrixSize)).toEqual([ - 1, 9, 2, 9, 2, 4, 1, 1, 3, 2, 2, 4, 4, 4, 4, 4, 4, 8, 10, 6, 63, 12, 6, 4, 2, 4, 2, 30, 3, 16, 16, 20, 24, 14, 14, 2, 2, 1, 6, 8, 46, 2, 23, 15, 68, 6, 8, 20, 26, 2, 56, 1, 491, 28, 18, 2, 6, 6, 13, 10, 4, 48, 16, 10, 2, 1, 1, 4, 116, 2, 1, 5, 2, + 1, 10, 2, 10, 2, 4, 1, 1, 3, 2, 2, 4, 4, 4, 4, 4, 4, 8, 10, 6, 63, 12, 6, 4, 2, 4, 2, 30, 3, 16, 16, 20, 24, 14, 14, 2, 2, 1, 6, 8, 46, 2, 23, 15, 68, 6, 8, 20, 26, 2, 56, 1, 491, 28, 18, 2, 6, 6, 13, 10, 4, 48, 16, 10, 2, 1, 1, 4, 116, 2, 1, 5, 2, ]); - expect(validateRunnerCatalog()).toHaveLength(1392); + expect(validateRunnerCatalog()).toHaveLength(1394); const frozenDirectory = new URL("./chat-scenarios/", import.meta.url); const frozenIds = readdirSync(frozenDirectory).filter(name => name.endsWith(".yaml") && name !== "defaults.yaml") .flatMap(name => parseDocument(readFileSync(new URL(name, frozenDirectory), "utf8")).toJS().scenarios.map((scenario: { id: string }) => scenario.id)); @@ -343,7 +343,7 @@ describe("runner E2E catalog", () => { expect(chat.map(cell => legacyScenarioIds[cell.task.id] ?? cell.task.id).sort()).toEqual(frozenIds.sort()); for (const cell of chat) expect(selectRunnerExecutions(parseRunnerSelectors(["--id", cell.id]))).toEqual([cell]); expect(selectRunnerExecutions(parseRunnerSelectors(["--all"])).some(cell => ["chat-features", "chat-setup-health"].includes(cell.suite.id))).toBe(false); - expect(new Set(runnerMatrix.map((entry) => entry.id)).size).toBe(1392); + expect(new Set(runnerMatrix.map((entry) => entry.id)).size).toBe(1394); expect( runnerMatrix.filter((entry) => entry.suite.id === "core-compatibility"), ).toHaveLength(48); diff --git a/tests/runner-e2e/controller-rolling-deployment.test.ts b/tests/runner-e2e/controller-rolling-deployment.test.ts index 7a7e6c5815a..2783db67116 100644 --- a/tests/runner-e2e/controller-rolling-deployment.test.ts +++ b/tests/runner-e2e/controller-rolling-deployment.test.ts @@ -4,7 +4,7 @@ import { rollController, validControllerRollingDeploymentReceipt } from "./contr import { validControllerReplacementReceipt } from "./controller-replacement.js"; import { controllerOutageForExecution, validControllerOutageReceipt } from "./controller-outage.js"; import { parseRunnerSelectors, selectRunnerExecutions } from "./selectors.js"; -import { runnerProfiles, extendedHarnessProfiles, kimiRunnerProfile, runnerSuites } from "./catalog.js"; +import { runnerProfiles, extendedHarnessProfiles, kimiRunnerProfile, antigravityRunnerProfile, runnerSuites } from "./catalog.js"; function fixture() { const order: string[] = []; @@ -60,7 +60,7 @@ describe("rolling controller qualification", () => { it("covers every qualified native profile per turn and each supported warm profile", () => { const executions = ["rolling-web-deployment", "rolling-web-deployment-warm"] .flatMap(suite => selectRunnerExecutions(parseRunnerSelectors(["--suite", suite]))); - const native = [...runnerProfiles, ...extendedHarnessProfiles, kimiRunnerProfile] + const native = [...runnerProfiles, ...extendedHarnessProfiles, kimiRunnerProfile, antigravityRunnerProfile] .filter(profile => profile.generation === "native" && profile.supportedEnvironments.includes("daytona") && (!profile.qualificationCandidate || QUALIFIED_ACPX_PROFILES[profile.qualificationCandidate].qualificationStatus !== "pending")); const kind = (profile: (typeof native)[number]) => { diff --git a/ui/src/lib/cloud-harness-policy.test.ts b/ui/src/lib/cloud-harness-policy.test.ts index 4340b6a8946..18e5755ba5e 100644 --- a/ui/src/lib/cloud-harness-policy.test.ts +++ b/ui/src/lib/cloud-harness-policy.test.ts @@ -22,11 +22,10 @@ describe("configured Cloud harness choices", () => { expect(changed.isCloudRunnerProviderAllowed("copilot")).toBe(false); }); - it("keeps qualification gates when the deployment allows a candidate", () => { + it("allows qualified Antigravity when the deployment policy enables it, without a candidate grant", () => { const policy = createCloudHarnessPolicy(["antigravity_runtime"]); - const options = { cloud: true, harnessPolicy: policy, nativeRunnerEnabled: true, runnerProvider: "antigravity" }; - expect(isNewAgentAdapterAllowed("paperclip_runner", options)).toBe(false); - expect(isNewAgentAdapterAllowed("paperclip_runner", { ...options, candidateHarnesses: [{ agent: "antigravity", model: "candidate-model" }] })).toBe(true); + const options = { cloud: true, harnessPolicy: policy, nativeRunnerEnabled: false, runnerProvider: "antigravity" }; + expect(isNewAgentAdapterAllowed("paperclip_runner", options)).toBe(true); }); it.each(["claude_local", "codex_local", "grok_local", "opencode_local", "copilot_runtime"])("offers %s", type => { diff --git a/ui/src/lib/native-model-catalog.test.ts b/ui/src/lib/native-model-catalog.test.ts index 97b41b3a79c..c7154c97d93 100644 --- a/ui/src/lib/native-model-catalog.test.ts +++ b/ui/src/lib/native-model-catalog.test.ts @@ -18,7 +18,7 @@ describe("Antigravity model catalog scope", () => { expect(nativeTaskModelCatalogOptions(agent)).toEqual({ acpxAgent: "antigravity", agentId: agent.id, aiConnection: undefined }); expect(nativeTaskModelCatalogOptions({ ...agent, adapterConfig: { provider: "acpx", acpxAgent: "claude" } })).toBeUndefined(); }); - it("keeps pending Antigravity unavailable even when experimental Runner is enabled", () => { - expect(isNewAgentAdapterAllowed("paperclip_runner", { cloud: false, nativeRunnerEnabled: true, runnerProvider: "antigravity" })).toBe(false); + it("allows qualified Antigravity without an experimental Runner toggle or candidate grant", () => { + expect(isNewAgentAdapterAllowed("paperclip_runner", { cloud: false, nativeRunnerEnabled: false, runnerProvider: "antigravity" })).toBe(true); }); });