Fix manual shutdown triggered by GUI tool/dashboard not cleaning everything up.

Subprocesses were not cleaned up, in particular.

* Rename SerenaAgent.shutdown to on_shutdown, because it is really a shutdown handler;
  it did not perform a shutdown.
* Add new method shutdown which is now called from both sites (and which performs
  the full shutdown)
* Manage the process instance used for the dashboard viewer and shut it down
  explicitly.
* Initialise all variables used during shutdown immeditaly (avoiding errors when
  shutdown is triggered during init)
This commit is contained in:
Dominik Jain committed 2026-04-06 16:04:51 +02:00
1 parent dcc49f19f9
commit cda321e318
9 files changed
+51 -48

No files matched your search

+2 -2
View File
@@ -178,7 +178,7 @@ if __name__ == "__main__":
run_lsp_tools(lsp_agent)
run_backend_independent_tools(lsp_agent)
finally:
lsp_agent.shutdown()
lsp_agent.on_shutdown()
# JetBrains backend (requires a running IDE)
try:
@@ -186,6 +186,6 @@ if __name__ == "__main__":
try:
run_jb_tools(jb_agent)
finally:
jb_agent.shutdown()
jb_agent.on_shutdown()
except Exception as e:
print(f"\nJetBrains backend not available, skipping: {e}")