szn

Bug 407 — Zero-window sessions are permanently bricked; bare kill-session destroys every session, contradicting its own description

407. Zero-window sessions are permanently bricked; bare kill-session destroys every session, contradicting its own description

Severity: MEDIUM Status: ✅ RESOLVED

cmdKillWindow happily kills the last window; Session.killWindow then leaves active_window = null (session.zig:112-116). Every recovery command — including cmdNewWindow — begins const window = session.active_window orelse return .err (cmd.zig:92, which also derefs the old active pane for cwd at :93). Result: the attached client shows an empty session, every command errors, and there is no way back except exit. (The kill-pane path proves the intended policy: destroyPane tears down the session when the last pane dies.)

Separately, cmdKillSession with no argument calls server.killAllSessions() (cmd.zig:55-61) while the command table description says “the active session if no name given” (cmd.zig:1193) — a bare kill-session nukes every session on the server.

Fix: refuse to kill the last window (or destroy the session deliberately); make cmdKillSession target the active session when unnamed.