feat: persist workspacePath to each task for improved task management #2999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Problem
When a task is running, if user change active editor file, or close all edit file, the cwd point to incorrect directory, causing tool-call and other actions to be mis-behave (eg file not found etc).
The fix:
I heavily using multi-root workspace and would love this to be fixed.
Otherwise I must keep same active edit document while running roo task.
Other consideration:
The current approach is to config to new workspace, as normal use-case is usually open/retry task in new workspace.
Implementation
workspacePathto Cline class and init its value in constructorScreenshots
Setup
Before
After
Correctly using workspace and tool-call when running task while user open file in another workspace

How to Test
list file in current workspace, check the prompt being sent and the output to see workspace folderlist file in current workspace), check sent prompt and outputImportant
Adds
workspacePathtoClineclass to persist workspace paths for tasks, ensuring consistent task management in multi-root workspaces.workspacePathtoClineclass inCline.ts, initialized in the constructor to persist the workspace path for each task.get cwd()to returnworkspacePathinstead of recalculating it.workspacePathinClineconstructor, using parent task's path or defaulting to the desktop path.This description was created by
for 183ec5f. You can customize this summary. It will automatically update as commits are pushed.