fix(antigravity): offer the cloud candidate in the agent picker for linux-x64 environments (#22655)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Google Antigravity is a native Runner harness (#22591). Its profile
is still pending, so only a company with an operator grant can see or
run it
> - A grant can name the cloud target (linux-x64), and save, Test and
execution already accept it for a cloud environment
> - The agent picker computed the candidate only for the local target,
so a company with a valid cloud grant never saw the harness for a cloud
environment
> - This pull request binds the picker to the selected environment's
target, in the Antigravity-owned module
> - The benefit is that a granted company can pick Antigravity for the
linux-x64 cloud environments that can run it, and still sees nothing
anywhere else

## Linked Issues or Issue Description

Refs #22591

**What happened?**
`GET /api/adapters?companyId=…&environmentId=…` returned
`candidateHarnesses` only when the environment target was `local`. A
company with a valid linux-x64 Antigravity grant got no candidate for a
Core sandbox or SSH environment.

**What did you expect?**
The picker offers the candidate for a linux-x64 cloud environment when
the company holds a grant for that target, the same way save, Test and
the executor admit it.

**Steps to reproduce**
1. Set a candidate grant that names linux-x64 for a company and exact
model.
2. Request the adapter list for that company with a linux-x64 sandbox
environment.
3. `paperclip_runner` has no `candidateHarnesses`.

## What Changed

- `antigravityCandidateForRunnerTarget` (in `antigravity-release.ts`)
decides the picker candidate per environment target:
  - local: unchanged.
- Core sandbox or SSH that is linux-x64, or the managed cloud image:
only a grant that names linux-x64 and its patched closure.
- plugin Runner-task environment, unknown or other platform, unavailable
Computer: none.
  - released profile: none.
- `GET /api/adapters` uses it for every resolved target. Expired or
mismatched grants stay quiet; malformed grants still log one warning.
- The qualification plan notes the picker rule and records, as an open
decision, why plugin Runner-task environments cannot run Antigravity
yet.

### Not in this PR: plugin Runner-task environments

Paperclip Cloud's warm Agent Computer runs agents only as plugin Runner
tasks. Antigravity cannot run there yet, and the fix is outside Core
alone:
- The plugin task credential contract
(`environmentTaskCredentialSchema`) has no Gemini API key type.
- The plugin prepares the provider launch from `launch-requirements.v1`,
which carries no candidate grant. The ACPX sidecar refuses a pending
profile without one.
- The Cloud plugin's harness table lists only Codex, Claude and
OpenCode. Kimi, Copilot and Pi do not run there either.
- Antigravity Test refuses the Runner-task path.

The picker therefore offers nothing for those environments until that
work lands.

## Verification

- Red, then green: `server/src/__tests__/adapter-routes.test.ts` "offers
a cloud environment the candidate only for the company's linux-x64
grant" failed before the fix and passes after it.
- New unit tests in `antigravity-release.test.ts` run the real grant
resolver: cloud grant offered, other company / arm64 / Runner-task /
expired / host grant refused, released profile offers none.
- `npx vitest run src/__tests__/adapter-routes.test.ts
src/services/native-runtime/antigravity-release.test.ts
src/services/native-runtime/acpx-qualification.test.ts
src/services/native-runtime/antigravity-candidate-admission.test.ts`: 98
passed.
- Server `tsc --noEmit`: clean. `pnpm verify`: see the CI checks for the
final revision.
- Not run live: no Antigravity prompt has completed in any environment
yet, and the only available Gemini key is free tier. No paid runner E2E
workflow was dispatched.

## Risks

- Low risk. The change is read-only catalog output. Save, Test and
execution keep their strict admission checks.
- A company that holds a linux-x64 grant now sees Antigravity for
linux-x64 sandbox and SSH environments. Those paths already accept that
grant.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, with tool use (shell,
file edits) in Claude Code.

## 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
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 authored and GitHub committed 2026-11-23 11:09:22 -06:00
1 parent 5f5ac15436
commit 70d4b6524c
8 files changed
+140 -8

No files matched your search

@@ -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.
+2 -1
View File
@@ -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;
+1 -1
View File
@@ -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";
@@ -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" }) });
+4 -4
View File
@@ -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<typeof resolveAntigravityCandidateAdmission>;
if (typeof companyId === "string" && target?.driver === "local") {
let candidate: ReturnType<typeof antigravityCandidateForRunnerTarget>;
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
@@ -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();
@@ -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
@@ -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",