fix(errors): report caller-selected evidence path failures as invalid input

An EvidenceFileError for a missing evidence file, a selected path that is
not a regular file, or an output that already exists projected code and
category execution_failure. The message already told the caller to
correct the path, but agents branching on code or category saw a tool
failure.

Project those three reasons as invalid_request with category
invalid_input. An unreadable file (io) and invalid JSON keep their
codes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-09 09:23:00 +00:00
co-authored by Claude Opus 5.5
parent f4c99ab8a5
commit db177c91b8
3 changed files with 43 additions and 5 deletions
+6 -4
View File
@@ -144,10 +144,12 @@ const artifactOperationCode = (
const evidenceFileCode = (
reason: EvidenceFileError["reason"],
): AnalysisErrorProjection["code"] =>
reason === "invalid-json"
? "evidence_integrity_mismatch"
: "execution_failure";
): AnalysisErrorProjection["code"] => {
if (reason === "invalid-json") return "evidence_integrity_mismatch";
// A missing, non-file or already-existing path is the caller's selection.
if (reason === "io") return "execution_failure";
return "invalid_request";
};
const unknownRegistryCode = (
reason: UnknownRegistryError["reason"],