From 3bce917af2f7ad133c0d4e00e359b94fe0b8fa32 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 22 Jul 2025 13:21:55 +0000 Subject: [PATCH] fix: remove special condition for update_todo_list tool - Remove exception that allowed update_todo_list to be called alongside other tools - Now all tools are limited to one per message without exceptions - Keeps the change that allows text after any tool use --- src/core/assistant-message/presentAssistantMessage.ts | 11 ++++------- src/core/task/Task.ts | 8 +------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index ca922df543..bd7729d001 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -235,9 +235,8 @@ export async function presentAssistantMessage(cline: Task) { break } - if (cline.didAlreadyUseTool && block.name !== "update_todo_list") { + if (cline.didAlreadyUseTool) { // Ignore any content after a tool has already been used. - // Exception: update_todo_list can be used multiple times cline.userMessageContent.push({ type: "text", text: `Tool [${block.name}] was not executed because a tool has already been used in this message. Only one tool may be used per message. You must assess the first tool's result before proceeding to use the next tool.`, @@ -257,10 +256,8 @@ export async function presentAssistantMessage(cline: Task) { // Once a tool result has been collected, ignore all other tool // uses since we should only ever present one tool result per - // message. Exception: update_todo_list can be used multiple times. - if (block.name !== "update_todo_list") { - cline.didAlreadyUseTool = true - } + // message. + cline.didAlreadyUseTool = true } const askApproval = async ( @@ -558,7 +555,7 @@ export async function presentAssistantMessage(cline: Task) { !block.partial || cline.didRejectTool || (cline.didAlreadyUseTool && block.type !== "tool_use") || - (cline.didAlreadyUseTool && block.type === "tool_use" && block.name !== "update_todo_list") + (cline.didAlreadyUseTool && block.type === "tool_use") ) { // Block is finished streaming and executing. if (cline.currentStreamingContentIndex === cline.assistantMessageContent.length - 1) { diff --git a/src/core/task/Task.ts b/src/core/task/Task.ts index 112b711629..53b8ef5b87 100644 --- a/src/core/task/Task.ts +++ b/src/core/task/Task.ts @@ -1427,13 +1427,7 @@ export class Task extends EventEmitter { // get generation details. // UPDATE: It's better UX to interrupt the request at the // cost of the API cost not being retrieved. - // Exception: update_todo_list can be used multiple times - // Check if any update_todo_list is being processed (partial or complete) - const hasUpdateTodoList = this.assistantMessageContent.some( - (block) => block.type === "tool_use" && block.name === "update_todo_list", - ) - - if (this.didAlreadyUseTool && !hasUpdateTodoList) { + if (this.didAlreadyUseTool) { assistantMessage += "\n\n[Response interrupted by a tool use result. Only one tool may be used at a time and should be placed at the end of the message.]" break