Cancel pending timers when a child is closed #6
Reference in New Issue
Block a user
Delete Branch "worktree-timers-cancel-on-close"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
OnChildClosedtoChildEventListenerand emits it fromSession.Close(and the terminal-corpse path inreapChild).timerManager.onChildClosedcancels timers owned by the closed child and prunes the closed child from every watcher list; if a watched list empties, the timer is cancelled outright (no synthetic fire).Why
Stale timer bodies were being re-delivered to the orchestrator pane after the parent had already processed the sub-agent's reply and called `close_process`. The timer registry had no link to child lifecycle, so any lingering timer plus a trailing classifier tick for the now-removed child re-fired the body.
Test plan