agent: Remove display_description from edit tool (#55752)

We did not really use it in practice (we would only display it in the
tool card header until we received a path), so as is it just wastes
tokens. Therefore removing it.

Release Notes:

- agent: Reduce token usage when LLM edits file
This commit is contained in:
Bennet Bo Fenner authored and GitHub committed 2026-05-05 12:11:24 +00:00
1 parent d6cc34c167
commit 5eb6a465dc
3 files changed
+51 -263

No files matched your search

-3
View File
@@ -6061,7 +6061,6 @@ async fn test_edit_file_tool_deny_rule_blocks_edit(cx: &mut TestAppContext) {
let task = cx.update(|cx| {
tool.run(
ToolInput::resolved(crate::EditFileToolInput {
display_description: "Edit sensitive file".to_string(),
path: "root/sensitive_config.txt".into(),
mode: crate::EditFileMode::Edit,
content: None,
@@ -6496,7 +6495,6 @@ async fn test_edit_file_tool_allow_rule_skips_confirmation(cx: &mut TestAppConte
let _task = cx.update(|cx| {
tool.run(
ToolInput::resolved(crate::EditFileToolInput {
display_description: "Edit README".to_string(),
path: "root/README.md".into(),
mode: crate::EditFileMode::Edit,
content: None,
@@ -6569,7 +6567,6 @@ async fn test_edit_file_tool_allow_still_prompts_for_local_settings(cx: &mut Tes
let _task = cx.update(|cx| {
tool.run(
ToolInput::resolved(crate::EditFileToolInput {
display_description: "Edit local settings".to_string(),
path: "root/.zed/settings.json".into(),
mode: crate::EditFileMode::Edit,
content: None,
File diff suppressed because it is too large. Load diff
+4 -9
View File
@@ -381,7 +381,6 @@ pub fn collect_symlink_escapes<'a>(
pub fn authorize_file_edit(
tool_name: &str,
path: &Path,
display_description: &str,
thread: &WeakEntity<Thread>,
event_stream: &ToolCallEventStream,
cx: &mut App,
@@ -396,7 +395,7 @@ pub fn authorize_file_edit(
}
let path_owned = path.to_path_buf();
let display_description = display_description.to_string();
let title = format!("Edit {}", util::markdown::MarkdownInlineCode(&path_str));
let tool_name = tool_name.to_string();
let thread = thread.clone();
let event_stream = event_stream.clone();
@@ -486,7 +485,7 @@ pub fn authorize_file_edit(
vec![path_owned.to_string_lossy().to_string()],
);
event_stream.authorize_always_prompt(
format!("{} (local settings)", display_description),
format!("{title} (local settings)"),
context,
cx,
)
@@ -499,11 +498,7 @@ pub fn authorize_file_edit(
&tool_name,
vec![path_owned.to_string_lossy().to_string()],
);
event_stream.authorize_always_prompt(
format!("{} (settings)", display_description),
context,
cx,
)
event_stream.authorize_always_prompt(format!("{title} (settings)"), context, cx)
});
return authorize.await;
}
@@ -518,7 +513,7 @@ pub fn authorize_file_edit(
&tool_name,
vec![path_owned.to_string_lossy().to_string()],
);
event_stream.authorize(&display_description, context, cx)
event_stream.authorize(&title, context, cx)
});
authorize.await
}