mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-08 22:21:23 +00:00
Fixes #4881: Preserve subtask completion state during task resumption
- Modified task resumption logic in Task.ts to detect completed subtasks - Added check for finishTask tool completion when determining resume type - Ensures completed subtasks show 'Start New Task' button instead of 'Resume Task' - Prevents unnecessary re-execution of completed subtasks and token costs
This commit is contained in:
parent
2e2f83be60
commit
ee812fb377
1 changed files with 21 additions and 1 deletions
|
|
@ -812,7 +812,27 @@ export class Task extends EventEmitter<ClineEvents> {
|
|||
if (lastClineMessage?.ask === "completion_result") {
|
||||
askType = "resume_completed_task"
|
||||
} else {
|
||||
askType = "resume_task"
|
||||
// Check if this is a completed subtask by looking for finishTask tool completion
|
||||
const isCompletedSubtask = this.clineMessages
|
||||
.slice()
|
||||
.reverse()
|
||||
.some((m) => {
|
||||
if (m.type === "ask" && m.ask === "tool" && m.text) {
|
||||
try {
|
||||
const tool = JSON.parse(m.text)
|
||||
return tool.tool === "finishTask"
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
if (isCompletedSubtask && this.parentTask) {
|
||||
askType = "resume_completed_task"
|
||||
} else {
|
||||
askType = "resume_task"
|
||||
}
|
||||
}
|
||||
|
||||
this.isInitialized = true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue