Severity: LOW
Status: Fixed
Automatic window renaming updated the window title to match the active foreground process (e.g. vim, git, cargo, zsh), but users experienced a perceptible delay (up to 1,000 ms) whenever a program started or exited.
In src/server/server.zig:renderToDisplayClient(), automatic renaming evaluated foreground process inspection with a hardcoded time-based throttle:
if (win.last_foreground_name.len == 0 or
now - win.last_foreground_check_ms >= 1000)
processInput dispatched <Enter>. At that exact millisecond, the shell had not yet fork()ed and exec()ed the child program.getForegroundProcessName(), observed the shell (zsh), and stamped last_foreground_check_ms = now.vim) spawned ~10–50 ms later and began rendering, now - win.last_foreground_check_ms was only ~50 ms (< 1000 ms). The server skipped checking the foreground process.zsh for up to a full second after Vim had already taken over the screen.zsh was not reflected in the title until the 1,000 ms interval elapsed.Implemented instantaneous PGID-based state change detection:
last_foreground_pgid: i32 = -1 to Window.getForegroundPgid() and getProcessNameByPgid() to Pty using the lightweight tcgetpgrp(self.master) syscall (~0.5 µs).renderToDisplayClient(), whenever tcgetpgrp indicates that the foreground process group ID has changed (cur_pgid != win.last_foreground_pgid), the foreground process name is queried and applied instantly on that very frame (0 ms latency).cur_pgid == win.last_foreground_pgid, process name resolution is skipped until 500 ms expires, maintaining near-zero CPU usage.