{"record":{"id":"bcd30b6f7405c913","repo":"earendil-works/pi","slug":"agent-cleanup-failed","errorCode":null,"errorMessage":"Agent cleanup failed.","messagePattern":"Agent cleanup failed\\.","errorType":"exception","errorClass":"AggregateError","httpStatus":null,"severity":"error","filePath":"packages/evals/src/pi-harness.ts","lineNumber":239,"sourceCode":"\t\t}\n\t}\n\ttry {\n\t\tsession?.dispose();\n\t} catch (error) {\n\t\tcleanupErrors.push(error);\n\t}\n\ttry {\n\t\tawait rm(root, { recursive: true, force: true });\n\t} catch (error) {\n\t\tcleanupErrors.push(error);\n\t}\n\n\tif (!outcome.success) {\n\t\tif (cleanupErrors.length === 0) throw outcome.error;\n\t\tthrow new AggregateError([outcome.error, ...cleanupErrors], \"Agent run failed and cleanup also failed.\");\n\t}\n\tif (cleanupErrors.length === 1) throw cleanupErrors[0];\n\tif (cleanupErrors.length > 1) throw new AggregateError(cleanupErrors, \"Agent cleanup failed.\");\n\treturn {\n\t\t...outcome.result,\n\t\ttimings: { totalMs: performance.now() - startedAt },\n\t};\n}\n\nexport function createPiCodingAgentHarness<TOutput extends JsonValue>(\n\toptions: PiCodingAgentHarnessWithOutput<TOutput>,\n): Harness<PiCodingAgentInput, TOutput>;\nexport function createPiCodingAgentHarness(options?: PiCodingAgentHarnessOptions): Harness<PiCodingAgentInput, string>;\nexport function createPiCodingAgentHarness<TOutput extends JsonValue>(\n\toptions: PiCodingAgentHarnessOptions | PiCodingAgentHarnessWithOutput<TOutput> = {},\n) {\n\treturn createHarness<PiCodingAgentInput, string | TOutput>({\n\t\tname: options.name ?? \"pi-coding-agent\",\n\t\trun: ({ input, signal, setArtifact }) => runPiCodingAgent(input, signal, setArtifact, options),\n\t});\n}","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/evals/src/pi-harness.ts#L221-L257","documentation":"Error \"Agent cleanup failed.\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/evals/src/pi-harness.ts:239 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}