feat(tmux): add KillSessionWithProcesses for explicit process termination

Before calling tmux kill-session, explicitly kill the pane's process tree
using pkill. This ensures claude processes don't survive session termination
due to SIGHUP being caught/ignored.

Implementation:
- Add KillSessionWithProcesses() to tmux.go
- Update killSessionsInOrder() in start.go to use new method
- Update stopSession() in down.go to use new method

Fixes: gt-5r7zr

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nux
2026-01-13 11:42:16 -08:00
committed by beads/crew/emma
parent 87fde4b4fd
commit e043f4a16c
3 changed files with 38 additions and 5 deletions

View File

@@ -387,8 +387,8 @@ func stopSession(t *tmux.Tmux, sessionName string) (bool, error) {
time.Sleep(100 * time.Millisecond)
}
// Kill the session
return true, t.KillSession(sessionName)
// Kill the session (with explicit process termination to prevent orphans)
return true, t.KillSessionWithProcesses(sessionName)
}
// acquireShutdownLock prevents concurrent shutdowns.

View File

@@ -627,7 +627,7 @@ func killSessionsInOrder(t *tmux.Tmux, sessions []string, mayorSession, deaconSe
// 1. Stop Deacon first
if inList(deaconSession) {
if err := t.KillSession(deaconSession); err == nil {
if err := t.KillSessionWithProcesses(deaconSession); err == nil {
fmt.Printf(" %s %s stopped\n", style.Bold.Render("✓"), deaconSession)
stopped++
}
@@ -638,7 +638,7 @@ func killSessionsInOrder(t *tmux.Tmux, sessions []string, mayorSession, deaconSe
if sess == deaconSession || sess == mayorSession {
continue
}
if err := t.KillSession(sess); err == nil {
if err := t.KillSessionWithProcesses(sess); err == nil {
fmt.Printf(" %s %s stopped\n", style.Bold.Render("✓"), sess)
stopped++
}
@@ -646,7 +646,7 @@ func killSessionsInOrder(t *tmux.Tmux, sessions []string, mayorSession, deaconSe
// 3. Stop Mayor last
if inList(mayorSession) {
if err := t.KillSession(mayorSession); err == nil {
if err := t.KillSessionWithProcesses(mayorSession); err == nil {
fmt.Printf(" %s %s stopped\n", style.Bold.Render("✓"), mayorSession)
stopped++
}