fix(errors): stop recommending retries for non-retryable failures (#1869)

* fix(errors): stop recommending retries for non-retryable failures

Unreadable output and provider adapter failures project retryable=false,
but their standard message and remediation said "Retry once", so a
firmware run whose expected report was never published told callers to
repeat a non-retryable operation. Point those failures at `rea doctor`
and the reported details instead, leaving retryability decided once by
the projected error code.

Fixes #1855

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(errors): align Hopper remote failure guidance with retryability

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-11 23:17:35 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 96547d373f
commit fb94d9dde0
5 changed files with 44 additions and 12 deletions
+3 -3
View File
@@ -66,7 +66,7 @@ export const analysisErrorRemediationAction = (
if (error instanceof HopperRemoteError)
return error.diagnosticType === "invalid_request"
? "Correct the reported address, document, or arguments and retry."
: "Review the Hopper diagnostic details; correct the request or retry if the failure was transient.";
: "Review the Hopper diagnostic details and correct the request or target; run `rea doctor` if the provider itself is failing. Repeating the unchanged request is not expected to succeed.";
if (error instanceof EvidenceReferenceError)
return "Use an exact Evidence reference retained by this session, supply the complete inline Evidence, re-run its producer, or import its Evidence bundle. close_binary clears retained records.";
if (
@@ -282,7 +282,7 @@ const hopperProcessMessage = (error: HopperProcessError): string => {
const standardErrorMessage = (tag: AnalysisErrorTag): string | undefined => {
if (UNREADABLE_OUTPUT_TAGS.has(tag))
return "Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.";
return "Analysis returned an unreadable result. Run `rea doctor` and review the reported details; repeating the unchanged request is not expected to succeed.";
if (UNSUPPORTED_PROVIDER_TAGS.has(tag))
return "This analysis is unavailable for the current target. Choose another analysis or target.";
if (CANCELLED_TAGS.has(tag))
@@ -290,7 +290,7 @@ const standardErrorMessage = (tag: AnalysisErrorTag): string | undefined => {
if (TIMEOUT_TAGS.has(tag))
return "Analysis took too long. Try a smaller request, then run `rea doctor` if it continues.";
if (ADAPTER_FAILURE_TAGS.has(tag))
return "Analysis could not complete. Retry once; if it continues, run `rea doctor`.";
return "Analysis could not complete. Run `rea doctor` and review the reported details; repeating the unchanged request is not expected to succeed.";
if (START_FAILURE_TAGS.has(tag))
return "Analysis could not start or stopped unexpectedly. Run `rea doctor`, then try again.";
return undefined;
@@ -384,6 +384,38 @@ describe("analysis error projection: provider failures", () => {
});
});
describe("analysis error projection: retry guidance", () => {
it.each([
[
"unreadable output",
new AnalysisOutputError("inspect_firmware_regions", "report missing"),
"unreadable_output",
],
[
"adapter failure",
new ProviderAdapterError("firmware", "inspect_firmware_regions"),
"execution_failure",
],
[
"Hopper remote failure",
new HopperRemoteError(7, "Hopper analysis failed", {
diagnosticType: "bridge_exception",
operation: "trace_feature",
}),
"execution_failure",
],
])(
"does not recommend an unchanged retry for non-retryable %s",
(_name, error, code) => {
const projected = projectAnalysisError(error);
expect(projected).toMatchObject({ code, retryable: false });
for (const text of [projected.message, projected.remediation.action])
expect(text).not.toMatch(/\bretry\b/iu);
},
);
});
describe("analysis error projection: caller contract", () => {
it("preserves the reported output constraint without exposing its internal cause", () => {
const projected = projectAnalysisError(