b5b2ab1bb0
Review raised a real gap: we reap by pgid, so a registration is only as meaningful as the group's identity. A group we deliberately keep registered -- an orphan teardown failed to kill, such as the `node` mcp-remote leaves behind -- can later exit on its own, after which the kernel may hand that pgid to an unrelated process owned by the same user. An ungraceful Hermes death while the registration is stale would then signal a stranger. `_is_safe_target` cannot catch it, because the value is stale rather than invalid. Prune registrations whose group has no members left on every registration change, and tell the supervisor to forget them. Signal 0 is a pure existence question -- it cannot terminate anything -- so this is cheap and safe to run on the hot path. An ambiguous answer (EPERM: exists but not ours) keeps the registration, since dropping real coverage is the more expensive mistake. This narrows the window rather than closing it: a group can still die and its pgid be recycled between two probes. Closing it completely means proving group identity at reap time, e.g. stamping children with a boot-unique env marker and checking a member still carries it. That was judged not worth putting a `ps` parse into the one process whose job is to stay simple enough to always work, so the residual is now documented in the module docstring instead, along with the note that Hermes's existing killpg-based orphan cleanup already carries the same exposure (upstream #88350). Also records why supervisor recovery is deliberately two-step: a failed write drops the handle, and the next call rebuilds coverage from `_supervised_pgids`, which -- not the pipe -- is the record of what needs reaping. The protocol tests register synthetic pgids that were never real process groups, so they now state that precondition through an `all_groups_alive` fixture instead of depending on pid-space luck. 29 tests pass. Verified the change adds no failures: same selection, my changes stashed vs applied, 42 failed either way (pre-existing in a locally rebuilt venv) with passed going 617 -> 619 for the two new tests. Footgun linter clean. (cherry picked from commit 3a7d219620a8cb57a7fe2c2346ce3f055320e743)