Files
PaperClipAI/server/src/services/environment-sync-out-error.ts
T
Devin FoleyandPaperclip 465140596f Preserve bounded workspace sync diagnostics across RPC (#15481)
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>
2026-10-07 12:22:53 -07:00

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;
}