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

Use the native tool call's scoped ID for elicitation requests instead of
constructing an ID from the raw provider-issued tool-use ID. This keeps
`ask_user` forms associated with the correct conversation entry,
including when providers reuse raw IDs.

Release Notes:

- N/A
This commit is contained in:
Ben Brandt authored and GitHub committed 2026-09-14 09:34:39 +00:00
1 parent b311a148c7
commit 2849ef4125
2 files changed
+4 -2

No files matched your search

+2 -2
View File
@@ -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,
+2
View File
@@ -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));