Skip to content

Commit 3bce917

Browse files
committed
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
1 parent d2c1a26 commit 3bce917

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@ export async function presentAssistantMessage(cline: Task) {
235235
break
236236
}
237237

238-
if (cline.didAlreadyUseTool && block.name !== "update_todo_list") {
238+
if (cline.didAlreadyUseTool) {
239239
// Ignore any content after a tool has already been used.
240-
// Exception: update_todo_list can be used multiple times
241240
cline.userMessageContent.push({
242241
type: "text",
243242
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) {
257256

258257
// Once a tool result has been collected, ignore all other tool
259258
// uses since we should only ever present one tool result per
260-
// message. Exception: update_todo_list can be used multiple times.
261-
if (block.name !== "update_todo_list") {
262-
cline.didAlreadyUseTool = true
263-
}
259+
// message.
260+
cline.didAlreadyUseTool = true
264261
}
265262

266263
const askApproval = async (
@@ -558,7 +555,7 @@ export async function presentAssistantMessage(cline: Task) {
558555
!block.partial ||
559556
cline.didRejectTool ||
560557
(cline.didAlreadyUseTool && block.type !== "tool_use") ||
561-
(cline.didAlreadyUseTool && block.type === "tool_use" && block.name !== "update_todo_list")
558+
(cline.didAlreadyUseTool && block.type === "tool_use")
562559
) {
563560
// Block is finished streaming and executing.
564561
if (cline.currentStreamingContentIndex === cline.assistantMessageContent.length - 1) {

src/core/task/Task.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,13 +1427,7 @@ export class Task extends EventEmitter<ClineEvents> {
14271427
// get generation details.
14281428
// UPDATE: It's better UX to interrupt the request at the
14291429
// cost of the API cost not being retrieved.
1430-
// Exception: update_todo_list can be used multiple times
1431-
// Check if any update_todo_list is being processed (partial or complete)
1432-
const hasUpdateTodoList = this.assistantMessageContent.some(
1433-
(block) => block.type === "tool_use" && block.name === "update_todo_list",
1434-
)
1435-
1436-
if (this.didAlreadyUseTool && !hasUpdateTodoList) {
1430+
if (this.didAlreadyUseTool) {
14371431
assistantMessage +=
14381432
"\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.]"
14391433
break

0 commit comments

Comments
 (0)