tpgid names a process *group*, not a process. Its leader can exit while another member still holds the terminal — a foreground pipeline whose first stage finished — and then /proc/<tpgid> does not exist, so reading it directly reported the session idle while it sat waiting on the user. awaiting_input now searches the pane's subtree for live processes whose pgrp matches, and asks whether any is parked on the tty. Members stay in that subtree because their parent shell is alive, so they never reparent. Reported in review on #51. The regression test needs an interactive shell — job control is what puts a pipeline in its own process group — and waits for the leader to actually be gone before asserting, otherwise it passes against the old lookup while the shell is still foreground. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>