Skip to content

Conversation

liwilliam2021
Copy link

@liwilliam2021 liwilliam2021 commented Aug 15, 2025

This PR for cloud walkaway introduces task lifecycle, mode-handling, and tooling improvements across the extension: core types in packages/types/src/task.ts were extended and hardened, the main task implementation in src/core/task/Task.ts adds robust async mode initialization (taskMode/taskModeReady/getTaskMode/waitForModeInitialization), safer workspace-path initialization, stronger dispose/abort logic that removes listeners and releases resources, background collection of API usage tokens and persistence of GPT‑5 per-turn metadata, and submitUserMessage now accepts/apply a provided mode_slug before sending. A new vector-backed code search tool was added at src/core/tools/codebaseSearchTool.ts which validates parameters, queries the CodeIndexManager, sends structured results to the UI, and returns a readable output to the agent. The webview provider in src/core/webview/ClineProvider.ts improves lifecycle and memory management (tracking/removing task listeners with a WeakMap, clearer dispose flow), applies bridge-provided mode_slug when creating tasks, and wires code-index status subscriptions and state merging helpers. Finally, the extension API in src/extension/api.ts now tracks running tasks in a taskMap, broadcasts task events over IPC and file logs, supports starting tasks with a mode_slug, and uses the taskMap when cancelling tasks.


Important

Enhance task lifecycle and mode handling in the cloud walkaway extension, adding modeSlug support, a new code search tool, and updating the extension API for improved task management.

  • Task Lifecycle and Mode Handling:
    • Extend CreateTaskOptions in task.ts to include modeSlug and other options.
    • Add modeSlug handling in createTask() and submitUserMessage() in Task.ts.
    • Implement mode switching logic in ClineProvider.ts using handleModeSwitch().
    • Update createTask() in ClineProvider.ts to apply modeSlug from bridge options.
  • Tooling Improvements:
    • Add codebaseSearchTool.ts for vector-backed code search.
    • Enhance ClineProvider.ts for better lifecycle and memory management.
  • Extension API Updates:
    • Update api.ts to track tasks in taskMap and support modeSlug in startNewTask().
    • Broadcast task events over IPC and file logs.
  • Miscellaneous:
    • Minor refactoring and logging improvements across several files.

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

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 15, 2025
Copy link

@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.

Comprehensive Review of PR #7119: feat: add modes to walkaway

After thoroughly reviewing the code changes, I'm approving this PR with some suggestions for improvement.

Summary of Changes Reviewed

This PR introduces significant improvements to task lifecycle management, mode handling, and tooling:

  1. Task Lifecycle Enhancements: Added async mode initialization with proper state management
  2. Mode Handling: Support for mode_slug parameter from cloud bridge and API
  3. Critical Bug Fix: Fixed workspace path initialization order to prevent crashes
  4. New Tooling: Added vector-backed code search tool with Qdrant integration
  5. Memory Management: Improved resource cleanup using WeakMap for event listeners
  6. Test Coverage: Added comprehensive tests for mode_slug functionality

Review Comments

🟢 Critical Bug Fix - Workspace Path Initialization

File: src/core/task/Task.ts (Lines 306-318)

Excellent fix for the workspace path initialization issue! Moving the workspace path initialization before creating controllers prevents the undefined workspace path crashes that could occur when controllers tried to access this.cwd before it was properly initialized. This is a critical fix that improves stability.

🟢 Mode Handling Implementation

File: src/core/webview/ClineProvider.ts (Lines 710-734)

Good implementation of bridge mode_slug handling. The code properly:

  • Checks for mode_slug from the cloud extension bridge
  • Validates the mode exists before applying it
  • Logs the mode switch for debugging
  • Falls back gracefully if the mode doesn't exist

🟡 Suggestion - Enhanced Error Handling

File: src/core/tools/codebaseSearchTool.ts

While the implementation is solid, consider adding more specific error handling for network failures when connecting to Qdrant. Currently, errors are caught generically. Consider using specific error types for better debugging and user feedback.

🟢 Memory Management Improvements

File: src/core/webview/ClineProvider.ts (WeakMap usage)

Great use of WeakMap for tracking task event listeners! This prevents memory leaks by allowing garbage collection of tasks when they're no longer referenced elsewhere. The automatic cleanup when tasks are disposed is a significant improvement.

🟢 Comprehensive Test Coverage

File: src/core/webview/__tests__/ClineProvider.spec.ts (Lines 2211-2288)

Excellent test coverage for the new bridge mode_slug functionality! The tests properly verify mode switching, validation, logging, and integration with handleModeSwitch.

🟡 Minor - Documentation

File: packages/types/src/task.ts

Consider adding JSDoc comments to the new InitTaskOptions interface to document the purpose of each parameter, especially mode_slug.

⚠️ Action Required

The PR has merge conflicts that need to be resolved before merging. Please rebase or merge the latest changes from the main branch.

Overall Assessment

This is a well-implemented feature that adds valuable functionality for task lifecycle management and mode handling. The critical workspace path fix alone makes this PR important to merge. The code quality is good, with proper error handling, memory management, and comprehensive test coverage.

Recommendation: APPROVE ✅ - Once the merge conflicts are resolved and the minor suggestions are considered, this PR is ready to merge.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Aug 15, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 15, 2025
@mrubens
Copy link
Collaborator

mrubens commented Aug 15, 2025

Not a blocker, but could/should the new task tool use this for setting the mode?

@mrubens
Copy link
Collaborator

mrubens commented Aug 15, 2025

Also, are the integration test failures real?

Copy link
Collaborator

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

It seems there are a couple of unrelated changes mixed in. If those fixes are necessary, then it would help to know what issues they are targeting to be able to test them properly.

The integration tests seem to be genuinely failing, can you take a look?

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap Aug 15, 2025
@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Aug 15, 2025
@liwilliam2021
Copy link
Author

@mrubens @daniel-lxs -- sorry there was some code left over from some merge conflicts

the integration tests are passing now-- not sure what changed

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Review] in Roo Code Roadmap Aug 15, 2025
Copy link
Collaborator

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 15, 2025
@@ -97,11 +97,13 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
text,
images,
newTab,
modeSlug,
}: {
configuration: RooCodeSettings
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't RooCodeSettings allow you to set the mode? Or am I misremembering?

@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap Aug 18, 2025
@mrubens mrubens closed this Aug 30, 2025
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Aug 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 30, 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 lgtm This PR has been approved by a maintainer PR - Changes Requested size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants