Skip to content

fix: ^X J keeps tmux windows in their session, and reads iTerm's tabs fully - #377

Merged
brtkwr merged 1 commit into
mainfrom
fix/order-tabs-review
Nov 20, 2026
Merged

brtkwr merged 1 commit into
mainfrom
fix/order-tabs-review

Conversation

@brtkwr

@brtkwr brtkwr commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Opus 5.5 ✨

Follow-up to #376, fixing four findings from a Codex review after it merged. I checked each against main and all four were real.

  1. tmux could move windows between sessions. Swaps and the final select targeted a bare @id. When a window is linked into two sessions, tmux can resolve that id in the other session. On a throwaway tmux -L server, swapping @2 (linked into sessions a and b) with @0 moved @0 out of a into b. Now every target is session:index, and the window that was current is selected again at its new place. The same setup with the new targets left session b untouched.
  2. iTerm could pull a moved tab back. ccs read the windows, then made the slow AppleScript call for ttys, then reordered. ReorderTabs moves any tab it's given into the window named, so a tab dragged to another window in between would have been pulled back. Now the ttys are read first (a session's tty never changes) and the windows last, right before reordering, with nothing slow in between.
  3. Floating panes were ignored. iTerm's api.proto lists a tab's floating panes in field 12 (FloatingPane { SessionSummary session = 1 }, confirmed from the iterm2 library's descriptors). A tab whose session was a floating pane counted as unrelated and stayed put. They count now.
  4. Errors showed the socket path. A *net.OpError wrapped with %w carried iTerm's socket path into ccs's error row. apiErr now says what failed (iTerm API: write: broken pipe) without the path.

Tests: the tmux fixture now has a window linked into two sessions and a moved current window, and checks the exact session:index commands. The iTerm fake checks that ttys are read before windows. The parse fixture includes a floating pane, and a new test covers apiErr.

🤖 Generated with Claude Code

… fully

- tmux: swap and select windows by session:index, not a bare @id. A
  window linked into two sessions resolved in the other session, so a
  swap moved windows between sessions (reproduced on a throwaway tmux
  server).
- iTerm: read the session ttys first and the windows last, just before
  reordering. ReorderTabs pulls any tab it is given into the window named,
  so a tab dragged to another window during the AppleScript call would
  have been pulled back.
- iTerm: count a tab's floating panes (tab field 12) as its sessions.
- iTerm: transport errors name what failed without the socket's path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brtkwr
brtkwr enabled auto-merge November 20, 2026 14:34
@brtkwr
brtkwr merged commit 4cc1598 into main Nov 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant