From 43ae0211d7f3bba4101cd0552707fa21d37f4c84 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Sun, 30 Aug 2026 17:37:14 +0200 Subject: [PATCH] Fix: `read_only` restriction in project definition was not applied to base tool set when in single-project context Fixes #1938 --- CHANGELOG.md | 1 + src/serena/agent.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a50473..e60a96fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Status of the `main` branch. Changes prior to the next official version change w * General: - Fix: Parallel agents auto-registering projects could overwrite each other's changes to the global project list in `serena_config.yml` + - Fix: `read_only` restriction in project definition was not applied to base tool set when in single-project context (#1938) * Language Servers: - Fix: Dart's `$/analyzerStatus` notifications were logged as unhandled-method warnings during analysis (#1855) diff --git a/src/serena/agent.py b/src/serena/agent.py index 175f338b..4a2d843f 100644 --- a/src/serena/agent.py +++ b/src/serena/agent.py @@ -794,6 +794,7 @@ class SerenaAgent: # of tools that will be exposed to the client. # Furthermore, we disable tools that are only relevant for project activation. # So if the project exists, we apply all the aforementioned exclusions. + apply_read_only = False if is_single_project: assert project is not None log.info( @@ -807,9 +808,12 @@ class SerenaAgent: ) ) tool_inclusion_definitions.append(project.project_config) + apply_read_only = project.project_config.read_only # compute the resulting tool set base_toolset = ToolSet.default().apply(*tool_inclusion_definitions) + if apply_read_only: + base_toolset = base_toolset.without_editing_tools() log.info(f"Number of exposed tools: {len(base_toolset)}") return base_toolset