mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-24 01:41:42 +02:00
Read native plugin task output files on the execution host (#17285)
This commit is contained in:
1 parent
d69631b01b
commit
412914cfa7
15 files changed
+202
-24
No files matched your search
@@ -11074,10 +11074,12 @@ describe("runnerd provider runtime wiring", () => {
|
||||
const launcher = vi.fn();
|
||||
const registration = vi.fn();
|
||||
const driver = { prepareLaunch: vi.fn(), runnerProcessLauncher: launcher, controlPlaneRegistration: registration };
|
||||
const owner = vi.spyOn(pluginTaskRuntime, "createPluginRunnerTaskOwner").mockReturnValue({ launcher, registration, driver });
|
||||
state.toolAuthorityDefinitions.mockImplementation(async binding => binding.readRemoteTaskFile ? [{ name: "register_deliverable" }] as never : []);
|
||||
const readWorkspaceFile = vi.fn(async () => Buffer.from("proof"));
|
||||
const owner = vi.spyOn(pluginTaskRuntime, "createPluginRunnerTaskOwner").mockReturnValue({ launcher, registration, driver, readWorkspaceFile });
|
||||
const task = vi.fn(async (operation: unknown) => {
|
||||
environmentTaskOperationSchema.parse(operation);
|
||||
return { kind: "description", launchPreparationVersion: 1, projectAuthCheckVersion: 1, taskId: "task", runner: { version: "fixture", digest: `sha256:${"a".repeat(64)}` } };
|
||||
return { kind: "description", launchPreparationVersion: 1, projectAuthCheckVersion: 1, ...(kind === "codex" ? { workspaceFileReadVersion: 1 } : {}), taskId: "task", runner: { version: "fixture", digest: `sha256:${"a".repeat(64)}` } };
|
||||
});
|
||||
const target = { kind: "remote", transport: "sandbox", providerKey: "plugin", leaseId: "plugin-task-lease",
|
||||
remoteCwd: "/unused", runnerTask: task, runnerTaskProjectIds: ["10000000-0000-4000-8000-000000000001"] } as const;
|
||||
@@ -11098,6 +11100,9 @@ describe("runnerd provider runtime wiring", () => {
|
||||
expect(state.createBackend.mock.calls.at(-1)![1]).toMatchObject({ workingDirectoryAuthority: "runner_prepared_launch", environment: {} });
|
||||
state.createBackend.mock.calls.at(-1)![1].codexTransportFactory!();
|
||||
const options = state.createTransport.mock.calls.at(-1)![0];
|
||||
const expectedTools = kind === "codex" ? [{ name: "register_deliverable" }] : [];
|
||||
expect(state.createBackend.mock.calls.at(-1)![1]).toMatchObject({ dynamicTools: expectedTools });
|
||||
expect(options).toMatchObject({ resumeDynamicTools: expectedTools });
|
||||
expect(options).toMatchObject({ ...driver, runnerArtifact: { version: "fixture" },
|
||||
prpIdentity: { environmentLeaseId: "plugin-task-lease" } });
|
||||
if (kind === "acpx") expect(options).toMatchObject({ acpxAgent: "claude", claudeEffort: "high" });
|
||||
@@ -11105,6 +11110,18 @@ describe("runnerd provider runtime wiring", () => {
|
||||
expect(options).not.toHaveProperty(key);
|
||||
}
|
||||
expect(task.mock.calls).toEqual([[{ kind: "describe" }]]);
|
||||
const binding = state.toolAuthorityDefinitions.mock.calls.at(-1)![0] as unknown as {
|
||||
readRemoteApiFile?: (path: string, maxBytes: number) => Promise<Buffer>;
|
||||
readRemoteTaskFile?: (file: {contentRef: string;byteSize: number;sha256: string}) => Promise<Buffer>;
|
||||
};
|
||||
if (kind === "codex") {
|
||||
await expect(binding.readRemoteApiFile!("proof.txt",1024)).resolves.toEqual(Buffer.from("proof"));
|
||||
await expect(binding.readRemoteTaskFile!({contentRef:"proof.txt",byteSize:5,sha256:"a".repeat(64)})).resolves.toEqual(Buffer.from("proof"));
|
||||
expect(readWorkspaceFile).toHaveBeenCalledWith("proof.txt",5);
|
||||
} else {
|
||||
expect(binding.readRemoteApiFile).toBeUndefined();
|
||||
expect(binding.readRemoteTaskFile).toBeUndefined();
|
||||
}
|
||||
expect(owner.mock.calls.at(-1)![0]).not.toHaveProperty("assets");
|
||||
const identity: Record<string, unknown> = options.prpIdentity!;
|
||||
await owner.mock.calls.at(-1)![0].onSessionRetained!({ schema: "paperclip.runner.durable.state.v1", lifecycle: "suspended", ...identity });
|
||||
|
||||
Reference in new issue
Block a user