From df0c10fa1af51b20cb810b7132874a27bb8871f6 Mon Sep 17 00:00:00 2001 From: Michael Panchenko Date: Thu, 29 Jan 2026 12:50:56 +0700 Subject: [PATCH] Minor: declare mode-related fields instead of setting them The fields _active_modes and _active_tools were overwritten directly after having been set, this is no longer the case --- src/serena/agent.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/serena/agent.py b/src/serena/agent.py index 18e71d5c..a4b21978 100644 --- a/src/serena/agent.py +++ b/src/serena/agent.py @@ -332,11 +332,6 @@ class SerenaAgent: self.prompt_factory = SerenaPromptFactory() self._project_activation_callback = project_activation_callback - # initialize members for modes and tools - self._mode_overrides = modes - self._active_modes = ActiveModes() - self._active_tools: AvailableTools = self._exposed_tools - # activate a project configuration (if provided or if there is only a single project available) if project is not None: try: @@ -345,6 +340,10 @@ class SerenaAgent: log.error(f"Error activating project '{project}' at startup: {e}", exc_info=e) # update active modes and active tools (considering the active project, if any) + # declared attributes are set in the call to _update_active_modes_and_tools() + self._mode_overrides = modes + self._active_modes: ActiveModes + self._active_tools: AvailableTools self._update_active_modes_and_tools() # start the dashboard (web frontend), registering its log handler