06ab7343cfa9ad6e91085cb7fe2ad12378d0a7af
--throwaway-sessions, on by default in a debug build. Every session a server started with it spawns is marked throwaway in the config, and a marked session's process is stopped when the server exits or is signalled, rather than left running for the next start to adopt. Leaving processes running is the design and it is right for the sessions somebody is using. It is exactly wrong for the ones a test made: those leave a claude behind that every later server adopts, and nothing ever says they are there -- twelve accumulated on this machine in a day, each holding a conversation open. The flag marks; the mark decides. What a server was told at startup governs only the sessions it spawns, and the mark is the session's own, so a session spawned deliberately keeps running whichever server is up when one exits, and a throwaway one is cleaned away even by a server started without the flag. process::wait_gone does the waiting on the way out, because process::stop leaves its SIGKILL on a tokio timer and a runtime that is shutting down never runs it -- which is how the original shutdown_all leaked the processes it reported stopping. Its test found a second thing, in the same field the last commit was about: a zombie read as Alive. /proc/<pid>/stat keeps the entry, with the same pid and the same start time, until the exit status is collected, so a process that had plainly finished answered "still there" -- and Alive is the word that makes Exited unsayable, so the session shows unknown, its Start button never appears, and Stop says there is nothing to stop. stat_of reads the state field alongside the start time now. Exercised against a real server: a keeper spawned with the flag off survives its server's exit and is adopted by the next one, a session spawned with it on is stopped on SIGTERM within 20ms, and the "left N running" line counts what is actually still out there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Languages
Rust
54%
Kotlin
43.6%
Shell
2.4%