fix(tmux): keep a closing pane, and trust a dead flag only with an exit sign

Review follow-up on the tmux 3.8 dead-pane fix.

- parsePaneRows() skipped a row with a blank pid and pane_dead 0. tmux
  blanks the pid when the pty closes, and pane_dead turns 1 only once
  the exit status is collected (seconds for some exits on tmux 3.4), so
  a restart in that window dropped the session. Only a row with neither
  a pid nor a dead flag is skipped now.
- Before tmux 3.7 pane_dead means only that the pty is closed. The kill
  read now also reads #{pane_dead_time}, and counts a pane as dead only
  with a blank pid or a set exit time, so a program that closed its tty
  and ignores SIGHUP is still killed on tmux 3.3a to 3.6.
- Tests pin the last two pane format fields and add a live-pane
  counterpart to the dead-pane kill test.
- Changeset notes that finished sessions piled up on 3.8 are relaunched
  once at the first start after the update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kamil KaliszandClaude Opus 5.5 committed 2026-11-25 12:59:40 +01:00
1 parent d7c141e25f
commit ccf502b7a8
5 files changed
+117 -28

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@
'aicodeman': patch
---
On tmux 3.8, a session whose agent exited (`/exit`) is now seen as exited and closed like on older tmux, instead of staying on the board as idle. tmux 3.8 prints a blank pane pid for a dead pane, and the pane watcher threw that row away, so the clean-exit sweep never ran and a restart of Codeman dropped the session's record while its tmux session stayed on the socket. A dead pane's exit is now told apart from the next one by `#{pane_dead_time}`. Closing a session whose pane is dead no longer signals the pid recorded for it, which belonged to the program that exited and may have been reused by another process; only the tmux session is killed. A dead `codeman-*` tmux session that was orphaned before this fix is still not rediscovered; remove it with `tmux -L codeman kill-session -t codeman-<id>`.
On tmux 3.8, a session whose agent exited (`/exit`) is now seen as exited and closed like on older tmux, instead of staying on the board as idle. tmux 3.8 prints a blank pane pid for a dead pane, and the pane watcher threw that row away, so the clean-exit sweep never ran and a restart of Codeman dropped the session's record while its tmux session stayed on the socket. A dead pane's exit is now told apart from the next one by `#{pane_dead_time}`. Closing a session whose pane is dead no longer signals the pid recorded for it, which belonged to the program that exited and may have been reused by another process; only the tmux session is killed. Finished sessions that piled up on the board on tmux 3.8 are relaunched once, at the first start after this update. A dead `codeman-*` tmux session that was orphaned before this fix is still not rediscovered; remove it with `tmux -L codeman kill-session -t codeman-<id>`.