-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix: Restore parent task references for subtasks after VS Code restart #9039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When VS Code is closed during a subtask execution and then restarted, the subtask now properly restores its parent task reference from the persisted history. This ensures that when the subtask completes, it can report its final state back to the parent task. The implementation: - Restores parent task reference from history when resuming a subtask - Recursively restores parent tasks if they are not already in the task stack - Maintains the parent-child relationship across VS Code sessions - Ensures subtask completion properly reports back to parent after restart Fixes #9038
|
All issues have been resolved. The latest commit successfully prevents parent tasks from auto-starting during recursive restoration.
Mention @roomote in a comment to trigger your PR Fixer agent and make changes to this pull request. |
src/core/webview/ClineProvider.ts
Outdated
| const { historyItem: parentHistoryItem } = await this.getTaskWithId(historyItem.parentTaskId) | ||
| // Recursively restore parent task (which may have its own parent) | ||
| restoredParentTask = await this.createTaskWithHistoryItem(parentHistoryItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recursively restored parent tasks will automatically start execution, which interferes with the child task. When createTaskWithHistoryItem is called recursively at line 922, it creates a new Task instance that defaults to startTask: true. This causes the parent's resumeTaskFromHistory() to be invoked, starting its task loop. The parent should only exist in memory for reference - not actively run. Pass startTask: false when constructing the Task for recursive parent restoration to prevent this.
Fix it with Roo Code or mention @roomote and request a fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@roomote fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…tion When restoring subtasks after VS Code restart, parent tasks were being recursively restored but inadvertently started execution due to missing startTask parameter. This caused parent tasks to interfere with child task execution. Solution: - Added optional startTask parameter to createTaskWithHistoryItem (defaults to true) - Pass startTask: false when recursively restoring parent tasks - Parent tasks now exist in memory for reference only without starting execution This ensures subtasks can properly complete and report back to parent tasks after VS Code restarts.
This PR addresses Issue #9038 where subtasks were unable to report their final state back to parent agents after VS Code was closed and restarted during execution.
Problem
When VS Code was closed while a subtask was running, the parent-child relationship was lost upon restart. This prevented subtasks from properly reporting their completion status back to their parent tasks.
Solution
The implementation restores parent task references when resuming tasks from history after a VS Code restart:
Changes
createTaskWithHistoryItemmethod insrc/core/webview/ClineProvider.tsto restore parent-child relationshipsTesting
Fixes #9038
cc @bozoweed
Important
Restores parent task references for subtasks after VS Code restart in
ClineProvider.ts, ensuring proper task hierarchy restoration.createTaskWithHistoryItem()inClineProvider.ts.This description was created by
for b3f421b. You can customize this summary. It will automatically update as commits are pushed.