diff --git a/.changeset/dead-pane-blank-pid.md b/.changeset/dead-pane-blank-pid.md index 44a3755f..f38c2d41 100644 --- a/.changeset/dead-pane-blank-pid.md +++ b/.changeset/dead-pane-blank-pid.md @@ -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. +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-`. diff --git a/src/tmux-manager.ts b/src/tmux-manager.ts index 8188f18d..1cf2af1b 100644 --- a/src/tmux-manager.ts +++ b/src/tmux-manager.ts @@ -286,7 +286,8 @@ const PANE_LIST_SEP = '|'; * `#{pane_dead_time}` is what tells one exit from the next. tmux 3.8 prints a * blank `#{pane_pid}` once a pane's program has exited, so the pid cannot do it * there, and the time is stamped once per exit, so a respawned pane that exits - * again reads as a new exit even with the same status. + * again reads as a new exit even with the same status. The stamp is in whole + * seconds, so two exits with the same status in the same second read as one. * * `#{pane_current_path}` comes last on purpose: a directory name may contain the * separator, and only the final field can absorb it without ambiguity. @@ -3965,7 +3966,9 @@ export class TmuxManager extends EventEmitter implements TerminalMultiplexer { * changed status, a changed signal, a different pane pid or a different exit * time all start a new observation — the pid and the time are what catch a * second command in the same pane that happened to exit the same way (the - * time alone on tmux 3.8, which blanks a dead pane's pid). + * time alone on tmux 3.8, which blanks a dead pane's pid). `#{pane_dead_time}` + * is stamped to the second, so two exits with the same status in the same + * second read as one there. * * The same rule decides the read count: a repeat of the stored exit adds one, * and anything that starts a new observation starts the count again at 1.