diff --git a/server/src/__tests__/adapter-registry.test.ts b/server/src/__tests__/adapter-registry.test.ts index 1da4fcdc4d4..8b3df5c6859 100644 --- a/server/src/__tests__/adapter-registry.test.ts +++ b/server/src/__tests__/adapter-registry.test.ts @@ -17,7 +17,10 @@ import { setOverridePaused, } from "../adapters/registry.js"; -vi.mock("@paperclipai/paperclip-runner/live", () => ({ probeAcpxClaudeInstallation: vi.fn(async () => undefined) })); +vi.mock("@paperclipai/paperclip-runner/live", () => ({ + probeAcpxClaudeInstallation: vi.fn(async () => undefined), + probeAcpxGrokInstallation: vi.fn(async () => undefined), +})); const externalAdapter: ServerAdapterModule = { type: "external_test", diff --git a/server/src/adapters/registry.test.ts b/server/src/adapters/registry.test.ts index 4f078588fc3..ddd655de7f5 100644 --- a/server/src/adapters/registry.test.ts +++ b/server/src/adapters/registry.test.ts @@ -4,8 +4,14 @@ import { listServerAdapters, requireServerAdapter } from "./registry.js"; import * as executionTarget from "@paperclipai/adapter-utils/execution-target"; import { BUILTIN_ADAPTER_TYPES } from "./builtin-adapter-types.js"; -const { probeInstallation } = vi.hoisted(() => ({ probeInstallation: vi.fn() })); -vi.mock("@paperclipai/paperclip-runner/live", () => ({ probeAcpxClaudeInstallation: probeInstallation })); +const { probeInstallation, probeGrokInstallation } = vi.hoisted(() => ({ + probeInstallation: vi.fn(), + probeGrokInstallation: vi.fn(), +})); +vi.mock("@paperclipai/paperclip-runner/live", () => ({ + probeAcpxClaudeInstallation: probeInstallation, + probeAcpxGrokInstallation: probeGrokInstallation, +})); // The registry registers a login capability for the two built-in interactive // adapters. The test checks the scalar values and the presence of the required @@ -86,7 +92,10 @@ describe("built-in runtime connection tool delivery", () => { describe("native ACPX environment checks", () => { - beforeEach(() => { probeInstallation.mockReset().mockResolvedValue(undefined); }); + beforeEach(() => { + probeInstallation.mockReset().mockResolvedValue(undefined); + probeGrokInstallation.mockReset().mockResolvedValue(undefined); + }); afterEach(() => vi.restoreAllMocks()); const context = { @@ -111,6 +120,17 @@ describe("native ACPX environment checks", () => { expect(probeInstallation).toHaveBeenCalledWith(context.config.model); }); + it.each([true, false])("checks Grok's own installation readiness (%s)", async (ready) => { + if (!ready) probeGrokInstallation.mockRejectedValueOnce(new Error("Grok executable digest mismatch")); + const result = await requireServerAdapter("paperclip_runner").testEnvironment!({ + ...context, + config: { provider: "acpx", acpxAgent: "grok", model: "grok-4.7" }, + }); + expect(result.status).toBe(ready ? "pass" : "fail"); + expect(probeGrokInstallation).toHaveBeenCalledWith("grok-4.7"); + expect(probeInstallation).not.toHaveBeenCalled(); + }); + it("does not use the host platform to reject a remote environment", async () => { vi.spyOn(process, "platform", "get").mockReturnValue("darwin"); const result = await requireServerAdapter("paperclip_runner").testEnvironment!({ diff --git a/tests/runner-e2e/history.test.ts b/tests/runner-e2e/history.test.ts index e44cb00ff36..a1c6c719014 100644 --- a/tests/runner-e2e/history.test.ts +++ b/tests/runner-e2e/history.test.ts @@ -115,6 +115,9 @@ describe("runner E2E campaign history", () => { }); it("records the resolved paid target instead of the trusted workflow checkout", () => { + vi.stubEnv("GITHUB_SERVER_URL", ""); + vi.stubEnv("GITHUB_REPOSITORY", ""); + vi.stubEnv("GITHUB_RUN_ID", ""); vi.stubEnv("PAPERCLIP_RUNNER_E2E_SOURCE_SHA", "target-sha"); vi.stubEnv("PAPERCLIP_RUNNER_E2E_SOURCE_REF", "refs/heads/target"); vi.stubEnv("GITHUB_SHA", "trusted-master-sha");