Drop `su` — it swallowed SIGWINCH, so no terminal ever resized

FixKlusterServices
Shipped
September 3, 2026 at 7:11 PM UTC
Author
Kamo
Commit
0b5b8a3

Caught by running the protocol against the live machine, not by reading it: after a resize control frame, `tput cols` in the shell still reported the size the terminal opened at. `su` FORKS rather than execs, so the tmux client sat in a different process group from the PTY's foreground one, and the SIGWINCH the kernel raises on TIOCSWINSZ went to `su`, which ignores it. Every shell wrapped at whatever width the window first had, and less, vim and htop drew to the wrong one. The agent is already root, so it now drops privileges itself — initgroups, setgid, setuid, chdir — and execs tmux directly. tmux becomes the PTY's foreground process and the signal lands where it is meant to. Three things fall out of it, all of them improvements: * The child environment is now BUILT rather than inherited, and that is a security boundary, not tidiness. This process's environment holds KAMO_DESKTOP_AGENT_TOKEN — the bearer token for every account operation on this machine — and a child that inherited os.environ would hand it to the member's shell, where `env` prints it. `su -` happened to wipe it; nothing was relying on that on purpose. * No shell parses a command string anywhere on this path any more. argv is a list of validated parts. * No PAM session is opened, so a terminal no longer registers a login session that loginctl would count against this machine's one-desktop-session-per-user policy. Opening a terminal must never be able to get somebody's desktop reaped. The enabled-account check in the handler now carries the whole weight, since su would have refused a locked password itself and setuid will not. It was already there; it is now load-bearing and says so. Also: pump returns instead of raising when its peer vanishes mid-select (EBADF/ECONNRESET). That is the ordinary end of a terminal — a closed tab — not a fault. 113 tests, including one that puts a fake token in os.environ and asserts it does not reach the child.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing