fix(tool): include ignored files for empty grep glob discovery#4710
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Stop pi-walker from applying .gitignore/.ignore files from unrelated ancestors above an explicit non-repository search root. Preserve repo-root ignore inheritance when scanning a subdirectory inside a repository. Fixes #4706
d8434d1 to
1aa31c0
Compare
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.
Repro
In a temp project with
flake.nix,home-common.nix, and nestedmodules/common/*.nix, the original failure returns empty results for discovery calls likeglob(path="*.nix"),glob(path="modules/**/*.nix"),glob(path="modules"),grep(pattern="home\\.packages", path="."), andgrep(pattern="home\\.packages", path="modules"), while exact-file controlsglob(path="flake.nix"),glob(path="modules/common/zsh.nix"), andgrep(..., path="home-common.nix")still work. The follow-up case is reproducible without a project.gitignorewhen Git ignore sources such as.git/info/excludehide the same paths;bun .wt/repro-grep-glob-no-dotgitignore.tsconfirmed the branch now returns discovery matches by default and still returns empty for explicitgitignore:truecontrols.Cause
GlobTool.executeandGrepTool.executepass omittedgitignoreastrueinto the native filesystem walkers (packages/coding-agent/src/tools/glob.ts,packages/coding-agent/src/tools/grep.ts). The walkers honor the full Git ignore stack, not only project.gitignore, so directory/glob discovery can silently produce zero matches even when exact-file paths work because exact files bypass the walker.Fix
GlobToolthat retries with ignored files included when the first gitignore-aware discovery pass returns no files.GrepToolfor filesystem discovery scans that return no matches.gitignore:truestrict: callers that opt into ignored-file filtering still receive empty results for ignored paths.gitignore:true, and exact-file grep controls.Verification
bun test packages/coding-agent/src/tools/__tests__/glob.test.ts packages/coding-agent/test/tools/grep-gitignore-discovery.test.tspassed with 7 tests and 30 assertions.bun .wt/repro-grep-glob-no-dotgitignore.tspassed on the branch: no project.gitignore, default discovery returns the.nixmatches, and explicitgitignore:truereturns empty controls.bun run fixcompleted successfully before commit;gh_push_branchcompleted its pre-publish gate and pushedd8434d1c3636. Fixes #4706