fix(tools/glob): don't report truncation at exactly 100 matches in ripgrep backend#3976
Draft
tomsen-ai wants to merge 1 commit into
Draft
fix(tools/glob): don't report truncation at exactly 100 matches in ripgrep backend#3976tomsen-ai wants to merge 1 commit into
tomsen-ai wants to merge 1 commit into
Conversation
…pgrep backend The ripgrep backend stopped collecting at 100 files and then flagged truncated with 'len >= 100', so a result set of exactly 100 files was reported as truncated even though nothing was dropped. The Python fallback backend and the grep tool both use a strict '> 100'. Collect all ripgrep output lines first (already sorted by --sortr=modified), flag truncated only when matches were actually dropped, and resolve paths only for the returned slice. This aligns all three backends at the boundary. Signed-off-by: tomsen-ai <230283659+tomsen-ai@users.noreply.github.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.
HUMAN:
Found that the glob tool reports results as truncated when there areexactly 100 matches, even though nothing was actually dropped. The
ripgrep and Python backends were inconsistent on this boundary, and the false flag misleads the agent into doing extra re-searches. I went
through the root cause and the before/after repro myself.
AGENT:
Why
The glob tool's ripgrep backend stops collecting at 100 files and then flags
truncated = len(file_paths) >= 100. A result set of exactly 100 files is therefore reported as truncated even though nothing was dropped:impl.pyPython fallback uses a strict> 100(_execute_with_glob), and the grep tool does too — the ripgrep path is the only>=.definition.py's field doc says "Whether results were truncated to 100 files" — false at exactly 100.Because the backend is chosen by whether
rgis installed, the same directory + pattern currently yields differenttruncatedanswers on different machines.Summary
--sortr=modified), settruncated = len(lines) > 100, return the first 100 — matching the Python fallback exactly.Path.resolve()now runs only on the returned slice instead of every line.len == 100andtruncated is Falseat exactly 100 matches.Issue Number
N/A (searched open/closed issues and PRs for glob truncation — no prior report).
How to Test
The new test fails on main (ripgrep backend reports
truncated=Trueat 100 matches) and passes with this change. End-to-end repro against the real executor (ripgrep installed):Video/Screenshots
Agent-visible observation text on main at exactly 100 matches (real
GlobExecutorrun, not mocked):After this change the misleading instruction no longer appears; the 101-match case still produces it correctly.