Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(domain): preserve retryable capability failures through redaction (#2494)

吴佳浩Albend73ed6fce24f
diff --git a/src/domain/explicitSensitiveFailure.test.ts b/src/domain/explicitSensitiveFailure.test.ts
index 68aaf9f8f..757e9887a 100644
--- a/src/domain/explicitSensitiveFailure.test.ts
+++ b/src/domain/explicitSensitiveFailure.test.ts
@@ -116,6 +116,24 @@ it("keeps unsupported profile reasons distinct from malformed input", () => {
expect(JSON.stringify(projectAnalysisError(result))).not.toContain("private");
});
+it("preserves a retryable capability failure through explicit-value redaction", () => {
+ // Retryability is a semantic field of the error, not presentation: dropping
+ // it turns a transient admission failure into a permanent one and changes
+ // the remediation the caller is shown.
+ const error = new AnalysisCapabilityUnavailableError(
+ "mitmproxy",
+ "inspect_web_network_capture",
+ "Runtime admission for /targets/private/capture failed transiently",
+ { retryable: true },
+ );
+ expect(projectAnalysisError(error).retryable).toBe(true);
+ const result = redactExplicitFailure(error, ["private"]);
+ expect(result).toBeInstanceOf(AnalysisCapabilityUnavailableError);
+ expect((result as AnalysisCapabilityUnavailableError).retryable).toBe(true);
+ expect(projectAnalysisError(result).retryable).toBe(true);
+ expect(JSON.stringify(projectAnalysisError(result))).not.toContain("private");
+});
+
it("coarsens format issue pointers without creating replacement coordinates", () => {
const error = new AnalysisInputError(
"inspect_web_network_capture",
diff --git a/src/domain/explicitSensitiveFailure.ts b/src/domain/explicitSensitiveFailure.ts
index 05a4f2f88..8a0fac095 100644
--- a/src/domain/explicitSensitiveFailure.ts
+++ b/src/domain/explicitSensitiveFailure.ts
@@ -154,6 +154,7 @@ export const redactExplicitFailure = (
...(error.userMessage === undefined
? {}
: { userMessage: text(error.userMessage) }),
+ ...(error.retryable ? { retryable: true } : {}),
},
);
if (error instanceof AnalysisResourceConstraintError)