From c6cec29f637d99dde47b54cf86a2991867d7ef4b Mon Sep 17 00:00:00 2001 From: Hu Qiantao Date: Sun, 31 May 2026 12:18:31 +0800 Subject: [PATCH] fix: remove double-registration of shell tools in engine builder The second feature-flag gate in tool_setup.rs was calling with_shell_tools() again when allow_shell was already true, causing duplicate tool registration. Remove the redundant gate since with_agent_tools() already handles the allow_shell check. Also add task_shell_wait to MODES.md alongside task_shell_start. --- crates/tui/src/core/engine/tool_setup.rs | 11 +++-------- docs/MODES.md | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/tui/src/core/engine/tool_setup.rs b/crates/tui/src/core/engine/tool_setup.rs index fb56641a..b6867d0e 100644 --- a/crates/tui/src/core/engine/tool_setup.rs +++ b/crates/tui/src/core/engine/tool_setup.rs @@ -79,14 +79,9 @@ impl Engine { if self.config.features.enabled(Feature::WebSearch) { builder = builder.with_web_tools(); } - // Plan mode is strictly read-only: do not expose shell execution at - // all, even if the session would otherwise allow it. - if mode != AppMode::Plan - && self.config.features.enabled(Feature::ShellTool) - && self.session.allow_shell - { - builder = builder.with_shell_tools().with_runtime_task_shell_tools(); - } + // Shell tools (exec_shell, task_shell_start, etc.) are already gated + // behind `allow_shell` inside `with_agent_tools`. No separate + // feature-flag gate here to avoid double-registration. // Register the `remember` tool only when the user has opted in to // user-memory (#489). Without that opt-in the tool would always diff --git a/docs/MODES.md b/docs/MODES.md index 289f6c51..1a2763d9 100644 --- a/docs/MODES.md +++ b/docs/MODES.md @@ -19,7 +19,7 @@ Run `/mode` to open the mode picker, or switch directly with `/mode agent`, `/mode plan`, `/mode yolo`, `/mode 1`, `/mode 2`, or `/mode 3`. - **Plan**: design-first prompting. Read-only investigation tools stay available; shell and patch execution stay off. Use this when you want to think out loud and produce a plan to hand to a human (yourself later, or a reviewer). -- **Agent**: multi-step tool use. Shell execution (`exec_shell`, `task_shell_start`) requires `allow_shell = true` in config; approval prompts gate each call. File writes are allowed without a prompt. +- **Agent**: multi-step tool use. Shell execution (`exec_shell`, `task_shell_start`, `task_shell_wait`) requires `allow_shell = true` in config; approval prompts gate each call. File writes are allowed without a prompt. - **YOLO**: enables shell + trust mode and auto-approves all tools. Use only in trusted repos. All action-capable modes have access to persistent RLM sessions through `rlm_open`, `rlm_eval`, `rlm_configure`, and `rlm_close`. Inside an RLM Python REPL, `sub_query_batch` fans out 1-16 cheap parallel child calls pinned to `deepseek-v4-flash`. The model reaches for it when work is too large or repetitive for the parent transcript.