mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-27 07:59:33 +01:00
fix(tmux): closing a session never signals pid 0 or 1
tmux answers 0 for the pid of a pane without a process (`split-window ''`). The pane list read at server start recorded that 0 on the session, and the next close of the tab walked the children of pid 0, which is the whole machine: every process of the account was signalled, all sessions, tmux itself and the systemd user manager included. killSession() now decides once whether there is a process to signal (isSignalablePid(), an integer above 1) and otherwise leaves the close to `tmux kill-session`. The descendant walk of the kill path returns nothing for such a root, and signalProcess(), the only place in tmux-manager.ts that sends a signal, refuses it for the process group form as well. proc-walk-bounds used pid 1 as the root of its fixture tree, which the kill path now refuses on purpose, so the fixture is rooted at a real pid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5548c17c4a
commit
babb55e4d9
6 files changed
+212
-17
No files matched your search
@@ -1385,6 +1385,8 @@ Target: 20 sessions, 50 agent windows at 60fps. Limits in `src/config/`: termina
|
||||
|
||||
⚠️ Truncation is reported through `onTruncated` rather than silently, with BOTH caps named: a silent depth cap hides a deep tree exactly as effectively as a silent node cap hides a wide one.
|
||||
|
||||
⚠️ **A kill never takes pid 0 or 1** (2026-11-25). A bound limits how MUCH a walk collects, not what it is a walk of: the children of pid 0 are init and everything below it, so `killSession()` with pid 0 signalled every process of the account, which took down every session, tmux itself and the systemd user manager (the machine did not reboot, and with the manager gone the server did not come back until the next login). It was reached by a script that drove the real `killSession()` on an empty pane lookup (`Number('')` is 0), but it needs no script. tmux answers `0` for `#{pane_pid}` of a pane without a process (`split-window ''`; measured on 3.4), `parsePaneRows()` keeps that row, and `reconcileSessions()` at server start writes it to `session.pid`, where the last pane of a session wins. The next close read 0 from tmux, fell back to the record, found 0 there too, and walked it. Reproduced on master with the signals logged instead of sent, inside a PID namespace: "Killing session codeman-feed1234 (PID 0)", "Found 15 child processes to kill". So 0 is an ordinary answer and means "nothing to signal". Three layers, all pinned in `test/kill-pid-guard.test.ts`: `killSession()` decides once (`isSignalablePid()`, an integer above 1) and otherwise leaves the close to `tmux kill-session`; `getChildPidsFresh()` walks nothing for such a root; and `signalProcess()`, the only place in `tmux-manager.ts` that sends a signal, refuses it for the group form as well (`kill(-1)` is every process, `kill(0)` is our own group). `collectDescendants()` itself stays a plain walk. A recorded 0 is deliberately left on the record rather than replaced by the older pid: that pid belongs to a process that may have exited since and been reused.
|
||||
|
||||
## Local packages and build artifacts
|
||||
|
||||
### xterm-zerolag-input is single-source
|
||||
|
||||
Reference in new issue
Block a user