diff --git a/doc/plans/2026-11-22-antigravity-qualification.md b/doc/plans/2026-11-22-antigravity-qualification.md index 120b1b64469..14315e1c0de 100644 --- a/doc/plans/2026-11-22-antigravity-qualification.md +++ b/doc/plans/2026-11-22-antigravity-qualification.md @@ -137,6 +137,11 @@ 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). ### Launch integrity follow-up (2026-11-22) @@ -176,3 +181,11 @@ provider-death fixtures now target the store and per-launch directory layout. - Orchestrator mode: excluded for this release (not exposed over ACP in 1.5.2). - Merge and production flip after the PR is green. - Disposition of community PR #21121 (separate legacy-style adapter). +- Plugin Runner-task environments. Paperclip Cloud's warm Agent Computer runs + agents only as plugin Runner tasks, and that path has no Antigravity launch: + the plugin task credential contract has no Gemini API key type, the plugin + prepares the provider launch without a candidate grant (so a pending profile + is refused by the sidecar), the Cloud plugin's harness table lists only Codex, + Claude and OpenCode, and Test refuses the path. Kimi, Copilot and Pi do not + run there either. Closing it needs a plugin SDK contract change plus a Cloud + plugin and image change. diff --git a/packages/shared/src/agent-runner.ts b/packages/shared/src/agent-runner.ts index db11502d8a4..8d60a246a8e 100644 --- a/packages/shared/src/agent-runner.ts +++ b/packages/shared/src/agent-runner.ts @@ -31,7 +31,8 @@ export function paperclipRunnerCreationLifecycle( export const PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION = "2.39"; -function supportsLinuxLibc(libc?: "glibc" | "musl" | "unknown", version?: string): boolean { +/** The Runner's Linux libc floor: glibc at or above the minimum version. */ +export function supportsLinuxLibc(libc?: "glibc" | "musl" | "unknown", version?: string): boolean { if (libc !== undefined && libc !== "glibc") return false; if (version === undefined) return true; const match = typeof version === "string" ? version.trim().match(/^(?:glibc\s+)?(\d+)\.(\d+)(?:\.\d+)?$/) : null; diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 76a0b1a876d..773b1934c94 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -3095,7 +3095,7 @@ export { type AntigravityThinkingLevel, } from "./antigravity-models.js"; export { ANTIGRAVITY_GENERATED_MODEL_CATALOG } from "./antigravity-models.generated.js"; -export { agentHarnessName, agentHarnessType, agentRuntimeSettingsHarness, agentRunner, paperclipRunnerCreationLifecycle, paperclipRunnerProfileForHarness, paperclipRunnerSupportsPlatform, PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION, type AgentRunnerChoice, type AgentRunner, type AgentRunnerAvailability } from "./agent-runner.js"; +export { agentHarnessName, agentHarnessType, agentRuntimeSettingsHarness, agentRunner, paperclipRunnerCreationLifecycle, paperclipRunnerProfileForHarness, paperclipRunnerSupportsPlatform, supportsLinuxLibc, PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION, type AgentRunnerChoice, type AgentRunner, type AgentRunnerAvailability } from "./agent-runner.js"; export { normalizeClaudeRunnerOptions, type AgentConfigurationWarning } from "./runner-configuration-warnings.js"; export { EXTERNAL_AGENT_TOOL_GUIDANCE, DOT_AGENT_TOOL_GUIDANCE, GROK_BOT_AGENT_TOOL_GUIDANCE } from "./external-agent-guidance.js"; diff --git a/server/src/__tests__/adapter-routes.test.ts b/server/src/__tests__/adapter-routes.test.ts index 84fbf32cb1a..46f86c6bce0 100644 --- a/server/src/__tests__/adapter-routes.test.ts +++ b/server/src/__tests__/adapter-routes.test.ts @@ -168,6 +168,7 @@ describe("adapter routes", () => { expect(response.status).toBe(200); expect(response.body.every((adapter: any) => adapter.candidateHarnesses === undefined)).toBe(true); } + // A cloud environment whose platform is unknown is never offered a candidate. const remote = await request(createApp({}, { resolveRunnerTarget: async () => ({ driver: "ssh" }) })) .get("/api/adapters?companyId=company-1&environmentId=remote"); expect(remote.body.every((adapter: any) => adapter.candidateHarnesses === undefined)).toBe(true); @@ -176,6 +177,43 @@ 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(); + // A plugin Runner-task environment cannot launch Antigravity yet. + expect(await candidates({ driver: "plugin", runnerTasks: true })).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"); }); const app = createApp({}, { resolveRunnerTarget: async () => ({ driver: "local" }) }); diff --git a/server/src/routes/adapters.ts b/server/src/routes/adapters.ts index 94e0ab10c97..d5af45a560c 100644 --- a/server/src/routes/adapters.ts +++ b/server/src/routes/adapters.ts @@ -56,7 +56,7 @@ import { assertBoardOrgAccess, assertCompanyAccess, assertInstanceAdmin, getActo import { BUILTIN_ADAPTER_TYPES } from "../adapters/builtin-adapter-types.js"; import { agentRunnerAvailability, type RunnerTarget } from "../services/agent-runner-selection.js"; import type { AgentRunnerAvailability } from "@paperclipai/shared"; -import { resolveAntigravityCandidateAdmission } from "../services/native-runtime/acpx-qualification.js"; +import { antigravityCandidateForRunnerTarget } from "../services/native-runtime/antigravity-release.js"; const execFileAsync = promisify(execFile); let warnedMalformedAntigravityAdmission = false; @@ -304,11 +304,11 @@ export function adapterRoutes(options: { // One shared implementation, with independent provider rollouts. Explicit // adapter-admin disabling still applies to both choices. - let candidate: ReturnType; - if (typeof companyId === "string" && target?.driver === "local") { + let candidate: ReturnType; + if (typeof companyId === "string" && target) { // An expired optional preview must not hide the ordinary adapter catalog. // Execution and model discovery still perform strict admission checks. - try { candidate = resolveAntigravityCandidateAdmission({ companyId }); } + try { candidate = antigravityCandidateForRunnerTarget(companyId, target); } catch (error) { candidate = undefined; // Expiry is ordinary catalog state. Invalid trusted startup JSON needs diff --git a/server/src/services/native-runtime/antigravity-release.test.ts b/server/src/services/native-runtime/antigravity-release.test.ts index 8a83e712121..b99029caf78 100644 --- a/server/src/services/native-runtime/antigravity-release.test.ts +++ b/server/src/services/native-runtime/antigravity-release.test.ts @@ -19,6 +19,7 @@ vi.mock("../../vendor/paperclip-runner/index.js", async importOriginal => { import { NativeProviderStateIncompatibleError, QUALIFIED_ACPX_PROFILES, type NativeExecutionInput } from "../../vendor/paperclip-runner/index.js"; import { ANTIGRAVITY_CANDIDATE_ADMISSION_ENV } from "./acpx-qualification.js"; import { + antigravityCandidateForRunnerTarget, antigravityForcesSameSessionRecovery, antigravityReleasePending, antigravityUsesRunScopedState, @@ -111,6 +112,63 @@ describe("Antigravity executor admission", () => { }); }); +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", () => { + 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(); + }); +}); + describe("Antigravity recovery policy and state root", () => { it("forces the candidate's same-session recovery and per-run root only while pending", () => { const execution = antigravityExecution(); diff --git a/server/src/services/native-runtime/antigravity-release.ts b/server/src/services/native-runtime/antigravity-release.ts index a831e4b9fc1..7175a5579bb 100644 --- a/server/src/services/native-runtime/antigravity-release.ts +++ b/server/src/services/native-runtime/antigravity-release.ts @@ -3,6 +3,8 @@ import { QUALIFIED_ACPX_PROFILES, type NativeExecutionInput, } from "../../vendor/paperclip-runner/index.js"; +import { supportsLinuxLibc } from "@paperclipai/shared"; +import type { RunnerTarget } from "../agent-runner-selection.js"; import { ANTIGRAVITY_REMOTE_TARGET, resolveAntigravityCandidateAdmission } from "./acpx-qualification.js"; /** The platform a pending candidate grant must name for this execution. */ @@ -10,6 +12,26 @@ export function antigravityCandidateTarget(remote: boolean): { platform: string; return remote ? ANTIGRAVITY_REMOTE_TARGET : { platform: process.platform, architecture: process.arch }; } +/** + * The candidate grant the agent picker may offer for one environment, bound to + * the target the run would use. This host needs a grant that names this host. + * A Core sandbox or SSH environment needs a grant for the cloud pack's + * linux-x64 closure and a linux-x64 glibc Computer the Runner supports (or the + * managed cloud image). A plugin Runner-task environment offers none: it cannot + * launch Antigravity yet. A released profile offers no candidate. May throw for + * a grant that is invalid or names another target. + */ +export function antigravityCandidateForRunnerTarget(companyId: string, target: RunnerTarget) { + if (!antigravityReleasePending()) return undefined; + if (target.driver === "local") return resolveAntigravityCandidateAdmission({ companyId, target: antigravityCandidateTarget(false) }); + if ((target.driver !== "sandbox" && target.driver !== "ssh") || target.runnerTasks) return undefined; + const managedImage = target.driver === "sandbox" && target.managedCloudImage && !target.platform && !target.architecture; + const linuxX64 = target.platform === ANTIGRAVITY_REMOTE_TARGET.platform && target.architecture === ANTIGRAVITY_REMOTE_TARGET.architecture + && target.libc === "glibc" && supportsLinuxLibc(target.libc, target.glibcVersion); + if (!managedImage && !linuxX64) return undefined; + return resolveAntigravityCandidateAdmission({ companyId, target: ANTIGRAVITY_REMOTE_TARGET }); +} + /** * Google Antigravity's server gates while its Runner profile is pending, and * the general qualified ACPX path after the release flip. Every gate reads the diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index 7017340875f..bc540a0de1a 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -56,7 +56,7 @@ "packages/shared/src/agent-observability.test.ts": "36cd74a8a8d1947364ec96fa30deabff14658df2", "packages/shared/src/agent-observability.ts": "52dc94e13624adeaf1aafa8996099a5dc158ef4b", "packages/shared/src/agent-runner.test.ts": "d02d0bba0cf57838011d4ec5f1304b65c15cff56", - "packages/shared/src/agent-runner.ts": "db11502d8a42961170badd4264aa3fe45a95049c", + "packages/shared/src/agent-runner.ts": "8d60a246a8eb0d6304642a28926516066b459b4f", "packages/shared/src/agent-url-key.ts": "d0ec20b3ea1636a960bc5372a2c1e5a124bc5511", "packages/shared/src/aggregator-app-catalog.test.ts": "39ee377e55cc9565fce004b928bbe0998268e004", "packages/shared/src/aggregator-app-catalog.ts": "d6778b07a41356878c549d039ae316553ca9a22b", @@ -275,7 +275,7 @@ "packages/shared/src/home-paths.ts": "fa4f1c440653b76b3dbb7a51026d557287deb45d", "packages/shared/src/humanize-connection.test.ts": "ba9e90a44c63452b0bf9f733adb90241921e8eca", "packages/shared/src/humanize-connection.ts": "fbd414476a0ef7106a7c80d8572208781b091699", - "packages/shared/src/index.ts": "76a0b1a876d4ab010fdec130c267ddf5af5ba465", + "packages/shared/src/index.ts": "773b1934c94beae32470695140b80171a4607e6b", "packages/shared/src/issue-activity-identity.test.ts": "3dc294640f54c2be67943e3e0149cf4eff2c95ca", "packages/shared/src/issue-activity-identity.ts": "1b0f07ec3fe0506aaaf80a4fa9893f3baf8f0075", "packages/shared/src/issue-attribution.test.ts": "84563685e7f3c48029243cf1cc24a3a09ee3cde9",