The previous approach using KillPaneProcessesExcluding/KillPaneProcesses killed the pane's main process (Claude/node) before calling RespawnPane. This caused the pane to close (since tmux's remain-on-exit is off by default), which then made RespawnPane fail because the target pane no longer exists. The respawn-pane -k flag handles killing atomically - it kills the old process and starts the new one in a single operation without closing the pane in between. If orphan processes remain (e.g., Claude ignoring SIGHUP), they will be cleaned up when the new session starts or by periodic cleanup processes. This fixes both self-handoff and remote handoff paths. Fixes: hq-bv7ef Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
28 KiB
28 KiB