A member of the foreground group can sit outside the pane's subtree: a stage that forks a terminal-reading child and exits leaves that child reparented to init while it keeps the foreground pgid. The subtree search finds nothing and the session reads as idle. An empty subtree result now falls back to scanning /proc for the group. The scan only runs when the cheap path found nothing, so the common case still costs a handful of reads. Tested at the level it can honestly be tested: scan_for_pgid against this process's own group, and against a group that cannot exist. Reproducing the reparenting scenario end to end is not practical — setpgid across sessions is EPERM, and from a shell the window closes as soon as the shell reclaims the terminal. Reported in review on #51. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>