fix(tools): prevent EACCES errors from absolute paths in tool calls (#11208)#11247
Open
randomizedcoder wants to merge 1 commit intoRooCodeInc:mainfrom
Open
fix(tools): prevent EACCES errors from absolute paths in tool calls (#11208)#11247randomizedcoder wants to merge 1 commit intoRooCodeInc:mainfrom
randomizedcoder wants to merge 1 commit intoRooCodeInc:mainfrom
Conversation
Author
Contributor
Fixed the 12 failing Windows tests in |
Author
|
oh wow. nice work fixaroo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related GitHub Issue
Closes: #11208
Roo Code Task Context (Optional)
N/A
Description
This PR fixes the EACCES permission denied errors that occur when LLMs provide absolute paths (like
/plans) in tool calls during streaming.Root Cause: When
path.resolve(task.cwd, "/plans")is called with an absolute path, it returns/plansdirectly, bypassing the workspace directory entirely. This causes filesystem operations to attempt creating directories at the root level.Key Implementation Details:
Shared path normalization (
src/utils/pathUtils.ts):normalizeToolPath()with 5-step validation../or resolve outside cwdError suppression in BaseTool (
src/core/tools/BaseTool.ts):PartialExecutionStatediscriminated union (idle/streaming/erroring)WeakMap<Task, State>notifyPartialError(): logs first error, suppresses identical repeatsshouldSkipDueToPathError(): fast-path guard skips expensive work on known-bad pathsUpdated all file-writing tools to use new per-task signatures:
hasPathStabilized(task, path)resetPartialState(task)Also includes (required for test infrastructure):
Test Procedure
New tests added (47 tests in 2 files):
src/utils/__tests__/pathUtils.spec.ts- Path normalization tests:/plans)src/core/tools/__tests__/BaseTool.spec.ts- Error suppression tests:To run new tests only:
Full test suite passes: 370 files, 5461 tests
Pre-Submission Checklist
Screenshots / Videos
N/A - No UI changes
Documentation Updates
I'm not sure if this need extra documentation. Happy for feedback.
Additional Notes
The fix addresses PR #11209's approach but extends it to also handle the
handlePartial()streaming path, which is where the repeated errors actually occur during LLM streaming.Get in Touch
N/A
Important
Fixes EACCES errors by normalizing paths to workspace-relative and adds error suppression for repeated path errors in tool calls.
normalizeToolPath()inpathUtils.ts.BaseTool.ts.WriteToFileTool,EditFileTool,SearchReplaceTool,SearchAndReplaceTool, andApplyDiffToolto usenormalizeToolPath().BaseTool.ts.pathUtils.spec.ts.BaseTool.spec.tsandwriteToFileTool.spec.ts.package.json.This description was created by
for bdae65b. You can customize this summary. It will automatically update as commits are pushed.