Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: activeloopai/hivemind/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughRepeated ChangesGrep pattern handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Repeated -e patterns in grep now match every supplied pattern, and prefiltering no longer drops rows that match unanchored branches. No merge-blocking risk was identified. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
grep -e apple -e banana /notesshould print lines that match either pattern. The Claude Code grep fast path only prints lines matching the first one.parseBashGrep(src/hooks/grep-direct.ts) collects every-e/--regexpvalue intoexplicitPatterns, but then passes onlyexplicitPatterns[0]on tohandleGrepDirect. Every later expression is silently dropped.Reproduction on
main(e054fb16), through the sameparseBashGrep→handleGrepDirectpath the pre-tool-use hook uses (lexical mode):Fix:
parseBashGrepjoins them into one alternation (apple|banana). With-F, each expression is regex-escaped on its own first, soa.bstill only matches a literal dot.extractRegexAlternationPrefilters(src/shell/grep-core.ts) used to drop alternation branches that had no safe literal anchor and keep the rest. For an OR, that narrows the SQL prefilter:apple|\d+becameILIKE '%apple%'and lost every row that only matched\d+. It now returnsnull(no content prefilter) when any branch has no anchor. When every branch has one, all of them still reach the memory and session prefilters.A single
-eor a positional pattern takes the same path as before.Version Bump
Not bumped. This is a patch-level bug fix, so I've left the release decision to you.
Test plan
npm test, afternpm run build): 5832 passed. The 17 failures are the same on the untouchedmaincheckout and come from the environment: cowork-queue-leak, install-cowork, skillify-state, plugin-cache-gc-bundle, and two graph suites.parseBashGrep: repeated patterns(-e apple -e bananareturns both lines and puts both literals in the memory and session SQL prefilters;-F -e a.b -e bananastays literal) andreturns null when any branch has no safe literal anchor. All three fail onmain(expected 'apple pie' to be 'apple pie\nbanana bread',expected 'a.b' to be 'a.b\nbanana',expected [ 'apple' ] to be null) and pass on this branch.grep-core+grep-direct: 204/204.npm run typecheck,npm run dupandgit diff --checkpass.package.json, or no release needed for this changeI didn't find an existing issue or PR for this. #446 also touches
grep-direct.ts, but it changes semantic-mode eligibility (patternIsSemanticFriendly), not pattern parsing or the lexical prefilter.An AI agent (breken-ai) found this and wrote the fix and tests. I reviewed and ran everything above before opening the PR.
Summary by CodeRabbit
New Features
-epatterns, matching lines that contain any of the specified expressions.Bug Fixes