Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented Sep 3, 2025

Important

This PR adds subtask lifecycle events and updates task management to handle subtasks, including pausing, unpausing, and spawning, with corresponding tests and metadata updates.

  • Behavior:
    • Adds subtask events TaskPaused, TaskUnpaused, and TaskSpawned to ExtensionChannel.ts and ClineProvider.ts.
    • Updates Task class in Task.ts to handle subtask lifecycle: pausing, unpausing, and spawning.
    • Modifies taskMetadata.ts to include parentTaskId and childTaskId in task metadata.
  • Testing:
    • Updates tests in newTaskTool.spec.ts to mock and verify subtask creation and lifecycle events.
  • Misc:
    • Bumps version in package.metadata.json from 1.67.0 to 1.69.0.

This description was created by Ellipsis for 67ae088. You can customize this summary. It will automatically update as commits are pushed.

@cte cte requested review from jr and mrubens as code owners September 3, 2025 10:47
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Sep 3, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found that the implementation is solid overall. The refactoring from createTask to startSubtask is clean and maintains good backward compatibility.

Review Findings:

Important Suggestions:

  1. Potential race condition in Task.ts completeSubtask() - The method sets isPaused = false and childTaskId = undefined before emitting the TaskUnpaused event. If there's an error during the say() or addToApiConversationHistory() calls, the task state could be left inconsistent. Consider moving the state updates after the operations that could fail.

  2. Missing error handling in newTaskTool.ts - The startSubtask call could fail with thrown errors. While the function returns null on expected failures which is handled, any thrown errors would bubble up unhandled. Consider wrapping in try-catch.

Minor Improvements:

  1. Test coverage - The test file changes show good coverage for the newTaskTool refactoring, but consider adding specific tests for the new subtask event emissions (TaskPaused, TaskUnpaused, TaskSpawned) to verify they're emitted at the right times.

  2. Documentation - The new parentTaskId and childTaskId fields in the task metadata could benefit from JSDoc comments explaining their purpose and lifecycle.

  3. Magic number - In Task.ts startSubtask(), there's a hardcoded 500ms delay. Consider extracting this to a named constant like MODE_SWITCH_DELAY_MS for better maintainability.

Positive observations:

  • Clean refactoring pattern
  • Good backward compatibility
  • Proper event emission patterns
  • Comprehensive test updates

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 3, 2025
@cte cte merged commit 43ff486 into main Sep 3, 2025
13 checks passed
@cte cte deleted the cte/publish-subtask-events branch September 3, 2025 11:05
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 3, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants