Skip to content

fix(paseo-omp): Better child process closing based on stdin.end(), with prevention for starting childprocess on Windows to kill process - #150

Closed
ThaDaVos wants to merge 2 commits into
omercnet:mainfrom
ThaDaVos:feature/improved-closeProcess-on-OmpRpcProcess
Closed

ThaDaVos wants to merge 2 commits into
omercnet:mainfrom
ThaDaVos:feature/improved-closeProcess-on-OmpRpcProcess

Conversation

@ThaDaVos

Copy link
Copy Markdown

This is a fix for the passeo-omp plugin not working on Windows due to a race-condition with TaskKill, the same fix is also transposed on the closeTransport method in mcp-transport.ts - which I noticed to have very similar code.

Suggestion for the future: Create a base-class for childprocess work, to prevent duplicate work and make it easier to implement such fixes.

…with prevention for starting childprocess on Windows to kill process
@ThaDaVos
ThaDaVos requested a review from omercnet as a code owner September 22, 2026 18:11
Copilot AI lite review requested due to automatic review settings September 22, 2026 18:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved type-checking and shutdown behavior issues must be addressed before approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 4 Medium severity

Open (6)
What changed in this PR

Updates OMP and MCP child-process shutdown to end stdin first, wait for closure, and fall back to process-tree cleanup after timeout.

Changes:

  • Adds stdin-close timeout handling.
  • Applies the shutdown flow to both transports.
  • Reuses process cleanup types and timeout behavior.
File Summary
paseo-omp/​server/​provider/​omp-rpc-transport.ts Updates OMP shutdown sequencing; unresolved timer typing, cleanup, and regression issues remain.
paseo-omp/​server/​provider/​mcp-transport.ts Mirrors the shutdown strategy; unresolved timer typing, cleanup, notification, lint, and regression issues remain.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread paseo-omp/server/provider/mcp-transport.ts Outdated
Comment thread paseo-omp/server/provider/omp-rpc-transport.ts Outdated
const treeCleanup = this.startTreeCleanup();
if (!this.exited) {

if (this.exited) return;
Comment on lines +260 to +267
} catch (error) {
if (error instanceof TimeOutError) {
console.warn(`MCP stdio process did not close in time (${PROCESS_STOP_TIMEOUT_MS}ms), starting tree cleanup`);
let terminated = await this.startTreeCleanup();

if (!terminated) throw new Error("MCP stdio process tree cleanup failed");
}
}
Comment on lines +274 to 275
throw new Error("MCP stdio process did not close after tree cleanup");
}
const cleanupPromise = this.startTreeCleanup();
if (!this.exited) {

if (this.exited) return;
@omercnet

Copy link
Copy Markdown
Owner

Thanks for tracking down the Windows taskkill / stdin EOF race and for applying the observation to both the OMP RPC and MCP stdio paths. That diagnosis was useful.

I took the fix in a narrower direction in #152: a real Windows leader-plus-descendant regression test first, followed by the smallest ordering change that keeps the Windows tree root alive until taskkill /T /F is verified. POSIX retains its existing concurrent EOF and process-group cleanup behavior.

I’m going to close this PR as superseded by #152 to avoid landing two competing shutdown implementations. The combined regression and fix pass windows-latest.

Thanks also for the shared base-class suggestion. The duplicated shutdown shape is worth monitoring, but the two transports currently differ in lifecycle and notification semantics; extracting a base class would broaden this race fix unnecessarily.

@omercnet omercnet closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants