fix(process): preserve observations after successful cleanup

This commit is contained in:
morluto
2026-10-08 23:29:43 +08:00
parent 5e1afe454f
commit 2af12a18a3
5 changed files with 252 additions and 59 deletions
+21 -10
View File
@@ -393,16 +393,27 @@ const lifecycleErrorDetails = (
),
}),
};
if (
error._tag === "ProcessCaptureError" &&
error.userCategory === "cancelled"
)
return { operation: "process_capture", cleanup: "complete" };
if (
error._tag === "ProcessCaptureError" &&
error.executionFailure !== undefined
)
return { execution_failure: error.executionFailure };
if (error._tag === "ProcessCaptureError") {
const details = {
...(error.userCategory === "cancelled"
? { operation: "process_capture", cleanup: "complete" }
: {}),
...(error.cleanupReport === undefined
? {}
: { cleanup_report: jsonValueSchema.parse(error.cleanupReport) }),
...(error.executionFailure === undefined
? {}
: { execution_failure: error.executionFailure }),
...(error.partialObservation === undefined
? {}
: {
partial_observation: jsonValueSchema.parse(
error.partialObservation,
),
}),
};
return Object.keys(details).length === 0 ? undefined : details;
}
if (error instanceof BinaryTargetError)
return {
path: error.path,