Keep Copilot installer contracts complete in the runtime partition

Include the server lifecycle shim with its package tests. Retain extended native-session coverage in the following regression partition so each review stays below 100 files.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-08 07:44:11 -05:00
1 parent e199b349f6
commit 7075a573bd
2 files changed
+22 -19

No files matched your search

@@ -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);
+18
View File
@@ -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`);