mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 09:39:53 +01:00
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:
1 parent
5f5ac15436
commit
70d4b6524c
8 files changed
+140
-8
No files matched your search
@@ -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" }) });
|
||||
|
||||
Reference in new issue
Block a user