fix(mcp): escalate transient failures before asking for a restart (#6353)

* fix(mcp): escalate transient failures before asking for a restart

Give dropped connections and startup failures one bounded retry, then a
scripted handoff to the user. Point timeout recovery at a named request
field or REA_* setting instead of telling agents those limits are fixed.

Co-authored-by: morluto <[email protected]>

* fix(process): stop unexpected command failures from recommending a retry

The catch can already have launched the target, and the projection stays
non-retryable. Tell the user to check the inputs and run doctor instead.

Co-authored-by: morluto <[email protected]>

* fix(mcp): limit retries to safe calls and recommended settings

A dropped connection may already have changed the target, and a bad
catalog rejects the same startup every time. Retry only a repeatable
call, and change a setting only when the remediation recommends it.

Co-authored-by: morluto <[email protected]>

* test(mcp): match recovery guidance across wrapped lines

Startup handoff capitalization and markdown wrapping still carry the
same sentences. Compare the prose with whitespace collapsed.

Co-authored-by: morluto <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: morluto <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-23 01:32:22 +08:00
1 parent e28c11f87d
commit 791f6328b0
15 files changed
+233 -44

No files matched your search

+8
View File
@@ -265,6 +265,13 @@ const cliAnalysisError = (error: AnalysisError): ProcessCliErrorOutput => ({
...projectAnalysisError(error),
});
/**
* This catch includes target execution, and the projection stays non-retryable.
* Tell the user what happened; do not ask them to run the command again.
*/
export const PROCESS_UNEXPECTED_FAILURE_REMEDIATION =
"Do not repeat this command. Tell the user the process command could not complete and ask them to check the input files, then run `rea doctor`.";
/** Preserve typed failures and local diagnostics at the process CLI boundary. */
export const projectProcessCliError = (
cause: unknown,
@@ -276,6 +283,7 @@ export const projectProcessCliError = (
cause,
diagnostics: { phase: "process_cli" },
userMessage: `Process command could not complete: ${describeValidationFailure(cause)}`,
remediationAction: PROCESS_UNEXPECTED_FAILURE_REMEDIATION,
}),
);
};