From 4b60e639bc0c75c79f3b82134ae44a67ddd351a7 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Tue, 24 Mar 2026 14:16:10 +0100 Subject: [PATCH] agent: Remove priority from update_plan (#52320) ## Context We don't surface this in the UI, so removing it to make the input smaller. ## Self-Review Checklist - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A --- crates/agent/src/tests/mod.rs | 8 +- crates/agent/src/tools/update_plan_tool.rs | 88 +++------------------- 2 files changed, 13 insertions(+), 83 deletions(-) diff --git a/crates/agent/src/tests/mod.rs b/crates/agent/src/tests/mod.rs index 8a291a89e2f2a18b6180d288179406a8ba527d25..139591115eec569ea58520094886f77bd8efa785 100644 --- a/crates/agent/src/tests/mod.rs +++ b/crates/agent/src/tests/mod.rs @@ -3461,7 +3461,6 @@ async fn test_update_plan_tool_updates_thread_events(cx: &mut TestAppContext) { { "step": "Inspect the code", "status": "completed", - "priority": "high" }, { "step": "Implement the tool", @@ -3470,7 +3469,6 @@ async fn test_update_plan_tool_updates_thread_events(cx: &mut TestAppContext) { { "step": "Run tests", "status": "pending", - "priority": "low" } ] }); @@ -3497,7 +3495,6 @@ async fn test_update_plan_tool_updates_thread_events(cx: &mut TestAppContext) { { "step": "Inspect the code", "status": "completed", - "priority": "high" }, { "step": "Implement the tool", @@ -3506,7 +3503,6 @@ async fn test_update_plan_tool_updates_thread_events(cx: &mut TestAppContext) { { "step": "Run tests", "status": "pending", - "priority": "low" } ] })) @@ -3531,7 +3527,7 @@ async fn test_update_plan_tool_updates_thread_events(cx: &mut TestAppContext) { acp::Plan::new(vec![ acp::PlanEntry::new( "Inspect the code", - acp::PlanEntryPriority::High, + acp::PlanEntryPriority::Medium, acp::PlanEntryStatus::Completed, ), acp::PlanEntry::new( @@ -3541,7 +3537,7 @@ async fn test_update_plan_tool_updates_thread_events(cx: &mut TestAppContext) { ), acp::PlanEntry::new( "Run tests", - acp::PlanEntryPriority::Low, + acp::PlanEntryPriority::Medium, acp::PlanEntryStatus::Pending, ), ]) diff --git a/crates/agent/src/tools/update_plan_tool.rs b/crates/agent/src/tools/update_plan_tool.rs index 9fdc5a865dfb5cd2a18e3f24b3f7544b397588d3..8d45f8aad42a8cb10b3164212e1cde2b0104bdc2 100644 --- a/crates/agent/src/tools/update_plan_tool.rs +++ b/crates/agent/src/tools/update_plan_tool.rs @@ -27,45 +27,27 @@ impl From for acp::PlanEntryStatus { } } -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Default)] -#[serde(rename_all = "snake_case")] -#[schemars(inline)] -pub enum PlanEntryPriority { - High, - #[default] - Medium, - Low, -} - -impl From for acp::PlanEntryPriority { - fn from(value: PlanEntryPriority) -> Self { - match value { - PlanEntryPriority::High => acp::PlanEntryPriority::High, - PlanEntryPriority::Medium => acp::PlanEntryPriority::Medium, - PlanEntryPriority::Low => acp::PlanEntryPriority::Low, - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] pub struct PlanItem { /// Human-readable description of what this task aims to accomplish. pub step: String, /// The current status of this task. pub status: PlanEntryStatus, - /// The relative importance of this task. Defaults to medium when omitted. - #[serde(default)] - pub priority: PlanEntryPriority, } impl From for acp::PlanEntry { fn from(value: PlanItem) -> Self { - acp::PlanEntry::new(value.step, value.priority.into(), value.status.into()) + acp::PlanEntry::new( + value.step, + acp::PlanEntryPriority::Medium, + value.status.into(), + ) } } /// Updates the task plan. -/// Provide a list of plan entries, each with step, status, and optional priority. +/// +/// Provide a list of plan entries, each with a step and status. #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] pub struct UpdatePlanToolInput { /// The list of plan entries and their current statuses. @@ -144,17 +126,14 @@ mod tests { PlanItem { step: "Inspect the existing tool wiring".to_string(), status: PlanEntryStatus::Completed, - priority: PlanEntryPriority::High, }, PlanItem { step: "Implement the update_plan tool".to_string(), status: PlanEntryStatus::InProgress, - priority: PlanEntryPriority::Medium, }, PlanItem { step: "Add tests".to_string(), status: PlanEntryStatus::Pending, - priority: PlanEntryPriority::Low, }, ], } @@ -179,7 +158,7 @@ mod tests { acp::Plan::new(vec![ acp::PlanEntry::new( "Inspect the existing tool wiring", - acp::PlanEntryPriority::High, + acp::PlanEntryPriority::Medium, acp::PlanEntryStatus::Completed, ), acp::PlanEntry::new( @@ -189,7 +168,7 @@ mod tests { ), acp::PlanEntry::new( "Add tests", - acp::PlanEntryPriority::Low, + acp::PlanEntryPriority::Medium, acp::PlanEntryStatus::Pending, ), ]) @@ -214,7 +193,7 @@ mod tests { acp::Plan::new(vec![ acp::PlanEntry::new( "Inspect the existing tool wiring", - acp::PlanEntryPriority::High, + acp::PlanEntryPriority::Medium, acp::PlanEntryStatus::Completed, ), acp::PlanEntry::new( @@ -224,53 +203,8 @@ mod tests { ), acp::PlanEntry::new( "Add tests", - acp::PlanEntryPriority::Low, - acp::PlanEntryStatus::Pending, - ), - ]) - ); - } - - #[gpui::test] - async fn test_run_defaults_priority_to_medium(cx: &mut TestAppContext) { - let tool = Arc::new(UpdatePlanTool); - let (event_stream, mut event_rx) = ToolCallEventStream::test(); - - let input = UpdatePlanToolInput { - plan: vec![ - PlanItem { - step: "First".to_string(), - status: PlanEntryStatus::InProgress, - priority: PlanEntryPriority::default(), - }, - PlanItem { - step: "Second".to_string(), - status: PlanEntryStatus::InProgress, - priority: PlanEntryPriority::default(), - }, - ], - }; - - let result = cx - .update(|cx| tool.run(ToolInput::resolved(input), event_stream, cx)) - .await - .expect("tool should succeed"); - - assert_eq!(result, "Plan updated".to_string()); - - let plan = event_rx.expect_plan().await; - assert_eq!( - plan, - acp::Plan::new(vec![ - acp::PlanEntry::new( - "First", acp::PlanEntryPriority::Medium, - acp::PlanEntryStatus::InProgress, - ), - acp::PlanEntry::new( - "Second", - acp::PlanEntryPriority::Medium, - acp::PlanEntryStatus::InProgress, + acp::PlanEntryStatus::Pending, ), ]) );