Skip to content

fix(mcp): keep missing repo_tree paths out of Sentry - #1325

Merged
kody-bot merged 3 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-7660643612-3220
Aug 8, 2026
Merged

kody-bot merged 3 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-7660643612-3220

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Intent

Stop routine repo_tree probes of missing subpaths from opening Sentry platform-bug issues.

Summary

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)
  • Prior Validate green on 5c391ba3 (Node/Workers/MCP/E2E/Static)
  • CI green on latest commit
System recap — composes existing primitives (low risk)

Mode: recap · Base: main @ 969e1038 · Head: 39133459

Classification: composes — wires existing McpCallerError classification into the repo_tree missing-path path; no new primitives or schema changes.

Primitives touched

Primitive Group Impact
capability-registry assistant composes — repo_tree missing-path uses McpCallerError

System map

Missing session subpaths from repo_tree classify 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).

flowchart LR
	capabilityRegistry["capability-registry<br/>Capability registry"]:::touched
	mcpServer["mcp-server<br/>MCP endpoint"]:::untouched
	capabilityRegistry -->|"throw McpCallerError on missing tree path"| mcpServer
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Improved repository tree error handling for missing paths, providing clearer error details.
    • Preserved existing behavior for other repository access failures.
  • Tests

    • Added coverage for missing paths, unexpected errors, invalid requests, and repository subtree summaries.

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>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The repository tree capability now converts missing paths to McpCallerError, preserves unrelated errors, and includes Vitest coverage for error handling, RPC arguments, and subtree summaries.

Changes

Repository tree errors

Layer / File(s) Summary
Repository tree error mapping
packages/worker/src/mcp/capabilities/repo/repo-tree.ts
The capability detects ENOENT across error cause chains and converts matching failures to McpCallerError. Other errors are rethrown unchanged.
Repository tree behavior coverage
packages/worker/src/mcp/capabilities/repo/repo-tree.node.test.ts
Tests cover missing paths, RPC arguments, non-ENOENT failures, and subtree summary counts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the MCP behavior change for missing repo_tree paths and its Sentry impact.
Description check ✅ Passed The description includes the required Intent, Summary, and Testing sections, plus clear system impact and test coverage details.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/sentry-triage-kody-cloudflare-7660643612-3220

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kody-bot
kody-bot marked this pull request as ready for review August 8, 2026 18:40
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 969e103 and 5c391ba.

📒 Files selected for processing (2)
  • packages/worker/src/mcp/capabilities/repo/repo-tree.node.test.ts
  • packages/worker/src/mcp/capabilities/repo/repo-tree.ts

Comment thread packages/worker/src/mcp/capabilities/repo/repo-tree.node.test.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>
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1325.kody-a99.workers.dev

Worker: kody-pr-1325
D1: kody-pr-1325-db
KV: kody-pr-1325-oauth-kv

Mocks:

@kody-bot
kody-bot merged commit 767a8ba into main Aug 8, 2026
10 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-kody-cloudflare-7660643612-3220 branch August 8, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants