Skip to content

Flaky test: "terminates the whole managed tree" fails on Windows and macOS runners #74

Open

Description

@brycebaril

Summary

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.

Activity

  1. dobleuber commented on Oct 21, 2026

    @dobleuber

    Additional occurrence in PR #78, 2026-10-21:

    • 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.
    • This matches the September 10 occurrence already documented here. The same runner and test files passed in PR #77's macOS job, using the same Node 22.23.3 and macos-26-arm64 / 20261013.0424.1 image as the failures. PR docs: clarify alert starter catalog takes no arguments #78 changes only one skill-documentation line.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglaunch: stretchStretch goal for the N|Solid 7.0 releasetesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions