Restore cause on WorkflowInspectionError per service error conventions

Real filesystem failures (read-failed / not-found wraps) forward their
underlying error as an optional cause, matching the GitCommandError
convention; pure validation reasons stay cause-less. The paths a cause
can carry are ones the client supplied in the request, so this does not
reintroduce the earlier information-exposure concern.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Theo BrowneandClaude Fable 5 committed 2026-07-02 05:17:33 -07:00
1 parent 0eaeb94564
commit cb5a39a68c
2 files changed
+8

No files matched your search

@@ -116,6 +116,7 @@ export const make = (options?: { readonly projectsRoot?: string }) =>
operation,
reason: isEnoent(cause) ? "not-found" : "read-failed",
detail: "Failed to resolve the workflow projects root.",
cause,
}),
});
@@ -126,6 +127,7 @@ export const make = (options?: { readonly projectsRoot?: string }) =>
operation,
reason: isEnoent(cause) ? "not-found" : "read-failed",
detail: "Failed to resolve the requested path.",
cause,
}),
});
@@ -160,6 +162,7 @@ export const make = (options?: { readonly projectsRoot?: string }) =>
operation,
reason: isNotFoundPlatformError(cause) ? "not-found" : "read-failed",
detail: "Failed to read the workflow script.",
cause,
}),
),
);
@@ -189,6 +192,7 @@ export const make = (options?: { readonly projectsRoot?: string }) =>
operation,
reason: isNotFoundPlatformError(cause) ? "not-found" : "read-failed",
detail: "Failed to read the workflow journal.",
cause,
}),
),
);
@@ -275,6 +279,7 @@ export const make = (options?: { readonly projectsRoot?: string }) =>
operation,
reason: isNotFoundPlatformError(cause) ? "not-found" : "read-failed",
detail: "Failed to read the agent transcript.",
cause,
}),
),
);
+3
View File
@@ -96,6 +96,9 @@ export class WorkflowInspectionError extends Schema.TaggedErrorClass<WorkflowIns
operation: Schema.String,
reason: Schema.Literals(["invalid-path", "not-found", "read-failed", "unsupported"]),
detail: Schema.String,
/** Underlying failure for read-failed/not-found wraps; absent for pure
* validation reasons. Matches the GitCommandError convention. */
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {