mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: ensure todo tool respects approve/reject flow
- Clear approvedTodoList on rejection to prevent stale state - Clear approvedTodoList after processing to avoid persistence - Fixes issue where todo list was updated even when user rejected Fixes #9705
This commit is contained in:
parent
4591e960ed
commit
72bd98f05a
1 changed files with 8 additions and 1 deletions
|
|
@ -59,15 +59,19 @@ export class UpdateTodoListTool extends BaseTool<"update_todo_list"> {
|
|||
todos: normalizedTodos,
|
||||
})
|
||||
|
||||
approvedTodoList = cloneDeep(normalizedTodos)
|
||||
const didApprove = await askApproval("tool", approvalMsg)
|
||||
if (!didApprove) {
|
||||
// Clear approvedTodoList on rejection to prevent stale state
|
||||
approvedTodoList = undefined
|
||||
pushToolResult("User declined to update the todoList.")
|
||||
return
|
||||
}
|
||||
|
||||
// Check if user edited the todos during approval
|
||||
const isTodoListChanged =
|
||||
approvedTodoList !== undefined && JSON.stringify(normalizedTodos) !== JSON.stringify(approvedTodoList)
|
||||
|
||||
// If user edited the todos, use the edited version
|
||||
if (isTodoListChanged) {
|
||||
normalizedTodos = approvedTodoList ?? []
|
||||
task.say(
|
||||
|
|
@ -79,6 +83,9 @@ export class UpdateTodoListTool extends BaseTool<"update_todo_list"> {
|
|||
)
|
||||
}
|
||||
|
||||
// Clear approvedTodoList after processing to prevent stale state
|
||||
approvedTodoList = undefined
|
||||
|
||||
await setTodoListForTask(task, normalizedTodos)
|
||||
|
||||
if (isTodoListChanged) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue