[PR #729] [MERGED] fix(mcp): retain shutdown failure diagnostics #2195

Closed
opened 2026-10-16 21:15:32 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/729
Author: @kaoru0822-kitauji
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/mcp-shutdown-diagnostics


📝 Commits (1)

  • fd008cd fix(mcp): retain shutdown failure diagnostics

📊 Changes

2 files changed (+90 additions, -1 deletions)

View changed files

📝 src/main/shutdown.ts (+29 -1)
➕ tests/boundary/mcp/shutdown.test.ts (+61 -0)

📄 Description

Summary

  • retain unexpected MCP shutdown rejection details in a debug-only structured log
  • preserve the existing exact caller-facing shutdown message and failing exit code
  • bound non-Error rejections to JSON-safe type/value diagnostics

Closes #638.

Evidence

The shutdown coordinator currently handles a rejected transport/session close with .catch(() => ...), so the rejection identity is discarded before logging. The existing error log and stderr message intentionally expose only recovery guidance.

The regression drives the production shutdown coordinator with a transport close rejection carrying a TypeError and ECONNRESET. It verifies that debug logging retains the name, message, and code while stderr remains exactly REA could not close cleanly. End the REA process before starting it again. and the exit code remains 1. The existing MCP runtime error suite also continues to pass at the default log level.

Validation

Passed:

  • npx vitest run tests/boundary/mcp/shutdown.test.ts tests/boundary/mcp/mainErrors.test.ts --project mcp-boundary (7 tests)
  • npm exec --package=typescript@5.9.3 -- tsc --noEmit
  • npm run lint
  • npm run knip
  • npm run metadata:check
  • targeted oxfmt --check for both changed files
  • git diff --check

Materially unverified:

  • npm run test:focused -- tests/boundary/mcp/shutdown.test.ts tests/boundary/mcp/mainErrors.test.ts could not reach the tests because the repository's TypeScript 7 build binary panics while resolving /proc/self/exe in this sandbox. The same tests passed directly, and stable TypeScript 5.9 passed.

🔄 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/729 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/mcp-shutdown-diagnostics` --- ### 📝 Commits (1) - [`fd008cd`](https://github.com/morluto/rea/commit/fd008cd8e0b8277e691efd8e69dc96ac8e188d9e) fix(mcp): retain shutdown failure diagnostics ### 📊 Changes **2 files changed** (+90 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/main/shutdown.ts` (+29 -1) ➕ `tests/boundary/mcp/shutdown.test.ts` (+61 -0) </details> ### 📄 Description ## Summary - retain unexpected MCP shutdown rejection details in a debug-only structured log - preserve the existing exact caller-facing shutdown message and failing exit code - bound non-Error rejections to JSON-safe type/value diagnostics Closes #638. ## Evidence The shutdown coordinator currently handles a rejected transport/session close with `.catch(() => ...)`, so the rejection identity is discarded before logging. The existing error log and stderr message intentionally expose only recovery guidance. The regression drives the production shutdown coordinator with a transport close rejection carrying a `TypeError` and `ECONNRESET`. It verifies that debug logging retains the name, message, and code while stderr remains exactly `REA could not close cleanly. End the REA process before starting it again.` and the exit code remains 1. The existing MCP runtime error suite also continues to pass at the default log level. ## Validation Passed: - `npx vitest run tests/boundary/mcp/shutdown.test.ts tests/boundary/mcp/mainErrors.test.ts --project mcp-boundary` (7 tests) - `npm exec --package=typescript@5.9.3 -- tsc --noEmit` - `npm run lint` - `npm run knip` - `npm run metadata:check` - targeted `oxfmt --check` for both changed files - `git diff --check` Materially unverified: - `npm run test:focused -- tests/boundary/mcp/shutdown.test.ts tests/boundary/mcp/mainErrors.test.ts` could not reach the tests because the repository's TypeScript 7 build binary panics while resolving `/proc/self/exe` in this sandbox. The same tests passed directly, and stable TypeScript 5.9 passed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15:32 +00:00
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#2195
No description provided.