fix: kill agent-spawned bash trees and dev servers on dashboard shutdown

TUI quit ('q'/Ctrl+C) bypassed signal handlers via process.exit(0), and
neither shutdown path closed the HTTP server, so server.close()'s
stopAllDevServers() listener never ran. In-flight agent bash commands
(spawned detached for their own pgroup) were also never aborted, so
their subprocess trees — including vitest workers — survived as orphans.

Route the TUI quit through SIGINT so the registered shutdown handler
runs, await stopAllDevServers() in both shutdown paths, and abort
in-flight bash on every active agent session at the start of the
runtime drain so killProcessTree reaches every grandchild.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-25 14:13:30 -07:00
parent e8aab69c67
commit 55cef71b8f
6 changed files with 109 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
export { createServer, loadTlsCredentialsFromEnv, type ServerOptions } from "./server.js";
export { stopAllDevServers, destroyAllDevServerManagers, getActiveProcessManagers } from "./dev-server-routes.js";
export {
createRuntimeLogger,
getRuntimeLogSink,