fix(mcp): report HTTP listener recovery from its parsed failure

rea mcp --http printed "Choose another --port or stop the process using
it" for every listener failure except a missing host allowlist, so a host
lookup failure, an unassigned address or a permission denial got port
advice. StreamableHttpListenError already classifies the native failure
and owns a recovery for each kind.

Startup now always prints that owned recovery behind one shared lead-in,
and the fixed message is removed. The native cause text stays out of
stderr as before.

Fixes #7346

Co-Authored-By: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gensokyo-devandClaude Opus 5.5 authored and Ysopwnable committed 2026-11-14 04:57:03 +01:00
1 parent e1d229cd6b
commit 809f0d69db
3 files changed
+42 -10

No files matched your search

+3 -2
View File
@@ -10,5 +10,6 @@ export const MCP_SHUTDOWN_FAILED =
"REA could not close cleanly. End the REA process before starting it again.";
export const SERVER_START_FAILED =
"Do not repeat this startup. Tell the user REA could not start and ask them to restart the MCP client, then run `rea doctor`.";
export const MCP_HTTP_LISTEN_FAILED =
"REA could not listen for MCP HTTP connections on the selected host and port. Choose another --port or stop the process using it.";
/** The listener error owns recovery for its parsed failure; never its native cause text. */
export const mcpHttpListenFailed = (remediation: string): string =>
`REA could not listen for MCP HTTP connections. ${remediation}`;
+2 -5
View File
@@ -12,7 +12,7 @@ import type { OptionalProviderLoadResult } from "../application/OptionalObservat
import { OwnedMcpServers } from "./OwnedMcpServers.js";
import {
MCP_CONNECTION_START_FAILED,
MCP_HTTP_LISTEN_FAILED,
mcpHttpListenFailed,
} from "./messages.js";
import { reportMcpTransportError } from "./reportMcpTransportError.js";
@@ -181,10 +181,7 @@ export const startMcpTransport = async (
if (!cancelled) {
const startFailure =
cause instanceof StreamableHttpListenError
? cause.classification.ok &&
cause.classification.value.kind === "host_allowlist"
? cause.remediationAction
: MCP_HTTP_LISTEN_FAILED
? mcpHttpListenFailed(cause.remediationAction)
: MCP_CONNECTION_START_FAILED;
serverLogger.error(
{