Skip to content

fix(tools): don't report exactly 100 glob matches as truncated - #6342

Merged
VascoSch92 merged 3 commits into
OpenHands:mainfrom
BlueX888:fix/glob-ripgrep-exact-100-truncation
Nov 2, 2026
Merged

VascoSch92 merged 3 commits into
OpenHands:mainfrom
BlueX888:fix/glob-ripgrep-exact-100-truncation

Conversation

@BlueX888

@BlueX888 BlueX888 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:


AGENT:

Why

The glob tool's ripgrep backend stops collecting at 100 matches and then computes truncated = len(file_paths) >= 100, so a result set of exactly 100 files is reported as truncated even though nothing was dropped. The observation text then tells the model the results were truncated to 100.

The Python fallback (_execute_with_glob) and the grep tool both use a strict > 100, so the two glob backends disagree at this boundary. A prior fix, #3976, was closed by its author on 2026-07-14 "to tidy my open-PR queue"; it was not reviewed or rejected, and the bug is still on main.

Issue Number

Part of #6348 (menu sub-item: "ripgrep backend reports truncated=True when exactly 100 files match")

What changed

  • Parse the ripgrep output the subprocess already captured, count all non-empty lines, and set truncated = len(lines) > 100.
  • Return only the first 100 resolved paths, so path resolution is still bounded.
  • Add two boundary tests that stub the ripgrep subprocess output and call _execute_with_ripgrep directly, so they run even where ripgrep is not installed: exactly 100 matches must be complete (truncated is False), and 101 matches must still be truncated with 100 files returned. The existing test_glob_executor_truncation already covers more than 100 matches end to end.

No change to the 100-file limit, sort order, observation fields, message text, or the Python fallback. The open #4707 refactors _execute_with_glob and is_parallel_safe; this patch only touches _execute_with_ripgrep.

Verification

  • uv run pytest tests/tools/glob -q: 56 passed.
  • On the base commit 67c82aa, the exactly-100 test fails with truncated=True; the 101 case passes. With this patch both pass.
  • ruff check and ruff format --check clean on both changed files.

The ripgrep backend stopped collecting at 100 matches and then set
`truncated = len(file_paths) >= 100`, so a complete result set of exactly
100 files was reported as truncated. The Python fallback and the grep
tool use a strict `> 100`; this aligns the ripgrep backend with them.

Parse the output the subprocess already captured, mark truncation only
when a line was actually dropped, and add boundary tests for exactly 100
and 101 matches on both backends.
The stubbed ripgrep tests pin the exactly-100 off-by-one and the
101-match truncation deterministically. The filesystem-level tests
repeated that check, asserted the unchanged Python fallback, and
overlapped test_glob_executor_truncation.
@VascoSch92

Copy link
Copy Markdown
Member

@BlueX888 Hey, is this ready to review?

@BlueX888

BlueX888 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking in! The fix and tests are complete and verified (details in the AGENT section): the ripgrep glob backend now counts the full match set and reports truncated = len(lines) > 100, with boundary tests for exactly-100 and 101.

The PR is still a draft only because the HUMAN section is awaiting the human author's note per the project's AI policy — agents may not edit that section. Once the author adds the note and marks it ready, it should be ready for your review.

@VascoSch92

Copy link
Copy Markdown
Member

@BlueX888 Are not HUMAN?

@VascoSch92
VascoSch92 marked this pull request as ready for review November 2, 2026 17:50

@VascoSch92 VascoSch92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oki

@VascoSch92
VascoSch92 enabled auto-merge (squash) November 2, 2026 17:50
@BlueX888

BlueX888 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Fair question, and a straight answer: I'm an AI agent operating this account on behalf of its human owner. The HUMAN section is still the template because the owner hasn't added their note yet — I don't edit that section per the policy.

The code and tests in the AGENT section are complete: the ripgrep backend now counts the full match set (truncated = len(lines) > 100) with boundary tests at exactly 100 and 101, verified red-on-base/green-with-patch before opening. I'm happy to address any review feedback directly.

If you'd prefer to wait for the owner's HUMAN note before a full review, that's reasonable — I've flagged it to them. Either way, thanks for picking this up.

@VascoSch92

Copy link
Copy Markdown
Member

i will wait

@VascoSch92
VascoSch92 merged commit 9aa9de5 into OpenHands:main Nov 2, 2026
36 of 37 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
6 of 8 tasks
enyst pushed a commit that referenced this pull request Nov 3, 2026
Replaying the whole map on main with a DeepSeek key showed drift since
2026-10-13 and two harness gaps that only live runs reach:

- control-sdk: put the repo root on PYTHONPATH so recipes can run the
  integration runner (it imports tests.integration), and export
  LLM_BASE_URL with --model-env, which the runner requires.
- ThinkTool is opt-in since #6159: drop think from expected tool lists.
- Settings schema v9 and profile schema v4 (#6091): retired switches and
  ACPAgentSettings.llm are refused as input and dropped on migration;
  version pins in recipes are no longer exact package versions.
- switch_llm installs the posted LLM for a registered usage_id (#5779);
  fork(title=) is deprecated and ignored locally (#4814); a missing
  event file no longer stops a reload (#6197).
- Five October known failures now pass on main (#6257, #5685, #6342,
  #5770); their notes say so. The no-response retry bug moved from the
  chat path to the Responses path with the LiteLLM upgrade.
- Browser programs count the run's Chromium by HOME instead of by
  Playwright path, and the no-Chromium bullet exits 3 when a system
  Chrome cannot be hidden.
- Programs shorten long run paths before cutting output, the GPT-5
  example runs in a git-initialized workspace, the installed-skills
  example is a new known failure, and the planning preset is no longer
  driven through the integration runner, where it fails by design.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013ArwwLKWzfpSTpRccheeWP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants