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
This commit is contained in:
Roo Code 2025-07-22 13:21:55 +00:00
parent d2c1a2655c
commit 3bce917af2
2 changed files with 5 additions and 14 deletions

View file

@ -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) {

View file

@ -1427,13 +1427,7 @@ export class Task extends EventEmitter<ClineEvents> {
// 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