You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky test: "terminates the whole managed tree" fails on Windows and macOS runners #74
The unit test "terminates the whole managed tree (grandchild included) before resolving" (packages/core/test/unit/mcp/mcp-remote-runtime.test.ts:1195 on main, c36d50f) fails now and then on CI. It fails in a different way on each OS, and reruns pass.
Failures
Windows, on main (run 33529800770, 2026-09-01, test (windows-latest)):
FAIL: terminates the whole managed tree (grandchild included) before resolving
error: Unexpected end of JSON input
macOS, on a docs PR (run 34455726328, 2026-09-10, test (macos-latest)):
The input did not match the regular expression /timed out after \d+s/. Input:
'npm install of mcp-remote@0.1.38 timed out and its process tree could not be confirmed stopped (process group check failed (EPERM)). ...'
Likely causes
Windows: the fixture is killed before it writes its pids. The test gives the fake npm timeoutMs: 300 (:1212). In that time the fixture has to start Node.js, spawn the grandchild, and writeFileSync the pids file. On a slow runner the kill can land after the file is created but before it is written, so the test reads an empty file. If the kill lands earlier, the read fails with ENOENT instead.
macOS: EPERM from the group check. After SIGKILL, mcp-runtime-runner.ts polls process.kill(-pgid, 0) (:254) and treats anything but ESRCH as unconfirmed (:258). macOS can answer EPERM while a member of the group is a zombie that hasn't been reaped yet: the grandchild, reparented to launchd once the fake npm dies. Not confirmed.
Suggested fix
Test: give the fixture time to write before the timeout fires. The fixture never exits, so something like timeoutMs: 3000 still exercises the timeout. Write the pids file atomically (write a temp file, then rename it), so a kill can't leave it empty.
Runner: on EPERM, keep polling until the deadline instead of failing at once. Only report "could not be confirmed stopped" if the group still answers at the deadline.
Attempt 1 and attempt 2 both failed the macOS managed-tree test: 733/734 passed, with process group check failed (EPERM). Ubuntu and Windows passed.
The failing operation is process.kill(-child.pid, 0) in mcp-runtime-runner.ts:254, after TERM/KILL attempts and root close. Any non-ESRCH error returns unconfirmed immediately, leaving staging retained-live; this makes the timeout-message assertion fail.
Transient process-group state during reaping remains a hypothesis, not a demonstrated zombie race: these logs do not capture PID/PGID/UID/process states or the swallowed TERM/KILL errors. Focused macOS diagnostics should establish that before selecting a fix; an EPERM must not be treated as proof that the group is absent.
Activity
dobleuber commentedon Oct 21, 2026
Additional occurrence in PR #78, 2026-10-21:
process group check failed (EPERM). Ubuntu and Windows passed.process.kill(-child.pid, 0)inmcp-runtime-runner.ts:254, after TERM/KILL attempts and root close. Any non-ESRCHerror returns unconfirmed immediately, leaving stagingretained-live; this makes the timeout-message assertion fail.Transient process-group state during reaping remains a hypothesis, not a demonstrated zombie race: these logs do not capture PID/PGID/UID/process states or the swallowed TERM/KILL errors. Focused macOS diagnostics should establish that before selecting a fix; an
EPERMmust not be treated as proof that the group is absent.