refactor(init): make list_dir bounded and metadata-only - #1446
Merged
Conversation
Pairs with the server bash-like file-tool redesign (cli-init-api#243). list_dir now attaches size (statSync) and an advisory isBinary (NUL sniff of the first bytes) to each file entry, so the agent can skip huge/binary files without reading them — the ls -l data it was missing. Additive + backward-safe: DirEntry gains two optional fields the server's dirEntrySchema already accepts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
betegon
marked this pull request as ready for review
August 20, 2026 19:17
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 16ea0c8. Configure here.
Addresses Cursor Bugbot on #1446: looksBinary opened every non-directory entry with a blocking openSync and no regular-file check, so a FIFO in the tree could hang list_dir (and sentry init); it also attached size/isBinary:false to symlinks and other special files. Now only entry.isFile() regular files get hints, and the read opens with O_RDONLY|O_NONBLOCK + re-checks fstat().isFile() before reading — the same guard read-files uses. Verified: a named pipe no longer blocks the walk and carries no hints; regular files still get size. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

CLI side of the simplified repository-tool contract. Pairs with getsentry/cli-init-api#243.
What changed
list_dirnow behaves like bounded metadata discovery:size;isBinarysniff is removed;truncated: truewhenmaxDepth/maxEntriesstop traversal or a directory cannot be read.This gives the agent enough information to avoid obviously huge files without paying an extra open/read for every file. When traversal is incomplete, the agent can list a narrower path instead of assuming the result is exhaustive.
Compatibility
File size remains optional and
truncatedis additive. Older server versions ignore the extra result field; newer servers preserve it through the agent transcript. The existing read-files V2 contract is unchanged.Validation
git diff --checkThe full local CLI suite also ran 9,203 tests successfully; its two existing Bash-completion shell simulations fail on this local macOS shell environment and are unrelated to this diff.