Repository navigation
fix(mcp): keep missing repo_tree paths out of Sentry - #1325
Conversation
Agents routinely probe common subpaths (docs/, tests/, …) that are absent. Map workspace ENOENT from repo_tree to McpCallerError so those caller misses stay on mcp-event instead of opening platform-bug issues. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
📝 WalkthroughWalkthroughThe repository tree capability now converts missing paths to ChangesRepository tree errors
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 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 |
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
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 `@packages/worker/src/mcp/capabilities/repo/repo-tree.node.test.ts`:
- Around line 29-63: Add a test alongside “repo_tree maps missing-path ENOENT to
McpCallerError” where the mocked tree RPC rejects with an outer error whose
cause has code ENOENT. Invoke repoTreeCapability.handler with the same session
and path, then assert it returns McpCallerError with the existing missing-path
message and preserves the expected tree call arguments.
🪄 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: ff03ae30-0b4a-41f2-81f0-31241ae2549d
📒 Files selected for processing (2)
packages/worker/src/mcp/capabilities/repo/repo-tree.node.test.tspackages/worker/src/mcp/capabilities/repo/repo-tree.ts
Address CodeRabbit feedback: RPC wrappers may nest the workspace ENOENT under an outer error, and isRepoTreeMissingPathError walks the cause chain. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🔎 Preview deployed: https://kody-pr-1325.kody-a99.workers.dev Worker: Mocks:
|
Intent
Stop routine
repo_treeprobes of missing subpaths from opening Sentry platform-bug issues.Summary
repo_treeon common subpaths (docs/,tests/,.github/, …) that do not exist in the session workspace.ENOENTerrors, which MCP observability reported to Sentry as handled handler failures.repo_treenow maps missing-pathENOENTtoMcpCallerErrorwith a clear path-not-found message, so they stay onmcp-eventand out of Sentry (same pattern as fix(mcp): treat missing community listing as caller error #1318 / fix(mcp): stop Sentry noise for unpublished HEAD on repo_open_session #1059).Testing
packages/worker/src/mcp/capabilities/repo/repo-tree.node.test.ts(ENOENT →McpCallerError; nested cause ENOENT; non-ENOENT still plain Error; happy-path summary)5c391ba3(Node/Workers/MCP/E2E/Static)System recap — composes existing primitives (low risk)
Mode: recap · Base:
main@969e1038· Head:39133459Classification: composes — wires existing
McpCallerErrorclassification into therepo_treemissing-path path; no new primitives or schema changes.Primitives touched
capability-registryrepo_treemissing-path usesMcpCallerErrorSystem map
Missing session subpaths from
repo_treeclassify as caller-correctable MCP failures instead of Sentry platform bugs.Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Summary by CodeRabbit
Bug Fixes
Tests