[PR #7367] fix(mcp): preserve HTTP listener recovery guidance #7836

Open
opened 2026-11-05 01:48:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7367
Author: @wellkilo
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: fix/7346-mcp-host-lookup-remediation


📝 Commits (1)

  • 2cfd6a9 fix(mcp): preserve HTTP listener recovery guidance

📊 Changes

2 files changed (+44 additions, -2 deletions)

View changed files

📝 src/main/transport.ts (+1 -2)
📝 tests/boundary/mcp/mainErrors.test.ts (+43 -0)

📄 Description

Summary

Fixes #7346.

The MCP HTTP startup path now uses the recovery supplied by the shared listener
failure classifier for every classified error. A host lookup failure therefore
directs callers to --host / MCP_HOST instead of incorrectly suggesting a port
change. Unclassified listener failures retain the existing generic recovery.

Problem and expected behavior

StreamableHttpListenError already classifies EAI_NONAME as host_lookup and
produces host-specific remediation. startMcpTransport replaced that parsed fact
with generic port advice except for the host allowlist case. Changing the port
cannot resolve a failed host lookup.

The startup path should preserve the classifier's remediation for every classified
failure, while keeping generic recovery for an unclassified native listener error.

Change and scope

The transport consumer now uses cause.remediationAction whenever the listener
failure classification succeeds. Regression coverage checks both the reported
host lookup failure and the EADDRINUSE control so port-in-use recovery remains
available.

This is an ordinary diagnostic correction within the existing MCP HTTP contract.
It does not change listener classification, startup failure status, schemas, or
provider behavior.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/server/http/streamableHttpListenError.ts
    remains the owner of listener classification and recovery; the MCP startup
    projection in src/main/transport.ts now consumes that result without replacing it.
  • Contribution scope fit and linked maintainer decision: ordinary existing-boundary
    diagnostic fix; additional maintainer scope decision not applicable.
  • CLI and MCP/tool-catalog contract: rea mcp --http stderr recovery text changes
    for classified listener failures. No tool-catalog or JSON schema change.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/mainErrors.test.ts covers
    EAI_NONAME host lookup recovery and an EADDRINUSE control. The existing
    host-allowlist and unclassified-listener controls remain in place.

  • Base reproduction or other evidence: the linked issue observed the affected base
    revision through a deterministic injected EAI_NONAME listener failure and an
    EADDRINUSE control.

  • User-visible CLI/MCP output: with Server.prototype.listen replaced by the
    deterministic fixture, the fixed public CLI reports:

    • EAI_NONAME: Check --host or MCP_HOST and host name resolution; correct the value or resolve the lookup failure, then retry.
    • EADDRINUSE: Choose another --port or MCP_PORT, or stop the process using it.
  • Remaining proof gaps: a naturally failing host resolver was not exercised. The
    deterministic fixture intercepts Server.listen, so natural DNS timing and
    platform-specific resolver behavior remain unverified.

Evidence-bearing checklist: not applicable; this change does not produce or alter
analysis Evidence.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/mainErrors.test.ts — 1 file passed, 11 tests passed.
  • npm run check:fast — typecheck and lint passed.
  • npm run format:check — all matched files use the correct format.
  • Public CLI with injected EAI_NONAME — exited 1 and emitted host-specific recovery.
  • Public CLI with injected EADDRINUSE — exited 1 and retained port-specific recovery.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none; listener startup still
    fails closed and this patch changes only recovery text selection.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7367 **Author:** [@wellkilo](https://github.com/wellkilo) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7346-mcp-host-lookup-remediation` --- ### 📝 Commits (1) - [`2cfd6a9`](https://github.com/morluto/rea/commit/2cfd6a905910694233f5a99ded46e7ace9cbe595) fix(mcp): preserve HTTP listener recovery guidance ### 📊 Changes **2 files changed** (+44 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/main/transport.ts` (+1 -2) 📝 `tests/boundary/mcp/mainErrors.test.ts` (+43 -0) </details> ### 📄 Description ## Summary Fixes #7346. The MCP HTTP startup path now uses the recovery supplied by the shared listener failure classifier for every classified error. A host lookup failure therefore directs callers to `--host` / `MCP_HOST` instead of incorrectly suggesting a port change. Unclassified listener failures retain the existing generic recovery. ## Problem and expected behavior `StreamableHttpListenError` already classifies `EAI_NONAME` as `host_lookup` and produces host-specific remediation. `startMcpTransport` replaced that parsed fact with generic port advice except for the host allowlist case. Changing the port cannot resolve a failed host lookup. The startup path should preserve the classifier's remediation for every classified failure, while keeping generic recovery for an unclassified native listener error. ## Change and scope The transport consumer now uses `cause.remediationAction` whenever the listener failure classification succeeds. Regression coverage checks both the reported host lookup failure and the `EADDRINUSE` control so port-in-use recovery remains available. This is an ordinary diagnostic correction within the existing MCP HTTP contract. It does not change listener classification, startup failure status, schemas, or provider behavior. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/server/http/streamableHttpListenError.ts` remains the owner of listener classification and recovery; the MCP startup projection in `src/main/transport.ts` now consumes that result without replacing it. - Contribution scope fit and linked maintainer decision: ordinary existing-boundary diagnostic fix; additional maintainer scope decision not applicable. - CLI and MCP/tool-catalog contract: `rea mcp --http` stderr recovery text changes for classified listener failures. No tool-catalog or JSON schema change. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. Expected effects: - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [x] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/mcp/mainErrors.test.ts` covers `EAI_NONAME` host lookup recovery and an `EADDRINUSE` control. The existing host-allowlist and unclassified-listener controls remain in place. - Base reproduction or other evidence: the linked issue observed the affected base revision through a deterministic injected `EAI_NONAME` listener failure and an `EADDRINUSE` control. - User-visible CLI/MCP output: with `Server.prototype.listen` replaced by the deterministic fixture, the fixed public CLI reports: - `EAI_NONAME`: `Check --host or MCP_HOST and host name resolution; correct the value or resolve the lookup failure, then retry.` - `EADDRINUSE`: `Choose another --port or MCP_PORT, or stop the process using it.` - Remaining proof gaps: a naturally failing host resolver was not exercised. The deterministic fixture intercepts `Server.listen`, so natural DNS timing and platform-specific resolver behavior remain unverified. Evidence-bearing checklist: not applicable; this change does not produce or alter analysis Evidence. ## Validation performed - `npm run test:focused -- tests/boundary/mcp/mainErrors.test.ts` — 1 file passed, 11 tests passed. - `npm run check:fast` — typecheck and lint passed. - `npm run format:check` — all matched files use the correct format. - Public CLI with injected `EAI_NONAME` — exited 1 and emitted host-specific recovery. - Public CLI with injected `EADDRINUSE` — exited 1 and retained port-specific recovery. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none; listener startup still fails closed and this patch changes only recovery text selection. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [ ] This PR addresses a concrete problem or an agreed enhancement. - [ ] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [ ] The PR has one focused outcome and the title follows `type(scope): outcome`. - [ ] Related issue is linked, or the reason for not linking one is stated above. - [ ] Tests cover changed observable behavior and meaningful failure paths. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [ ] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7836
No description provided.