list-files must include at least the first-level directory contents #5303
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: #5301
Description
When asking the model to “summarize the current project” in projects with a large number of files, it may make inferences based on the content returned by the Current Workspace Directory or the List Files tool.
However, the current List-files tool uses a depth-first search strategy, which can result in returning detailed structures for only part of the project directories, while the model has no awareness of the other directories at all. In some weaker models, instead of requesting the agent to fetch all subfolders, they directly infer based on the partial information available, which can lead to completely incorrect results.
Changes:
Test Procedure
When viewing the prompt in human-relay mode, the Current Workspace Directory will include at least all files in the first-level directories.
Pre-Submission Checklist
Screenshots / Videos
Documentation Updates
Additional Notes
Get in Touch
Important
Enhance
listFiles
to include first-level directory contents when file limit is reached, ensuring complete directory awareness.listFiles
inlist-files.ts
now performs an additional non-recursive retrieval of top-level directories if the file limit is reached in recursive mode.formatAndCombineResults
updated to sort paths by depth, ensuring directories are listed before files.listFilesWithRipgrep
still uses depth-first search, but first-level directory structure is guaranteed.This description was created by
for e64dd2a. You can customize this summary. It will automatically update as commits are pushed.