Repository navigation
Conversation
The include examples are brace patterns ("*.{ts,tsx}"), which ripgrep expands
and fnmatch does not, so the Python fallback returned an empty result for a
search ripgrep answers correctly. The expansion helper moves to the shared
tools utils so glob and grep use one implementation.
|
Parity check between the two backends, on a tree with
Two things worth noting for review:
Reproducer is the same four-call loop the PR describes; I can add it as a test that runs only when |
|
Closing: #6636 landed the same fix ( For the record, the two things this branch had that #6636 does not: the helper moved to |
HUMAN:
AGENT:
The glob Python fallback got brace expansion in #6615; grep's
includenever did, so the same search returned files through ripgrep and nothing through the fallback.GrepAction.includeis documented with brace examples:_path_matches_filtersmatched the pattern withfnmatch.fnmatch(filename, include_pattern), which has no brace support, so*.{ts,tsx}matched no filename at all. On a machine with ripgrep the search works; on one without it the same call returns an empty result, which reads as "no matches" rather than "the filter cannot match anything".Measured before the change, Python backend, three files containing the pattern:
and after:
What changed
expand_braces()moves fromopenhands/tools/glob/impl.pyto the sharedopenhands/tools/utils/package, so both tools use one implementation instead of two.globkeeps its private name as an alias, which leaves its existing tests untouched.grep's_path_matches_filtersexpands the pattern before matching, soincludebehaves the same on both backends.test_python_backend_expands_brace_include_patternsforces the Python backend (both availability probes returnFalse) and asserts*.{ts,tsx}findsa.tsandb.tsxand notc.js.tests/tools/grep+tests/tools/glob: 83 passed, 32 skipped.ruff checkandruff formatclean on the four touched files.