SerenaConfig: Rename gui_log_window_enabled to gui_log_window

This removes the discrepancy with the configuration file (where it was always gui_log_window)
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-01-19 18:33:43 +01:00
1 parent 4b64867a52
commit abef88c482
7 files changed
+14 -20

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ if __name__ == "__main__":
serena_config = SerenaConfig.from_config_file()
serena_config.log_level = logging.INFO
serena_config.gui_log_window_enabled = False
serena_config.gui_log_window = False
serena_config.web_dashboard = False
agent = SerenaAgent(str(project_path), serena_config=serena_config)
+2 -2
View File
@@ -216,7 +216,7 @@ class SerenaAgent:
# open GUI log window if enabled
self._gui_log_viewer: Optional["GuiLogViewer"] = None
if self.serena_config.gui_log_window_enabled:
if self.serena_config.gui_log_window:
log.info("Opening GUI window")
if platform.system() == "Darwin":
log.warning("GUI log window is not supported on macOS")
@@ -269,7 +269,7 @@ class SerenaAgent:
if (
self.serena_config.web_dashboard
and not self.serena_config.web_dashboard_open_on_launch
and not self.serena_config.gui_log_window_enabled
and not self.serena_config.gui_log_window
):
tool_inclusion_definitions.append(ToolInclusionDefinition(included_optional_tools=[OpenDashboardTool.get_name_from_cls()]))
tool_inclusion_definitions.append(self.serena_config)
+1 -1
View File
@@ -746,7 +746,7 @@ class ProjectCommands(AutoRegisteringGroup):
try:
# Create SerenaAgent with dashboard disabled
log.info("Creating SerenaAgent with disabled dashboard...")
config = SerenaConfig(gui_log_window_enabled=False, web_dashboard=False)
config = SerenaConfig(gui_log_window=False, web_dashboard=False)
agent = SerenaAgent(project=project_path, serena_config=config)
log.info("SerenaAgent created successfully")
+7 -13
View File
@@ -403,8 +403,10 @@ class SerenaConfig(ToolInclusionDefinition, ToStringMixin):
For testing purposes, it can also be instantiated directly with the desired parameters.
"""
# *** fields that are mapped directly to/from the configuration file (DO NOT RENAME) ***
projects: list[RegisteredProject] = field(default_factory=list)
gui_log_window_enabled: bool = False
gui_log_window: bool = False
log_level: int = logging.INFO
trace_lsp_communication: bool = False
web_dashboard: bool = True
@@ -446,12 +448,6 @@ class SerenaConfig(ToolInclusionDefinition, ToStringMixin):
# *** static members ***
CONFIG_FILE = "serena_config.yml"
CONFIG_FILE_RENAMED_KEYS = {
"gui_log_window_enabled": "gui_log_window",
}
"""
maps attributes to the keys used in the configuration file, in case they differ
"""
# *** methods ***
@@ -539,11 +535,10 @@ class SerenaConfig(ToolInclusionDefinition, ToStringMixin):
instance.projects.append(project)
def get_value_or_default(field_name: str) -> Any:
key = cls.CONFIG_FILE_RENAMED_KEYS.get(field_name, field_name)
nonlocal num_migrations
if key not in loaded_commented_yaml:
if field_name not in loaded_commented_yaml:
num_migrations += 1
return loaded_commented_yaml.get(key, get_dataclass_default(SerenaConfig, field_name))
return loaded_commented_yaml.get(field_name, get_dataclass_default(SerenaConfig, field_name))
# determine language backend
language_backend = get_dataclass_default(SerenaConfig, "language_backend")
@@ -560,7 +555,7 @@ class SerenaConfig(ToolInclusionDefinition, ToStringMixin):
instance.language_backend = language_backend
# set other configuration parameters (primitive types)
instance.gui_log_window_enabled = get_value_or_default("gui_log_window_enabled")
instance.gui_log_window = get_value_or_default("gui_log_window")
instance.web_dashboard_listen_address = get_value_or_default("web_dashboard_listen_address")
instance.log_level = loaded_commented_yaml.get("log_level", loaded_commented_yaml.get("gui_log_level", logging.INFO))
instance.web_dashboard = get_value_or_default("web_dashboard")
@@ -690,8 +685,7 @@ class SerenaConfig(ToolInclusionDefinition, ToStringMixin):
field_name = field_info.name
if field_name in ["projects", "language_backend"] or field_name.startswith("_"):
continue
yaml_key = SerenaConfig.CONFIG_FILE_RENAMED_KEYS.get(field_name, field_name)
loaded_original_yaml[yaml_key] = getattr(self, field_name)
loaded_original_yaml[field_name] = getattr(self, field_name)
# convert project objects into list of paths
loaded_original_yaml["projects"] = sorted({str(project.project_root) for project in self.projects})
+1 -1
View File
@@ -305,7 +305,7 @@ class SerenaMCPFactory:
if enable_web_dashboard is not None:
config.web_dashboard = enable_web_dashboard
if enable_gui_log_window is not None:
config.gui_log_window_enabled = enable_gui_log_window
config.gui_log_window = enable_gui_log_window
if open_web_dashboard is not None:
config.web_dashboard_open_on_launch = open_web_dashboard
if log_level is not None:
+1 -1
View File
@@ -55,7 +55,7 @@ def serena_config():
)
test_projects.append(RegisteredProject.from_project_instance(project))
config = SerenaConfig(gui_log_window_enabled=False, web_dashboard=False, log_level=logging.ERROR)
config = SerenaConfig(gui_log_window=False, web_dashboard=False, log_level=logging.ERROR)
config.projects = test_projects
return config
+1 -1
View File
@@ -13,7 +13,7 @@ def test_all_tool_parameters_have_type(context):
For every tool exposed by Serena, ensure that the generated
Open‑AI schema contains a ``type`` entry for each parameter.
"""
cfg = SerenaConfig(gui_log_window_enabled=False, web_dashboard=False, log_level=logging.ERROR)
cfg = SerenaConfig(gui_log_window=False, web_dashboard=False, log_level=logging.ERROR)
registry = ToolRegistry()
cfg.included_optional_tools = tuple(registry.get_tool_names_optional())
factory = SerenaMCPFactory(context=context)