Repository navigation
Conversation
The grep include filter compared only the basename, so sub/*.ts and **/*.ts never matched. Match relative path segments with ** support, keeping basename-only patterns recursive. Co-authored-by: openhands <openhands@all-hands.dev>
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.
HUMAN:
AGENT:
Why
GrepAction.includeignored any pattern with a directory component._path_matches_filters()compared the include glob only againstPath.name, sosub/*.ts,**/*.ts, andsub/**/*.tsnever matched even though ripgrep's own-gdid. VascoSch92 closed the earlier #6325 after the brace-expansion part landed on main and explicitly asked for a smaller PR covering these path patterns.Summary
/; basename-only patterns keep the existing recursive basename behavior. The ripgrep backend only uses-gfor basename patterns, sincergmatches-gagainst the absolute printed path.**as spanning any number of directories, so**/*.tsincludes root-level files andsub/**/*.tscovers the subtree; trailing/**matches contents below the prefix.sub/*.ts,**/*.ts,sub/**/*.ts,*.ts, and*/a.tsacross the ripgrep, grep, and Python backends.Issue Number
Part of #6348
How to Test
With ripgrep on
PATH:78 passed. Without ripgrep:54 passed, 24 skipped(the ripgrep-parametrized cases skip). Runrg --versionfirst if you want the full backend matrix. Reverting onlyimpl.pywhile keeping the new test makes the grep/Python path cases fail with empty match sets; the ripgrep cases were also verified with a real rg binary.uv run pre-commit run --files openhands-tools/openhands/tools/grep/impl.py tests/tools/grep/test_grep_executor.pypasses.Video/Screenshots
N/A (behavior covered by the parameterized test output above).
Design Doc
N/A.
Type
Notes
includecontract is unchanged for existing callers: patterns without/still match the basename anywhere, and brace expansion is still applied first.-gas a prefilter; ripgrep scans and the Python filter narrows the result. That is a small performance trade-off on very large trees, kept for correctness and simplicity../*.ts; basename patterns are consistent. This was already broken for path patterns before the patch.sub\\*.ts) remain unsupported; patterns use/. This is not a regression.rg.