Skip to content

fix(search): restore zero-match probes on the rg engine after auto-multiline early-return - #77128

Merged
teknium1 merged 1 commit into
mainfrom
fix/search-probe-early-return
Aug 2, 2026
Merged

fix(search): restore zero-match probes on the rg engine after auto-multiline early-return#77128
teknium1 merged 1 commit into
mainfrom
fix/search-probe-early-return

Conversation

@teknium1

@teknium1 teknium1 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Restores the #77011 zero-match steering probes (case-insensitive / hidden-file / literal-vs-regex) on the ripgrep engine — #77102's early return, added to skip the legacy line-oriented \n warning for rg, was also skipping the probe block.

Root cause: an integration regression between two individually-green PRs. #77011 attached the probes after the engine dispatch in _search_content; #77102 later added return result directly after the rg call so the grep-era line-oriented explanation wouldn't fire on an engine that now auto-multilines. That return bypassed the probes on the primary engine. Caught by #77001's rebased CI (its branch was the first to carry both features together).

Changes

  • tools/file_operations.py (_search_content): probes run for BOTH engines; only the legacy line-oriented \n warning is rg-exempt (rg auto-enables --multiline; the grep fallback keeps the explanation).

Validation

Check Result
Hermetic runner (zero-match+multipath, auto-multiline, file_operations, file_tools) 109/109 passed
Live E2E via real search_tool() case probe fires; hidden probe fires; \n pattern still multiline-matches with mode note

Infographic

probe restore

…ltiline early-return

Integration regression between two merged PRs: #77102's rg-path early
return (added to skip the grep-era line-oriented warning) also skipped
the #77011 zero-match steering probes (case-insensitive, hidden-file,
literal-vs-regex), silencing them on the primary engine. Caught by
#77001's rebased CI run (its branch carried both features together for
the first time).

_search_content now runs the zero-match probe block for BOTH engines
and only exempts the rg path from the legacy line-oriented \n warning
(rg auto-enables --multiline; the grep fallback keeps the explanation).
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 15b10d5

all good!

@teknium1

teknium1 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Hit this independently while triaging a red slice 8/8 on #77104 — same root cause, so I dropped my duplicate fix in favor of this one. Confirming the diagnosis from the other direction:

15:10  5797b50288  feat(search): zero-match probes and multi-path recovery   <- probe block added
15:10  e7aa06c3a6  feat(search): hidden/gitignored probe on zero-match results
15:13  1cefabc8af  feat(search): auto-enable multiline mode for newline patterns  <- added the early return

Three minutes apart. The later commit's return result orphaned the earlier one's block, so the entire zero-match steering tier was dead for every user with rg installed — reproduced on a pristine origin/main worktree: search_files('token_alpha', ...) against a file containing TOKEN_ALPHA returns a bare {"total_count": 0} with no hint. The 3 failing tests were the feature reporting its own absence.

One gap: this PR ships no tests, so a fourth commit can silently orphan the tier the same way. I have a regression class that fails on exactly that reintroduction — parametrized over both search engines, with the probe stubbed to a sentinel so it isolates the wiring rather than the probe's own rg dependency (worth noting: the probe shells out to rg by design, so a grep-only host gets no hints even when wiring is correct — a naive parity test asserting real hint text fails on the grep leg for that reason, not because of this bug).

Sabotage-verified against your fix: restoring the early return turns 4 tests red; never attaching the hint turns 5 red; attaching it when matches exist turns 2 red. 14/14 green on the fix.

Want me to push those tests onto this branch, or land them as a follow-up after this merges?

@teknium1
teknium1 merged commit 794d6c4 into main Aug 2, 2026
35 checks passed
@teknium1
teknium1 deleted the fix/search-probe-early-return branch August 2, 2026 22:34
@alt-glitch alt-glitch added type/bug Something isn't working tool/file File tools (read, write, patch, search) P3 Low — cosmetic, nice to have labels Aug 2, 2026
teknium1 added a commit that referenced this pull request Aug 2, 2026
#77128 fixed the orphaned zero-match probe but shipped no tests, so the
same class of break can recur: an early return anywhere in the rg branch
silently makes the whole steering tier unreachable.

Asserts hint wiring per search engine with the probe stubbed to a
sentinel (the probe itself needs rg, so a real-text parity assertion
fails on the grep leg for an unrelated reason), plus the negative case
and the rg newline-warning skip that the early return originally
existed to preserve.

Sabotage-verified against 794d6c4: restoring the early return turns
4 red; a naive fix that also drops the rg newline guard turns 1 red;
attaching the hint when matches exist turns 2 red.
andrexibiza added a commit to andrexibiza/hermes-agent that referenced this pull request Aug 3, 2026
Addresses teknium1's hermes-sweeper review on NousResearch#77157 and closes the
canonical Windows search bug (NousResearch#63177, dup NousResearch#77036).

The native-rg path rewrite (_escape_native_arg) was previously gated on
the host OS alone (os.name == 'nt'), but command execution is
backend-agnostic through self.env.execute: a Windows host driving a
remote SSH/WSL/Docker backend would rewrite valid remote paths such as
/mnt/d/... into an invalid D:\... form. The conversion now only applies
when the EXECUTED backend is the local Windows environment
(_local_windows_backend: isinstance(self.env, LocalEnvironment) and
_IS_WINDOWS, mirroring the _lsp_local_only gate). Remote paths pass
through unchanged.

The grep-fallback probe work (engine picker + per-engine flags) is kept
— main's _zero_match_probe still hard-requires rg. Upstream NousResearch#77128
already landed the rg early-return repair; main's structure is preserved
(probe runs on both engines, used_rg guard for the newline warning).

New tests: TestNativePathBackendGating (local /c/ -> C: conversion,
remote /mnt/d/ /mnt/c/ /home/ pass through even with _IS_WINDOWS=True,
remote probe command keeps the raw remote path) and
test_end_to_end_search_real_hint_via_forced_grep (real search() pipeline
with grep forced via _has_command, real probe, asserts the case-
insensitive hint in the result warning).

24 passed / 0 failed on the target file; broader-suite failure set
byte-identical to pristine origin/main (stash + worktree proven); ruff
clean. Independent QA critique: SAFE TO SHIP.
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
NousResearch#77128 fixed the orphaned zero-match probe but shipped no tests, so the
same class of break can recur: an early return anywhere in the rg branch
silently makes the whole steering tier unreachable.

Asserts hint wiring per search engine with the probe stubbed to a
sentinel (the probe itself needs rg, so a real-text parity assertion
fails on the grep leg for an unrelated reason), plus the negative case
and the rg newline-warning skip that the early return originally
existed to preserve.

Sabotage-verified against d563f00: restoring the early return turns
4 red; a naive fix that also drops the rg newline guard turns 1 red;
attaching the hint when matches exist turns 2 red.
33hodl pushed a commit to 33hodl/hermes-agent that referenced this pull request Aug 12, 2026
NousResearch#77128 fixed the orphaned zero-match probe but shipped no tests, so the
same class of break can recur: an early return anywhere in the rg branch
silently makes the whole steering tier unreachable.

Asserts hint wiring per search engine with the probe stubbed to a
sentinel (the probe itself needs rg, so a real-text parity assertion
fails on the grep leg for an unrelated reason), plus the negative case
and the rg newline-warning skip that the early return originally
existed to preserve.

Sabotage-verified against 794d6c4: restoring the early return turns
4 red; a naive fix that also drops the rg newline guard turns 1 red;
attaching the hint when matches exist turns 2 red.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have tool/file File tools (read, write, patch, search) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants