From 0de0f7783af0691bb7b277ee9e62fce9d30eddc1 Mon Sep 17 00:00:00 2001 From: shuki Date: Fri, 6 Mar 2026 20:38:03 +0200 Subject: [PATCH] Don't kill running jobs on TUI exit Previously action_quit() killed all running jobs before exiting, making it impossible to reconnect to them on restart. Now shows a confirmation dialog when jobs are running and lets them continue in the background. Co-Authored-By: Claude Opus 4.6 --- tui/app.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tui/app.py b/tui/app.py index 98add18..d28c246 100644 --- a/tui/app.py +++ b/tui/app.py @@ -58,5 +58,19 @@ class GnizaApp(App): self.notify(f"{job.label} failed (exit code {message.return_code})", severity="error") async def action_quit(self) -> None: - job_manager.kill_running() + if job_manager.running_count() > 0: + from tui.widgets import ConfirmDialog + self.push_screen( + ConfirmDialog( + f"{job_manager.running_count()} job(s) still running.\nQuit and let them continue in background?", + "Confirm Quit", + ), + callback=lambda ok: self._do_quit(kill=False) if ok else None, + ) + else: + self.exit() + + def _do_quit(self, kill: bool = False) -> None: + if kill: + job_manager.kill_running() self.exit()