fix(agent): allow octet stream text reads - #2110
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe binary read guard now classifies files by MIME type only. Agent file reads support BOM-aware UTF-16LE, UTF-16BE, and UTF-8 decoding. Octet-stream code and diff files are handled as raw text. ChangesAgent file reading
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/main/tool/agentTools/agentToolManagerRead.test.ts`:
- Around line 224-240: Add focused regression tests alongside the existing
UTF-16LE case for AgentFileSystemHandler.readFile behavior with UTF-16BE and
UTF-8 BOM inputs reported as application/octet-stream. Verify returned content
contains the expected text without a leading BOM or NUL characters, and keep
each case minimal and consistent with the existing manager.callTool setup.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6865541d-c736-424f-84fd-54d3e8477023
📒 Files selected for processing (5)
src/main/lib/binaryReadGuard.tssrc/main/tool/agentTools/agentFileSystemHandler.tssrc/main/tool/agentTools/agentToolManager.tstest/main/lib/binaryReadGuard.test.tstest/main/tool/agentTools/agentToolManagerRead.test.ts
Summary
application/octet-streamfiles to fall through to plain-text reads instead of binary sniffingTests
pnpm exec vitest run --config vitest.config.ts test/main/lib/binaryReadGuard.test.ts test/main/tool/agentTools/agentToolManagerRead.test.tspnpm run typecheckpnpm run i18npnpm run lintpnpm exec oxfmt --check src/main/lib/binaryReadGuard.ts src/main/tool/agentTools/agentFileSystemHandler.ts src/main/tool/agentTools/agentToolManager.ts test/main/lib/binaryReadGuard.test.ts test/main/tool/agentTools/agentToolManagerRead.test.tsSummary by CodeRabbit
New Features
application/octet-stream.Bug Fixes