Skip to content

MCP shutdown can terminate unrelated processes with Homebrew pgrep #823

Description

@bagelcode-jhkim

What happened?

On macOS, quitting an OmO native session can terminate unrelated processes when Homebrew proctools provides the first pgrep on PATH.

MCP shutdown calls collectProcessTree(), which currently runs pgrep -P <pid> without the required positional pattern. Homebrew pgrep treats that as a system-wide match, so reapProcessTree() can collect and signal PIDs that are not descendants of Senpi.

This matters because a normal /quit can close unrelated terminals, editors, and background services.

Steps to reproduce safely

Do not reproduce this through /quit. The lookup bug can be observed without sending any signals:

sleep 30 & child=$!
/opt/homebrew/bin/pgrep -P $$ | wc -l
/opt/homebrew/bin/pgrep -P $$ .
/usr/bin/pgrep -P $$ .
kill "$child"

On my machine, the patternless Homebrew command returned 798 PIDs and included PID 1. Both commands with the explicit . pattern returned only the actual child.

Expected behavior

Process-tree collection should query only direct children. Passing . as the match-all process-name pattern works with both Homebrew proctools and macOS /usr/bin/pgrep.

I am preparing a minimal fix and regression test.

Version

  • omo-ai@5.0.0-0.beta.6
  • nested @code-yeongyu/senpi@2026.8.11-4
  • Homebrew proctools@0.4pre1
  • current main at 20d33e8e46bef8ad38fcf1e99f8196b599741c44

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions