mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
test(antigravity): prove run start keeps the Antigravity gates and hands plugin runs their typed credential (#22943)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The native Runner runs Google Antigravity on this host, on Core managed sandboxes, and on plugin Runner-task environments such as the Paperclip Cloud agent computer. > - #22940 removed the refusals that stopped Antigravity on plugin Runner-task targets, and the refusal of Google sign-in on remote targets once the profile is released. That is item 6 of the Antigravity Cloud rollout plan. > - Run start must still refuse a pending profile on every remote target without an operator grant. A plugin Runner-task target must refuse even with a grant. A released profile must refuse state saved under another profile version. > - Existing tests proved these rules at the unit level and at save, Test and probe time. No test proved them at run start, where a plugin Runner task is actually launched. No test proved that a released plugin Runner-task run gets the correct typed credential. > - This pull request adds a focused run-start test suite for those rules and marks item 6 done in the plan. > - The benefit is that a later change cannot silently reopen these gates or leak the wrong credential to a plugin Runner task. ## Linked Issues or Issue Description - Refs #22940 (item 6 implementation) - Refs #22923 (rollout plan) - Refs #22933 (item 2: sign-in task credential with write-back) - Refs #22935 (item 3: per-turn harnesses stay per-turn on warm environments) ## What Changed - Added `server/src/services/native-runtime/antigravity-run-start.test.ts`. Every case except the credential cases runs through `executePaperclipNativeSession`. The suite sets the release state explicitly in each test, so the tests stay valid now that the profile is released. - Pending, no grant: plugin Runner-task and Core sandbox runs fail with `paperclip_runner_antigravity_candidate_ineligible`. No plugin task, task owner or backend starts. - Pending, with a grant: a positive control shows the grant admits a Core sandbox linux-x64 run past the gate. The same grant still refuses a plugin Runner-task run. - Released: a plugin Runner-task run passes the gate. A run whose saved state uses an older profile version is refused with `NativeProviderStateIncompatibleError`. - Released, credential: through `createRunnerdBackend`, the plugin Runner task owner receives only `{type: "provider-env", provider: "antigravity"}` with `GEMINI_API_KEY` (API key) or `PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET` (sign-in). Ambient `GOOGLE_*` and `GEMINI_HOME` values do not reach the task. Only the sign-in run registers its write-back handoff. - Added a shared `antigravity.test-fixture.ts` (execution builder and a minimal database stub). `antigravity-release.test.ts` now uses this fixture. - The grant in the positive control comes from a stub of the server's grant resolver. Since the release flip, the Runner's grant parser refuses every grant for a released profile, so no real grant can be valid in this build. The stub tests the server rule (a plugin Runner-task target never takes a grant) on its own. - Marked item 6 done in `doc/plans/2026-11-25-antigravity-cloud-rollout.md`. - No product code changed. ## Verification - `cd server && npx vitest run src/services/native-runtime/antigravity-run-start.test.ts src/services/native-runtime/antigravity-release.test.ts`: 16 passed. - Server typecheck: no errors in the changed files. - Red/green. For each rule, I removed the rule and confirmed the matching test fails. Then I restored the rule and confirmed all 6 tests pass: - Lifting the pending remote gate: 3 tests fail (both no-grant cases and the granted case). - Removing the plugin-only refusal: the granted plugin case fails. - Removing the saved-state profile check: the released saved-state case fails. - Restoring the old "no Google sign-in on remote targets" refusal: the sign-in credential case fails. - `tests/runner-e2e/source-sdk-public-inputs.json` is unchanged (the script reports `changed: false`). - No live runs, Google sign-in, real tokens or paid workflows were used. ## Risks - Low risk. The change adds tests, a test fixture and one plan line. It does not change runtime behavior. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, 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 - [ ] 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
14f5907776
commit
5a683696eb
4 files changed
+195
-25
No files matched your search
@@ -342,7 +342,7 @@ in that repository.
|
||||
| 3 | Keep per-turn-only harnesses per-turn on warm plugin environments | Core | `server/src/services/runner-environment-lifecycle.ts`, `server/src/routes/agents.ts` (save check), tests | An Antigravity agent on a plugin environment with `runnerLifecycleMode: "warm"` runs per-turn, or save refuses it in plain words; no run fails with the warm refusal | none | A |
|
||||
| 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 |
|
||||
| 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. **Status: done.** Merged in #22940; run-start tests (pending profile refused on plugin and sandbox targets without a grant, released profile hands the plugin Runner its typed API-key or sign-in credential) added in a follow-up | 1, 2, 3 | C |
|
||||
| 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/<pid>/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) |
|
||||
|
||||
@@ -29,35 +29,12 @@ import {
|
||||
antigravityUsesRunScopedState,
|
||||
assertAntigravityExecutionAdmissible,
|
||||
} from "./antigravity-release.js";
|
||||
import { buildNativeExecutionInput } from "./native-execution-input.js";
|
||||
import { nativeSessionFailureDisposition, nativeSessionFailureSourceCode, retireNeverOpenedCandidateRunRoot, scopedRunnerdStateRoot } from "./native-session-executor.js";
|
||||
import { NATIVE_PROVIDER_STATE_INCOMPATIBLE } from "./native-session-resume.js";
|
||||
import { nativeRuntimeContextFixture } from "./runtime-context.test-fixture.js";
|
||||
import { ANTIGRAVITY_FIXTURE_COMPANY_ID as companyId, ANTIGRAVITY_FIXTURE_MODEL as model, antigravityExecution } from "./antigravity.test-fixture.js";
|
||||
|
||||
const companyId = "10000000-0000-4000-8000-000000000001";
|
||||
const model = "gemini-3.8-flash-low";
|
||||
const localHost = process.platform === "darwin" && process.arch === "arm64";
|
||||
const distributions = JSON.parse(readFileSync(new URL("../../../../packages/paperclip-runner/antigravity-distributions.json", import.meta.url), "utf8"));
|
||||
|
||||
function antigravityExecution(input: { runId?: string; issueId?: string; workspaceId?: string; sessionId?: string } = {}) {
|
||||
const runId = input.runId ?? "40000000-0000-4000-8000-000000000004";
|
||||
const execution = buildNativeExecutionInput({
|
||||
companyId, runId, agentId: "30000000-0000-4000-8000-000000000003",
|
||||
issue: { id: input.issueId ?? "20000000-0000-4000-8000-000000000002", identifier: "AG-1", title: "Test", description: null, workMode: "standard" },
|
||||
taskPrompt: "Only the current turn",
|
||||
workspace: { id: input.workspaceId ?? "90000000-0000-4000-8000-000000000009", cwd: "/workspace", repoUrl: null, repoRef: null, branchName: null },
|
||||
normalizedSessionId: input.sessionId ?? "60000000-0000-4000-8000-000000000006",
|
||||
provider: "acpx", acpxAgent: "antigravity", model, acpxPermissionMode: "approve-all",
|
||||
completionContract: { id: "70000000-0000-4000-8000-000000000007", sha256: `sha256:${"a".repeat(64)}`, schemaVersion: "paperclip.run-result.v1",
|
||||
contract: { revision: "1", objective: "Test", criteria: [{ id: "objective", requirement: "Answer" }] } },
|
||||
runtimeContext: nativeRuntimeContextFixture(),
|
||||
}) as NativeExecutionInput;
|
||||
// The execution input binds the profile version the running release declares.
|
||||
(execution.provider as { profile: { agentProfileVersion: number } }).profile.agentProfileVersion =
|
||||
QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion;
|
||||
return execution;
|
||||
}
|
||||
|
||||
const candidateGrant = (target = "darwin-arm64", changes: Record<string, unknown> = {}) => {
|
||||
const [platform, architecture] = target.split("-");
|
||||
return JSON.stringify({ schema: "paperclip.acpx-candidate-admission.v1", companyId,
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
import { mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi, type MockInstance } from "vitest";
|
||||
import type { AdapterExecutionTarget } from "@paperclipai/adapter-utils/execution-target";
|
||||
|
||||
const release = vi.hoisted(() => ({ pending: false }));
|
||||
const grant = vi.hoisted(() => ({ admitted: false, targets: [] as Array<{ platform: string; architecture: string } | undefined> }));
|
||||
const backend = vi.hoisted(() => ({ options: undefined as undefined | { codexTransportFactory?: () => unknown } }));
|
||||
|
||||
vi.mock("../../vendor/paperclip-runner/index.js", async importOriginal => {
|
||||
const original = await importOriginal<typeof import("../../vendor/paperclip-runner/index.js")>();
|
||||
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 ? pending : original.QUALIFIED_ACPX_PROFILES.antigravity });
|
||||
return {
|
||||
...original,
|
||||
QUALIFIED_ACPX_PROFILES: profiles,
|
||||
createNativeSessionBackend: vi.fn((_session: unknown, options: { codexTransportFactory?: () => unknown }) => {
|
||||
backend.options = options;
|
||||
return { kind: "test", openSession: vi.fn() };
|
||||
}),
|
||||
createRunnerdCodexTransport: vi.fn(() => ({ transport: { close: vi.fn(async () => undefined) } })),
|
||||
executeNativeSession: vi.fn(async () => { throw new Error("fixture: provider execution is out of scope"); }),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("./acpx-qualification.js", async importOriginal => {
|
||||
const original = await importOriginal<typeof import("./acpx-qualification.js")>();
|
||||
return {
|
||||
...original,
|
||||
resolveAntigravityCandidateAdmission: vi.fn((input: Parameters<typeof original.resolveAntigravityCandidateAdmission>[0]) => {
|
||||
grant.targets.push(input.target);
|
||||
if (!grant.admitted || input.target?.platform !== "linux" || input.target.architecture !== "x64") return undefined;
|
||||
return { schema: "paperclip.acpx-candidate-admission.v1", companyId: input.companyId, agent: "antigravity", model: input.model,
|
||||
platform: "linux", architecture: "x64" };
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("./native-runner-file-handoff.js", () => ({
|
||||
stageNativeRunnerWakeAttachments: vi.fn(async () => ({ attachments: [], cleanup: async () => undefined })),
|
||||
renderNativeRunnerStagedAttachmentPrompt: vi.fn(() => null),
|
||||
}));
|
||||
|
||||
vi.mock("./native-controller-recovery.js", async importOriginal => ({
|
||||
...await importOriginal<typeof import("./native-controller-recovery.js")>(),
|
||||
resolveNativeControllerRecovery: vi.fn(async () => ({ kind: "no_prior_execution" })),
|
||||
}));
|
||||
|
||||
vi.mock("../../runtime-api.js", async importOriginal => ({
|
||||
...await importOriginal<typeof import("../../runtime-api.js")>(),
|
||||
resolveLocalRuntimeApiUrl: vi.fn(() => "http://127.0.0.1:43219"),
|
||||
}));
|
||||
|
||||
import { NativeProviderStateIncompatibleError, type NativeExecutionInput } from "../../vendor/paperclip-runner/index.js";
|
||||
import { antigravityReleasePending } from "./antigravity-release.js";
|
||||
import { createRunnerdBackend, executePaperclipNativeSession } from "./native-session-executor.js";
|
||||
import * as pluginTaskRuntime from "./plugin-runner-task.js";
|
||||
import * as pluginCredentialWriteback from "../plugin-task-credential-writeback.js";
|
||||
import { antigravityExecution, emptyDb } from "./antigravity.test-fixture.js";
|
||||
|
||||
const describeTask = vi.fn(async (operation: { kind: string }) => operation.kind === "describe"
|
||||
? { kind: "description", launchPreparationVersion: 1, projectAuthCheckVersion: 1, taskId: "task",
|
||||
runner: { version: "fixture", digest: `sha256:${"a".repeat(64)}` } }
|
||||
: { kind: "accepted", taskId: "task" });
|
||||
const pluginTarget = () => ({ kind: "remote", transport: "sandbox", providerKey: "plugin", leaseId: "lease",
|
||||
remoteCwd: "/unused", runnerTask: describeTask }) as unknown as AdapterExecutionTarget;
|
||||
const sandboxTarget = () => ({ kind: "remote", transport: "sandbox", remoteCwd: "/workspace",
|
||||
runner: { execute: vi.fn() } }) as unknown as AdapterExecutionTarget;
|
||||
const runStart = (execution: NativeExecutionInput, runnerExecutionTarget: AdapterExecutionTarget) =>
|
||||
executePaperclipNativeSession({ db: emptyDb(), execution, useRunnerd: true, runnerInstanceId: "antigravity-run-start",
|
||||
runnerIngressAuthorized: true, runnerExecutionTarget });
|
||||
const INELIGIBLE = /paperclip_runner_antigravity_candidate_ineligible/;
|
||||
|
||||
let ownerFactory: MockInstance<typeof pluginTaskRuntime.createPluginRunnerTaskOwner>;
|
||||
beforeEach(() => {
|
||||
grant.admitted = false; grant.targets = []; backend.options = undefined;
|
||||
describeTask.mockClear();
|
||||
ownerFactory = vi.spyOn(pluginTaskRuntime, "createPluginRunnerTaskOwner");
|
||||
});
|
||||
afterEach(() => { release.pending = false; ownerFactory.mockRestore(); vi.unstubAllEnvs(); });
|
||||
|
||||
describe("Antigravity run start while the profile is pending", () => {
|
||||
beforeEach(() => { release.pending = true; });
|
||||
|
||||
it.each([["plugin Runner-task", pluginTarget], ["Core sandbox", sandboxTarget]] as const)(
|
||||
"refuses a %s run without an operator grant before any launch", async (_name, target) => {
|
||||
expect(antigravityReleasePending()).toBe(true);
|
||||
await expect(runStart(antigravityExecution(), target())).rejects.toThrow(INELIGIBLE);
|
||||
expect(describeTask).not.toHaveBeenCalled();
|
||||
expect(ownerFactory).not.toHaveBeenCalled();
|
||||
expect(backend.options).toBeUndefined();
|
||||
});
|
||||
|
||||
it("admits a granted Core sandbox run past the gate, and still refuses the same grant on a plugin Runner-task target", async () => {
|
||||
grant.admitted = true;
|
||||
const admitted = await runStart(antigravityExecution(), sandboxTarget()).then(() => null, (error: unknown) => error);
|
||||
expect(String(admitted)).not.toMatch(INELIGIBLE);
|
||||
expect(grant.targets).toContainEqual({ platform: "linux", architecture: "x64" });
|
||||
await expect(runStart(antigravityExecution(), pluginTarget())).rejects.toThrow(INELIGIBLE);
|
||||
expect(describeTask).not.toHaveBeenCalled();
|
||||
expect(ownerFactory).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Antigravity run start once the profile is released", () => {
|
||||
it("passes the gate on a plugin Runner-task target and refuses state saved under another profile version", async () => {
|
||||
expect(antigravityReleasePending()).toBe(false);
|
||||
const current = await runStart(antigravityExecution(), pluginTarget()).then(() => null, (error: unknown) => error);
|
||||
expect(String(current)).not.toMatch(INELIGIBLE);
|
||||
expect(current).not.toBeInstanceOf(NativeProviderStateIncompatibleError);
|
||||
const older = antigravityExecution();
|
||||
(older.provider as { profile: { agentProfileVersion: number } }).profile.agentProfileVersion -= 1;
|
||||
await expect(runStart(older, pluginTarget())).rejects.toBeInstanceOf(NativeProviderStateIncompatibleError);
|
||||
});
|
||||
|
||||
it.each(["api_key", "sign_in"] as const)("hands a %s plugin Runner task only its typed credential", async method => {
|
||||
const directory = await realpath(await mkdtemp(join(tmpdir(), "antigravity-run-start-")));
|
||||
vi.stubEnv("PAPERCLIP_RUNNER_STATE_DIR", join(directory, "runner"));
|
||||
const managedHome = join(directory, "managed-home");
|
||||
await mkdir(join(managedHome, "antigravity-acp"), { recursive: true, mode: 0o700 });
|
||||
const signIn = JSON.stringify({
|
||||
client_id: "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com", client_secret: "fixture-client-secret",
|
||||
refresh_token: "fixture-google-refresh", token_uri: "https://oauth2.googleapis.com/token",
|
||||
scopes: ["https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/aicode"],
|
||||
});
|
||||
await writeFile(join(managedHome, "antigravity-acp", "acp_token.json"), signIn, { mode: 0o600 });
|
||||
const owner = { launcher: vi.fn(), registration: vi.fn(), readWorkspaceFile: vi.fn(), isRetired: () => false, rebind: vi.fn(),
|
||||
driver: { authorityRunId: "run", prepareLaunch: vi.fn(), runnerProcessLauncher: vi.fn(), controlPlaneRegistration: vi.fn() } };
|
||||
ownerFactory.mockReturnValue(owner as never);
|
||||
const handoff = vi.spyOn(pluginCredentialWriteback, "registerPluginTaskCredentialHandoff").mockResolvedValue(undefined as never);
|
||||
try {
|
||||
await createRunnerdBackend({ db: emptyDb(), execution: antigravityExecution(), runnerInstanceId: "antigravity-run-start",
|
||||
runnerIngressAuthorized: true, managedAiCredentialHome: managedHome, managedAiCredentialIdentity: "revision",
|
||||
managedAiAccountIdentity: "account",
|
||||
...(method === "sign_in" ? { managedAiCredentialWriteback: { grantId: "10000000-0000-4000-8000-0000000000a1",
|
||||
secretId: "10000000-0000-4000-8000-0000000000a2", sessionEpoch: 1, versionSelector: "latest" as const,
|
||||
google: { credentialSha256: "c".repeat(64) } } } : {}),
|
||||
runnerEnvironment: { ...(method === "api_key" ? { GEMINI_API_KEY: "fixture-gemini" } : {}),
|
||||
GOOGLE_API_KEY: "ambient-google", GEMINI_HOME: "/ambient" },
|
||||
runnerExecutionTarget: pluginTarget() });
|
||||
await backend.options!.codexTransportFactory!();
|
||||
expect(ownerFactory).toHaveBeenCalledOnce();
|
||||
expect(ownerFactory).toHaveBeenCalledWith(expect.objectContaining({ credential: { type: "provider-env", provider: "antigravity",
|
||||
environment: method === "api_key" ? { GEMINI_API_KEY: "fixture-gemini" } : { PAPERCLIP_ACPX_ANTIGRAVITY_AUTH_JSON_SECRET: signIn } } }));
|
||||
expect(handoff).toHaveBeenCalledTimes(method === "sign_in" ? 1 : 0);
|
||||
} finally {
|
||||
handoff.mockRestore();
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { Db } from "@paperclipai/db";
|
||||
import { QUALIFIED_ACPX_PROFILES, type NativeExecutionInput } from "../../vendor/paperclip-runner/index.js";
|
||||
import { buildNativeExecutionInput } from "./native-execution-input.js";
|
||||
import { nativeRuntimeContextFixture } from "./runtime-context.test-fixture.js";
|
||||
|
||||
export const ANTIGRAVITY_FIXTURE_COMPANY_ID = "10000000-0000-4000-8000-000000000001";
|
||||
export const ANTIGRAVITY_FIXTURE_MODEL = "gemini-3.8-flash-low";
|
||||
|
||||
export function emptyDb(): Db {
|
||||
const db: Db = new Proxy(() => undefined, {
|
||||
get: (_target, key) => key === "then" ? (resolve: (rows: unknown[]) => unknown) => resolve([])
|
||||
: key === "transaction" ? async (operation: (tx: Db) => unknown) => operation(db)
|
||||
: () => db,
|
||||
apply: () => db,
|
||||
}) as unknown as Db;
|
||||
return db;
|
||||
}
|
||||
|
||||
export function antigravityExecution(input: { runId?: string; issueId?: string; workspaceId?: string; sessionId?: string } = {}) {
|
||||
const runId = input.runId ?? "40000000-0000-4000-8000-000000000004";
|
||||
const execution = buildNativeExecutionInput({
|
||||
companyId: ANTIGRAVITY_FIXTURE_COMPANY_ID, runId, agentId: "30000000-0000-4000-8000-000000000003",
|
||||
issue: { id: input.issueId ?? "20000000-0000-4000-8000-000000000002", identifier: "AG-1", title: "Test", description: null, workMode: "standard" },
|
||||
taskPrompt: "Only the current turn",
|
||||
workspace: { id: input.workspaceId ?? "90000000-0000-4000-8000-000000000009", cwd: "/workspace", repoUrl: null, repoRef: null, branchName: null },
|
||||
normalizedSessionId: input.sessionId ?? "60000000-0000-4000-8000-000000000006",
|
||||
provider: "acpx", acpxAgent: "antigravity", model: ANTIGRAVITY_FIXTURE_MODEL, acpxPermissionMode: "approve-all",
|
||||
completionContract: { id: "70000000-0000-4000-8000-000000000007", sha256: `sha256:${"a".repeat(64)}`, schemaVersion: "paperclip.run-result.v1",
|
||||
contract: { revision: "1", objective: "Test", criteria: [{ id: "objective", requirement: "Answer" }] } },
|
||||
runtimeContext: nativeRuntimeContextFixture(),
|
||||
}) as NativeExecutionInput;
|
||||
(execution.provider as { profile: { agentProfileVersion: number } }).profile.agentProfileVersion =
|
||||
QUALIFIED_ACPX_PROFILES.antigravity.agentProfileVersion;
|
||||
return execution;
|
||||
}
|
||||
Reference in new issue
Block a user