[PR #1271] [MERGED] fix(process): await cleanup on CLI and MCP cancellation #2754

Closed
opened 2026-10-17 21:09:50 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1271
Author: @N0zoM1z0
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/process-cancellation-lifecycle


📝 Commits (1)

  • a76e67b fix(process): await cleanup on CLI and MCP cancellation

📊 Changes

8 files changed (+327 additions, -18 deletions)

View changed files

📝 src/application/process/ProcessCli.ts (+2 -1)
📝 src/cli/processCommands.ts (+8 -5)
📝 src/process/ProcessOwnership.validation.test.ts (+35 -0)
📝 src/process/ProcessOwnershipObservation.ts (+12 -6)
📝 src/process/capture/ProcessCaptureLifecycle.ts (+11 -6)
📝 src/process/capture/ProcessHarness.ts (+1 -0)
➕ tests/boundary/process/processCaptureCancellationAdapters.test.ts (+213 -0)
➕ tests/fixtures/processCaptureCancellation.mjs (+45 -0)

📄 Description

capture-process used to exit immediately on SIGINT/SIGTERM, leaving its owned workload running. MCP cancellation also waited through the full post-exit settlement interval before cleaning a surviving descendant.

Route CLI interrupts through the existing cancellation helper and shared capture signal, and make settlement polling and process-table observation cancellable. Cleanup still completes without the aborted signal, retaining earlier observations and typed cancellation diagnostics. CLI exits are 130 for SIGINT and 143 for SIGTERM.

Closes #1232.
Closes #1233.

Validation:

  • New real CLI/SDK regressions failed on the baseline for both CLI signals and the surviving post-exit descendant; all pass after the fix.
  • Focused cancellation/ownership tests: 17 passed in 2 files.
  • Adjacent process lifecycle, failure-observation and identity tests: 58 passed in 6 files.
  • npm run check:fast.
  • Actual stdio MCP/CLI probe confirms owned-process termination and absence of the delayed write; MCP connection remains reusable.

Verification was Linux x64 with Node 24.18.0, one CPU and a 768MiB Node heap. No real Hopper/Ghidra verification was needed or performed for this process-capture change. Native PTY regressions report a capability skip on unsupported hosts.


🔄 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/1271 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/process-cancellation-lifecycle` --- ### 📝 Commits (1) - [`a76e67b`](https://github.com/morluto/rea/commit/a76e67bc8c2041f638eb35c2cb7b1b2ccfd0de2b) fix(process): await cleanup on CLI and MCP cancellation ### 📊 Changes **8 files changed** (+327 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/application/process/ProcessCli.ts` (+2 -1) 📝 `src/cli/processCommands.ts` (+8 -5) 📝 `src/process/ProcessOwnership.validation.test.ts` (+35 -0) 📝 `src/process/ProcessOwnershipObservation.ts` (+12 -6) 📝 `src/process/capture/ProcessCaptureLifecycle.ts` (+11 -6) 📝 `src/process/capture/ProcessHarness.ts` (+1 -0) ➕ `tests/boundary/process/processCaptureCancellationAdapters.test.ts` (+213 -0) ➕ `tests/fixtures/processCaptureCancellation.mjs` (+45 -0) </details> ### 📄 Description `capture-process` used to exit immediately on SIGINT/SIGTERM, leaving its owned workload running. MCP cancellation also waited through the full post-exit settlement interval before cleaning a surviving descendant. Route CLI interrupts through the existing cancellation helper and shared capture signal, and make settlement polling and process-table observation cancellable. Cleanup still completes without the aborted signal, retaining earlier observations and typed cancellation diagnostics. CLI exits are 130 for SIGINT and 143 for SIGTERM. Closes #1232. Closes #1233. Validation: - New real CLI/SDK regressions failed on the baseline for both CLI signals and the surviving post-exit descendant; all pass after the fix. - Focused cancellation/ownership tests: 17 passed in 2 files. - Adjacent process lifecycle, failure-observation and identity tests: 58 passed in 6 files. - `npm run check:fast`. - Actual stdio MCP/CLI probe confirms owned-process termination and absence of the delayed write; MCP connection remains reusable. Verification was Linux x64 with Node 24.18.0, one CPU and a 768MiB Node heap. No real Hopper/Ghidra verification was needed or performed for this process-capture change. Native PTY regressions report a capability skip on unsupported hosts. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:09:50 +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#2754
No description provided.