From 0a32aa8db1c4bbd4ae8977b0923ece0f32537074 Mon Sep 17 00:00:00 2001 From: Umesh Yadav <23421535+imumesh18@users.noreply.github.com> Date: Sat, 30 Aug 2025 20:12:15 +0530 Subject: [PATCH] language_models: Fix GitHub Copilot thread summary by removing unnecessary noop tool logic (#37152) Closes #37025 This PR fixes GitHub Copilot thread summary failures by removing the unnecessary `noop` tool insertion logic. The code was originally added as a workaround in https://github.com/zed-industries/zed/pull/30007 for supposed GitHub Copilot API issues when tools were used previously in a conversation but no tools are provided in the current request. However, testing revealed that this scenario works fine without the workaround, and the `noop` tool insertion was actually causing "Invalid schema for function 'noop'" errors that prevented thread summarization from working. Removing this logic eliminates the errors and allows thread summarization to function correctly with GitHub Copilot models. The best way to see if removing that part of code works is just triggering thread summarisation. Error Log: ``` 2025-08-27T13:47:50-04:00 ERROR [workspace::notifications] "Failed to connect to API: 400 Bad Request {"error":{"message":"Invalid schema for function 'noop': In context=(), object schema missing properties.","code":"invalid_function_parameters"}}\n" ``` Release Notes: - Fixed GitHub Copilot thread summary failures by removing unnecessary noop tool insertion logic. --- .../src/provider/copilot_chat.rs | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/crates/language_models/src/provider/copilot_chat.rs b/crates/language_models/src/provider/copilot_chat.rs index eb12c0056f871a4d9eb053c51455081572868aef..d48c12aa4b5de713c0130320f7c9e61a733dc33e 100644 --- a/crates/language_models/src/provider/copilot_chat.rs +++ b/crates/language_models/src/provider/copilot_chat.rs @@ -475,7 +475,6 @@ fn into_copilot_chat( } } - let mut tool_called = false; let mut messages: Vec = Vec::new(); for message in request_messages { match message.role { @@ -545,7 +544,6 @@ fn into_copilot_chat( let mut tool_calls = Vec::new(); for content in &message.content { if let MessageContent::ToolUse(tool_use) = content { - tool_called = true; tool_calls.push(ToolCall { id: tool_use.id.to_string(), content: copilot::copilot_chat::ToolCallContent::Function { @@ -590,7 +588,7 @@ fn into_copilot_chat( } } - let mut tools = request + let tools = request .tools .iter() .map(|tool| Tool::Function { @@ -602,22 +600,6 @@ fn into_copilot_chat( }) .collect::>(); - // The API will return a Bad Request (with no error message) when tools - // were used previously in the conversation but no tools are provided as - // part of this request. Inserting a dummy tool seems to circumvent this - // error. - if tool_called && tools.is_empty() { - tools.push(Tool::Function { - function: copilot::copilot_chat::Function { - name: "noop".to_string(), - description: "No operation".to_string(), - parameters: serde_json::json!({ - "type": "object" - }), - }, - }); - } - Ok(CopilotChatRequest { intent: true, n: 1,