From f4ffd8f2d9d4c64846fa707d8fd31b7cfdc413d2 Mon Sep 17 00:00:00 2001 From: Bennet Bo Fenner Date: Tue, 3 Mar 2026 10:03:15 +0100 Subject: [PATCH] Fix deserialization issue with `StreamingEditFileTool` --- crates/agent/src/thread.rs | 45 +++++++------------ .../src/tools/streaming_edit_file_tool.rs | 2 +- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index c5ca1118ace28b66d555d67aa40c718da292f644..f7acd6d660c826ca8710e2fa923be861272b270c 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -1424,17 +1424,20 @@ impl Thread { self.action_log.clone(), )); self.add_tool(DiagnosticsTool::new(self.project.clone())); - self.add_tool(EditFileTool::new( - self.project.clone(), - cx.weak_entity(), - language_registry.clone(), - Templates::new(), - )); - self.add_tool(StreamingEditFileTool::new( - self.project.clone(), - cx.weak_entity(), - language_registry, - )); + if cx.has_flag::() { + self.add_tool(StreamingEditFileTool::new( + self.project.clone(), + cx.weak_entity(), + language_registry, + )); + } else { + self.add_tool(EditFileTool::new( + self.project.clone(), + cx.weak_entity(), + language_registry.clone(), + Templates::new(), + )); + } self.add_tool(FetchTool::new(self.project.read(cx).client().http_client())); self.add_tool(FindPathTool::new(self.project.clone())); self.add_tool(GrepTool::new(self.project.clone())); @@ -2609,30 +2612,14 @@ impl Thread { } } - let use_streaming_edit_tool = cx.has_flag::(); - let mut tools = self .tools .iter() .filter_map(|(tool_name, tool)| { - // For streaming_edit_file, check profile against "edit_file" since that's what users configure - let profile_tool_name = if tool_name == StreamingEditFileTool::NAME { - EditFileTool::NAME - } else { - tool_name.as_ref() - }; - if tool.supports_provider(&model.provider_id()) - && profile.is_tool_enabled(profile_tool_name) + && profile.is_tool_enabled(tool_name) { - match (tool_name.as_ref(), use_streaming_edit_tool) { - (StreamingEditFileTool::NAME, false) | (EditFileTool::NAME, true) => None, - (StreamingEditFileTool::NAME, true) => { - // Expose streaming tool as "edit_file" - Some((SharedString::from(EditFileTool::NAME), tool.clone())) - } - _ => Some((truncate(tool_name), tool.clone())), - } + Some((truncate(tool_name), tool.clone())) } else { None } diff --git a/crates/agent/src/tools/streaming_edit_file_tool.rs b/crates/agent/src/tools/streaming_edit_file_tool.rs index 7e023d7d7e00c2eb13ea78467776816b13151796..cf1d136acf368f524488fd8185aaf3220619e575 100644 --- a/crates/agent/src/tools/streaming_edit_file_tool.rs +++ b/crates/agent/src/tools/streaming_edit_file_tool.rs @@ -239,7 +239,7 @@ impl AgentTool for StreamingEditFileTool { type Input = StreamingEditFileToolInput; type Output = StreamingEditFileToolOutput; - const NAME: &'static str = "streaming_edit_file"; + const NAME: &'static str = "edit_file"; fn supports_input_streaming() -> bool { true