aft icon indicating copy to clipboard operation
aft copied to clipboard

grep hides ignored-file exclusions when a root search finds other matches

Open jjjermiah opened this issue 1 month ago • 1 comments

Root-scoped grep can return matches while silently skipping gitignored trees. In a scratch repo with .gitignore containing .agents/, grep for a token present in both top.txt and .agents/research/topic/note.md returned top.txt and said searched all 2 files directly. The excluded research tree was not mentioned. The same problem affected a linked worktree under .agents/worktrees/; files in its globally ignored build/ directory were omitted. Explicitly scoping the ignored directory finds those files, but the agent cannot know to do that when an ordinary search appears complete.

In v0.63.5, commands/grep.rs reports ignored counts for an empty eligible scope, not for a successful root search. Please disclose ignored paths/counts in nonempty results too, and consider an explicit include-ignored option for grep and aft_search. An agent should not read searched all N files as coverage of a directory it never searched.

Originally reported as dotfiles #13 and #24. The scratch reproduction was run on the current session's AFT build; v0.63.5 source retains the result-visibility gap.

jjjermiah avatar Nov 01 '26 19:11 jjjermiah

Thanks for the report, @jjjermiah. Fixed in v0.67.1: grep now names the folders that ignore rules kept out of a search, even when the search found other matches. Please reopen if you still see it.

aft-alfonso[bot] avatar Nov 24 '26 11:11 aft-alfonso[bot]