fix(tmux): use KillSessionWithProcesses to prevent zombie bash processes

When Claude sessions were terminated using KillSession(), bash subprocesses
spawned by Claude's Bash tool could survive because they ignore SIGHUP.
This caused zombie processes to accumulate over time.

Changed all critical session termination paths to use KillSessionWithProcesses()
which explicitly kills all descendant processes before terminating the session.

Fixes: gt-ew3tk

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
slit
2026-01-20 20:37:34 -08:00
committed by beads/crew/emma
parent 78ca8bd5bf
commit 9caf5302d4
18 changed files with 66 additions and 39 deletions

View File

@@ -729,12 +729,13 @@ func (m *Manager) ReconcilePoolWith(namesWithDirs, namesWithSessions []string) {
dirSet[name] = true
}
// Kill orphaned sessions (session exists but no directory)
// Kill orphaned sessions (session exists but no directory).
// Use KillSessionWithProcesses to ensure all descendant processes are killed.
if m.tmux != nil {
for _, name := range namesWithSessions {
if !dirSet[name] {
sessionName := fmt.Sprintf("gt-%s-%s", m.rig.Name, name)
_ = m.tmux.KillSession(sessionName)
_ = m.tmux.KillSessionWithProcesses(sessionName)
}
}
}