diff --git a/packages/paperclip-runner/src/native-session-runtime.test.ts b/packages/paperclip-runner/src/native-session-runtime.test.ts index c1d226f3d9..610813ef9c 100644 --- a/packages/paperclip-runner/src/native-session-runtime.test.ts +++ b/packages/paperclip-runner/src/native-session-runtime.test.ts @@ -1,5 +1,4 @@ import { createHash } from "node:crypto"; -import { resolveQualifiedAcpxProfile } from "./drivers/acpx/qualified-profiles.js"; import { describe, expect, it, vi } from "vitest"; import type { ControlPlanePort } from "./contracts/control-plane-port.js"; @@ -5005,19 +5004,7 @@ describe("executeNativeSession recovery", () => { expect(attachRun).not.toHaveBeenCalled(); }); - it.each(["codex", "copilot"] as const)("quarantines a retained %s session when attachment partially mutates then fails", async (provider) => { - const qualified = resolveQualifiedAcpxProfile("copilot", "selected-model"); - const executionInput: NativeExecutionInputV1 = provider === "copilot" ? { - ...input, - session: { ...input.session, driverKind: "acpx_runtime" }, - provider: { kind: "acpx", agent: "copilot", model: "selected-model", permissionPolicy: "interactive", profile: { - driverKind: qualified.driverKind, protocolVersion: qualified.protocolVersion, acpxVersion: qualified.acpxVersion, - agent: qualified.agent, agentProfileVersion: qualified.agentProfileVersion, - agentServerPackage: qualified.agentServerPackage, agentServerVersion: qualified.agentServerVersion, - agentRuntimePackage: qualified.agentRuntimePackage, agentRuntimeVersion: qualified.agentRuntimeVersion, - commandDigest: qualified.commandDigest, - } }, - } : input; + it("quarantines a retained session when attachment partially mutates then fails", async () => { const attachmentFailure = new Error("provider attachment failed"); const openRun = vi.fn(async () => undefined); let retainedIdentity = { ...identity, runId: "run-previous" }; @@ -5054,7 +5041,7 @@ describe("executeNativeSession recovery", () => { async descriptor() { return { kind: "mock", - name: `attachment-failure-backend-${provider}`, + name: "attachment-failure-backend", version: "1", capabilities: { resume: true, @@ -5082,7 +5069,7 @@ describe("executeNativeSession recovery", () => { await expect( executeNativeSession({ - input: executionInput, + input, backend, controlPlane: port, runnerInstanceId: "runner-recovery", @@ -5091,9 +5078,7 @@ describe("executeNativeSession recovery", () => { onSession, }), ).rejects.toBe(attachmentFailure); - expect(attachRun).toHaveBeenCalledWith(provider === "copilot" - ? { identity, currentRunGrant: { runtimeContext: null, instructions: expect.any(String) } } - : { identity }); + expect(attachRun).toHaveBeenCalledWith({ identity }); expect(retainedIdentity).toEqual(identity); expect(onSession).toHaveBeenCalledOnce(); expect(onSession).toHaveBeenCalledWith(null); diff --git a/server/scripts/install-copilot-assets.mjs b/server/scripts/install-copilot-assets.mjs new file mode 100644 index 0000000000..9960da267c --- /dev/null +++ b/server/scripts/install-copilot-assets.mjs @@ -0,0 +1,18 @@ +import { access } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; + +const installer = new URL("../dist/install-copilot-assets.mjs", import.meta.url); +try { + await access(fileURLToPath(installer)); +} catch (error) { + if (error.code !== "ENOENT") throw error; + // Dependencies install before compilation in a source workspace. Published + // server packages omit src and cannot take this bootstrap exception. + await access(fileURLToPath(new URL("../src/services/copilot-connection-probe.ts", import.meta.url))); + await access(fileURLToPath(new URL("../../pnpm-workspace.yaml", import.meta.url))); + process.stdout.write("Copilot runtime assets: source-workspace-pending-build\n"); + process.exit(0); +} +const { installCopilotAssets } = await import(installer.href); +const result = await installCopilotAssets(); +process.stdout.write(`Copilot runtime assets: ${result.status} (${result.target})\n`);