fix: allow list_files to work on home directory#12127
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: allow list_files to work on home directory#12127roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Remove home directory restriction from handleSpecialDirectories() in list-files.ts so that explicit list_files tool calls return actual file listings instead of "No files found." Add a home directory check in getEnvironmentDetails() to skip automatic file listing for home directory workspaces (similar to the existing Desktop check), keeping the initial system prompt lightweight while still allowing list_files to work correctly. Add test for the new home directory handling in getEnvironmentDetails.
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: #12121
Description
This PR attempts to address Issue #12121 where
list_filesreturns "No files found." when the workspace is the user's home directory.Root cause:
handleSpecialDirectories()inlist-files.tsshort-circuited home directory requests by returning only the directory path itself (a single-element array). WhenformatFilesList()converted this to a relative path, it produced an empty string, which triggered the "No files found." message.Changes:
src/services/glob/list-files.ts: Removed the home directory restriction fromhandleSpecialDirectories(). The root directory (/) check remains since that is genuinely dangerous. The existinglimitparameter already protects against performance issues for large directories.src/core/environment/getEnvironmentDetails.ts: Added a home directory check (similar to the existing Desktop check) so environment details skip automatic listing for home-directory workspaces, keeping the initial system prompt lightweight. Explicitlist_filestool calls still work correctly.src/core/environment/__tests__/getEnvironmentDetails.spec.ts: Added a test for the new home directory handling.Also removed the now-unused
osimport fromlist-files.ts.Test Procedure
npx vitest run core/environment/__tests__/getEnvironmentDetails.spec.ts(20 tests pass)npx vitest run services/glob/__tests__/list-files.spec.ts core/prompts/__tests__/responses-rooignore.spec.ts(19 tests pass)Pre-Submission Checklist
Documentation Updates
Additional Notes
Feedback and guidance are welcome.
Interactively review PR in Roo Code Cloud