Skip to content

fix: clean up stale tmux watchers and prevent duplicate sessions#599

Open
nvandessel wants to merge 1 commit intoasheshgoplani:mainfrom
nvandessel:fix/595-596-watcher-cleanup-and-duplicate-sessions
Open

fix: clean up stale tmux watchers and prevent duplicate sessions#599
nvandessel wants to merge 1 commit intoasheshgoplani:mainfrom
nvandessel:fix/595-596-watcher-cleanup-and-duplicate-sessions

Conversation

@nvandessel
Copy link
Copy Markdown

Summary

Fixes #595
Fixes #596

Test plan

  • TestKillStaleControlClients — spawns a real control-mode client, kills it, verifies removal from tmux client list
  • TestPipeManager_ConnectCleansStaleClients — verifies Connect() cleans stale clients before creating new ones
  • TestKillStaleControlClients_PreservesOwnProcess — safety check that we don't kill ourselves
  • TestKillSessionsWithEnvValue — creates two sessions with same CLAUDE_SESSION_ID, kills duplicate, verifies correct one survives
  • TestKillSessionsWithEnvValue_EmptyID — no-op on empty ID
  • TestKillSessionsWithEnvValue_NoMatch — doesn't kill sessions with different IDs
  • Full go build ./... passes
  • All new tests pass, no regressions in existing tests

🤖 Generated with Claude Code

…eshgoplani#595, asheshgoplani#596)

asheshgoplani#595: Kill orphaned `tmux -C attach-session` control-mode clients before
spawning new ones in PipeManager.Connect(). Previously, each TUI reconnect
accumulated watchers because old processes survived in their own process group.

asheshgoplani#596: Kill any existing agentdeck tmux session with the same CLAUDE_SESSION_ID
before starting a new one, in both Instance.Start() and Restart() paths. This
prevents two tmux sessions from running `claude --resume` with the same
conversation ID.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant