Conversation
…the last N lines tail -n +N prints from line N onward. The compiled fast path read +N as N and returned the last N lines, so an agent paging a memory file with tail -n +3 got the wrong part of it. Decline the +N form so the VFS shell, whose tail implements it, answers instead.
|
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 (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe bash command compiler now rejects ChangesTail from-line handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to
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
tail -n +Nprints a file from line N onward. The compiled Bash fast path (src/hooks/bash-command-compiler.ts,parseHeadTailStage) read+NasNand returned the last N lines instead.So when an agent pages a memory file with
tail -n +3 ~/.deeplake/memory/summaries/…, the pre-tool-use hook answers from the compiled path with the wrong part of the file, and nothing tells the agent.Reproduction on
ce30de7, with a file holdingl1…l8:tail -n +3 /a.mdl3 … l8l6 l7 l8l3 … l8Fix:
parseHeadTailStagereturnsnullfortail -n +N. The compiler then declines the command, and the VFS shell handles it. Itsjust-bashtailimplements the+Nform. I checked thattail -n +3there printsl3…l8. The other fast paths inpre-tool-use.tsdon't match+N(their regex is-?\d+), so nothing else picks up the command before the shell does.cat f | tail -n +Nwas already rejected byisValidPipelineHeadTailStage.This PR adds a regression test in
tests/claude-code/bash-command-compiler.test.ts. It fails onmainbecause the parser returns acatsegment, and it passes with the fix.Version Bump
Not bumped. This is a patch-level bug fix, so I've left the release decision to you.
Test plan
npm test): 5823 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.does not compile tail -n +N…. It fails onmainand passes on this branch.npm run typecheckandnpm run duppass.package.json, or no release needed for this changeAn AI agent (breken-ai) found this and wrote the fix and test. I reviewed and ran everything above before opening the PR.
Summary by CodeRabbit
tail -n +Ncommands now use shell handling to return lines from line N onward, rather than being interpreted as a last-N-lines window.