mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 00:05:49 +02:00
Preserve bounded error codes and HTTP/exit statuses across the environmentSyncOut worker RPC boundary, and revalidate that method-scoped envelope before attaching host restore diagnostics. Keep the original error and all recovery policy unchanged; do not transmit provider payloads or credentials. Verified real RPC roundtrip and privacy regressions, 95 focused tests, 68 independent tests, full typecheck/build and all exact-head CI. Greptile 5/5 with no unresolved comments. Co-Authored-By: Paperclip <noreply@paperclip.ing>
16 lines
687 B
TypeScript
16 lines
687 B
TypeScript
import { readEnvironmentSyncErrorDiagnostic } from "@paperclipai/plugin-sdk";
|
|
import { preserveWorkspaceRestoreErrorDiagnostic } from "@paperclipai/adapter-utils/workspace-restore-diagnostics";
|
|
|
|
/** Keep the original RPC failure and policy fields; add only private diagnostic evidence. */
|
|
export function preserveEnvironmentSyncOutErrorDiagnostic(error: unknown): unknown {
|
|
const diagnostic = readEnvironmentSyncErrorDiagnostic(error);
|
|
if (diagnostic && error && typeof error === "object") {
|
|
preserveWorkspaceRestoreErrorDiagnostic(error, {
|
|
code: diagnostic.errorCode,
|
|
status: diagnostic.httpStatus,
|
|
exitCode: diagnostic.exitCode,
|
|
});
|
|
}
|
|
return error;
|
|
}
|