diff --git a/CHANGELOG.md b/CHANGELOG.md index a1f6990f..8f87f31d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -116,8 +116,12 @@ Status of the `main` branch. Changes prior to the next official version change w * Dashboard: - Fix: Serena PyPI version check triggered by callback on main thread could delay agent startup #1774 - - Fix: on macOS, the `tray_manager` interface put an icon in the Dock and in the app switcher - (should only use menu bar icon) + - Improvements in `tray_manager` interface mode: + - Fix: on macOS, the `tray_manager` interface put an icon in the Dock and in the app switcher + (should only use menu bar icon) + - On Serena shutdown, message the tray manager before lengthy project shutdowns + - Fix: When dead ports are detected (Serena instance gone), explicitly update the tray menu + immediately (may not update automatically) - Use `tray_manager` interface as new default on macOS * Hooks: diff --git a/src/serena/agent.py b/src/serena/agent.py index 898bfcab..175f338b 100644 --- a/src/serena/agent.py +++ b/src/serena/agent.py @@ -1472,10 +1472,7 @@ class SerenaAgent: Shutdown handler of the agent, freeing resources and stopping background tasks. """ log.info("SerenaAgent is shutting down ...") - if self._active_project is not None: - log.info(f"Shutting down active project '{self._active_project.project_name}' ...") - self._active_project.shutdown(timeout=timeout) - self._active_project = None + # apply shutdown depending on allocated resources, handling quick ones first (dashboard manager & GUI viewer) if self._gui_log_viewer: log.info("Stopping the GUI log window ...") self._gui_log_viewer.stop() @@ -1483,6 +1480,10 @@ class SerenaAgent: if self._dashboard_manager: self._dashboard_manager.shutdown() self._dashboard_manager = None + if self._active_project is not None: + log.info(f"Shutting down active project '{self._active_project.project_name}' ...") + self._active_project.shutdown(timeout=timeout) + self._active_project = None def shutdown(self) -> None: """ diff --git a/src/serena/dashboard.py b/src/serena/dashboard.py index b92fcb51..1a1718a2 100644 --- a/src/serena/dashboard.py +++ b/src/serena/dashboard.py @@ -1155,6 +1155,7 @@ class SerenaDashboardTrayManager: for port in dead_ports: self._instances.pop(port, None) log.info("Removed unreachable instance on port %d", port) + self._update_menu() # terminate if no instances remain with self._lock: