feat: enrich search_files no-match results with directory listing (Closes #1486) - #1491
feat: enrich search_files no-match results with directory listing (Closes #1486)#1491Lexus2016 wants to merge 14 commits into
Conversation
) When search_files returns zero results (valid pattern, no matches), the agent previously got a bare {total_count: 0} with no actionable info, causing blind retries (#1486: 95 file-not-found events/7d, 27-deep spirals observed). This enriches the FIRST empty result with a _no_match_hint field listing what *does* exist in the search directory, plus a mode-specific recovery suggestion. The existing #1372 spiral detection (SWITCH STRATEGY after 3 misses) is preserved. Closes #1486 Co-Authored-By: Hermes Evolution <evolution@hermes.ai>
|
🤖 Evolution integration — autonomous merge blocked by policy CI: ✅ fully green | Code review: ✅ passed (not dead code, solves #1486, no regression) Reason not auto-merged: The deterministic merge gate ( If a human approves and merges, the next integration cycle will pick up the self-update. |
|
🤖 Evolution Integration — blocked by merge-gate (DIFF_TOO_LARGE) This PR passed all safety checks:
Blocked solely by: 308 changed lines exceed the 200-line autonomous self-merge cap. ~210 of those are test code (11 new tests). Leaving for human review per merge-gate policy. The production change is only ~98 lines. All checks green — ready for manual merge. |
|
Code-review (evolution-integration, 2026-08-01): BLOCKED by autonomous merge gate ( |
Automated evolution PR for issue #1486.
Summary
When
search_filesreturns zero results (valid pattern, no matches), the agent previously got a bare{total_count: 0}with no actionable info, causing blind retries (#1486: 95 file-not-found events/7d, 27-deep spirals observed).Changes
tools/file_tools.py: Added_build_no_match_hint()function that lists what does exist in the search directory (up to 10 entries, dirs first). Enriches the FIRST empty result with a_no_match_hintfield containing the directory listing + a mode-specific recovery suggestion. The existing [FIX] search_files spiral cap not holding — 250 sessions, max 27 consecutive, regressed #1372 spiral detection (SWITCH STRATEGY after 3 consecutive misses) is preserved.tests/tools/test_file_tools.py: AddedTestNoMatchHintclass with 11 tests covering: directory listing, file-path handling, nonexistent paths, empty dirs, files vs content search mode, dotfile hiding, first-miss-only hint, spiral directive, and no-hint-when-results-exist.Verification
ruff checkpassesCloses #1486