From 0b21fccbf000a5ec5af521f6fe6f27508c8e1a8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:40:31 +0000 Subject: [PATCH 1/2] Initial plan From cb28ba6c13fe8bf50394ed6680f7161ce4c79a35 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 01:42:45 +0000 Subject: [PATCH 2/2] Fix readResponseById: clear timeout on success, remove handler on timeout, unref timer Co-authored-by: frouaix <876178+frouaix@users.noreply.github.com> --- packages/mcp-server/test/integration/e2e-apps.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/mcp-server/test/integration/e2e-apps.test.ts b/packages/mcp-server/test/integration/e2e-apps.test.ts index 2397a76..b185da1 100644 --- a/packages/mcp-server/test/integration/e2e-apps.test.ts +++ b/packages/mcp-server/test/integration/e2e-apps.test.ts @@ -43,6 +43,7 @@ function readResponseById(proc: ChildProcess, id: number, timeoutMs = 15000): Pr const msg = JSON.parse(line) as Record; if (msg["id"] === id) { proc.stdout!.off("data", handler); + clearTimeout(timer); resolve(msg); return; } @@ -52,7 +53,11 @@ function readResponseById(proc: ChildProcess, id: number, timeoutMs = 15000): Pr } }; proc.stdout!.on("data", handler); - setTimeout(() => reject(new Error(`Timeout waiting for response id=${id}`)), timeoutMs); + const timer = setTimeout(() => { + proc.stdout!.off("data", handler); + reject(new Error(`Timeout waiting for response id=${id}`)); + }, timeoutMs); + timer.unref(); }); }