Track tmux windows in session list and make tmux quit behavior consistent#42
Track tmux windows in session list and make tmux quit behavior consistent#42
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- Generate unique window names using GenerateTmuxWindowName() for manually created windows, matching the pattern used for build/plan sessions (e.g., "happy-tiger") - Capture and store both window name and window ID (@1, @2, etc.) when creating tmux windows - Add TmuxWindowID field to Session and SessionInfo types - Update TrackTmuxWindow to require window ID parameter - Display window ID alongside window name in session list view - Update tests to include window ID assertions This addresses the window identity ambiguity issue by using unique generated names instead of relying on default tmux naming, while also tracking window IDs for more robust window identification. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix false tracking error when opening tmux windows in non-tmux session modes. Check IsInTmuxMode() before calling TrackTmuxWindow to avoid showing error toasts when the window creation succeeded but tracking isn't applicable. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Thanks for the review! I've addressed both issues: Issue 1: Tracked windows use non-unique tmux names ✅ FixedCommit: 0be59ff The implementation now:
This ensures window names are unique and provides window ID as a fallback identifier. Issue 2: False tracking error outside tmux session mode ✅ FixedCommit: 01c1f9c Added All tests passing ✅ |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Address review feedback:
1. Use window IDs for tracked window lifecycle checks
- Add TmuxWindowExistsByID() and KillTmuxWindowByID() functions
- Monitor goroutines now check window existence by ID, not name
- Window IDs are stable even if user renames windows
2. Ensure TmuxExitOnQuit only affects app quit, not session exits
- Remove killOnStop from regular session creation
- Move window cleanup logic to Close() method
- Windows are only killed during app quit, not on session
completion or failure
- This fixes the issue where failed sessions would lose their
tmux windows even when user wanted to inspect the error
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Thanks for the additional review! I've addressed both new issues in commit 1c12660: Issue 1: Quit flag affects non-quit session exits ✅ FixedProblem: Solution:
Issue 2: Tracked windows ignore stable tmux window IDs ✅ FixedProblem: We captured window IDs but still used window names for lifecycle checks, making tracking fragile if windows are renamed. Solution:
All tests passing ✅ |
Summary
w-created tmux windows in Bramble's per-worktree session list so users can switch from worktree → tmux window--tmux-exit-on-quit:false): preserve Bramble-created and tracked tmux windows on quittrue): close both Bramble-created session windows and trackedwwindows on quitChanges
TmuxWindowIDfield to Session/SessionInfo typesGenerateTmuxWindowName()for unique window namingtmux new-window -n <name> -P -F "#{window_name},#{window_id}"Validation
Note
Medium Risk
Touches tmux process/window lifecycle management and introduces new cleanup behavior on shutdown; mis-tracking or kill-by-ID mistakes could affect users’ tmux sessions if IDs/names are wrong.
Overview
Tracks
w-opened tmux windows as sessions so they appear in the per-worktree session list, capturing and displaying both tmuxwindow_nameand stablewindow_id(e.g.happy-tiger @1). Window creation now uses a generated unique name plustmux new-window -P -Foutput parsing, and the UI refreshes worktree/session dropdowns immediately after tracking.Adds manager support for
TrackTmuxWindow, including polling-based lifecycle cleanup usingTmuxWindowExistsByID, plus an opt-in--tmux-exit-on-quitflag that (when enabled) kills Bramble-started/tracked tmux windows on app exit; tmux runners no longer kill windows onStop()by default. Includes new/updated tests for tracking and stop semantics.Written by Cursor Bugbot for commit 1c12660. This will update automatically on new commits. Configure here.