Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent: Fix elicitation tool-call IDs (#64086)

Ben Brandtd89e9c2124b2
diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs
index 630c9c85df1..7afb710d2d7 100644
--- a/crates/agent/src/thread.rs
+++ b/crates/agent/src/thread.rs
@@ -6365,14 +6365,14 @@ impl ToolCallEventStream {
cx: &mut App,
) -> Task<Result<acp::CreateElicitationResponse>> {
let stream = self.stream.clone();
- let tool_use_id = self.tool_use_id.clone();
+ let tool_call_id = self.tool_call_id.clone();
cx.spawn(async move |_cx| {
let (response_tx, response_rx) = oneshot::channel();
if let Err(error) =
stream
.0
.unbounded_send(Ok(ThreadEvent::Elicitation(ElicitationRequest {
- tool_call_id: acp::ToolCallId::new(tool_use_id.to_string()),
+ tool_call_id,
message,
schema,
response: response_tx,
diff --git a/crates/agent/src/tools/ask_user_tool.rs b/crates/agent/src/tools/ask_user_tool.rs
index 50b3f2debc7..ef84fe3e954 100644
--- a/crates/agent/src/tools/ask_user_tool.rs
+++ b/crates/agent/src/tools/ask_user_tool.rs
@@ -234,6 +234,7 @@ mod tests {
#[gpui::test]
async fn test_ask_user_returns_selected_option(cx: &mut TestAppContext) {
let (event_stream, mut event_rx) = ToolCallEventStream::test();
+ let tool_call_id = event_stream.tool_call_id().clone();
let tool = Arc::new(AskUserTool);
let task = cx.update(|cx| {
tool.run(
@@ -248,6 +249,7 @@ mod tests {
});
let request = event_rx.expect_elicitation().await;
+ assert_eq!(request.tool_call_id, tool_call_id);
assert_eq!(request.message, "Which approach?");
assert!(request.schema.properties.contains_key(CHOICE_FIELD));
assert!(!request.schema.properties.contains_key(OTHER_FIELD));