Skip to content

fix(mcp): stop reporting sandbox execute failures to Sentry - #918

Closed
kentcdodds wants to merge 2 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-1n-dc45
Closed

kentcdodds wants to merge 2 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-1n-dc45

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Sentry issue KODY-CLOUDFLARE-1N is a warning with tags mcp.sandbox_error=true / mcp.tool=execute: an MCP execute caller/module threw the non-Error string b[t]?.title?.map is not a function (minified user/package code). That is not a platform defect.

The same root cause class already has a draft sibling PR (#915 / KODY-CLOUDFLARE-1H). This PR lands the filter so sandbox failures stay on structured mcp-event logs and no longer open Sentry warning issues that trip triage automation. Platform MCP failures still report at error level.

Sibling sandbox-noise issues sharing mcp.sandbox_error:true (e.g. missing secrets, bad Notion paths, invokeChecked param errors) are addressed by the same change.

Test plan

  • observability.node.test.ts asserts sandbox failures still emit mcp-event but do not call captureMessage / captureException, using the 1N error signature
  • Non-sandbox failures still report to Sentry
  • Pre-push validate passed on push
System recap — extends existing primitives (medium risk)

Mode: recap · Base: main @ 49893e20 · Head: 37ae7f38

Classification: extends — changes MCP failure reporting so sandbox/user-module errors stay on logs only and no longer open Sentry issues.

Primitives touched

Primitive Group Impact
mcp-server surfaces extends — sandbox execute failures no longer reported to Sentry

System map

Sandbox execute failures used to become Sentry warnings via MCP observability; they now stay on the mcp-event log path only.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context.

flowchart LR
	mcpExecute["mcp execute<br/>sandbox run"]:::untouched
	mcpEvent["mcp-event log"]:::untouched
	observability["mcp-server<br/>observability"]:::extended
	sentry["Sentry"]:::untouched
	mcpExecute -->|"result.error"| observability
	observability -->|"always"| mcpEvent
	observability -->|"platform failures only"| sentry
	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

Before / after

Before: execute sandbox failures (sandboxError: true) were captured in Sentry as warnings (Unknown: …), including thrown strings from caller modules such as b[t]?.title?.map is not a function.

After: sandbox failures remain on mcp-event logs; only non-sandbox MCP failures are sent to Sentry at error level.

Risk and invariants

  • Medium: changes production error visibility for one failure class; does not touch auth, storage isolation, or capability contracts.
  • Per-user isolation unchanged; Sentry user id attachment for platform MCP failures is unchanged.

Docs

No doc updates; behavior is an observability policy change covered by unit tests.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes
    • Prevented sandbox-related MCP failures from being reported to Sentry.
    • Ensured genuine platform errors are captured with error-level severity and the associated user context.
    • Preserved sandbox failure details in application logs for troubleshooting.

Caller/module errors (bad Notion filters, thrown strings, syntax issues)
already land on mcp-event logs. Sending them to Sentry as warnings opens
noise issues that look like platform bugs and trip triage automation.
KODY-CLOUDFLARE-1N reported Unknown: b[t]?.title?.map is not a function
from mcp.sandbox_error execute; assert that path skips Sentry.
@kody-bot
kody-bot marked this pull request as ready for review July 24, 2026 18:46
@kody-bot
kody-bot deployed to preview-918 July 24, 2026 18:46 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 02c59990-44fc-49aa-ae3c-40bbed9034c8

📥 Commits

Reviewing files that changed from the base of the PR and between 32d97b7 and 37ae7f3.

📒 Files selected for processing (2)
  • packages/worker/src/mcp/observability.node.test.ts
  • packages/worker/src/mcp/observability.ts

📝 Walkthrough

Walkthrough

MCP sandbox failures now remain in event logs without Sentry reporting. Non-sandbox failures continue through Sentry exception capture with error-level scope configuration, and tests cover both routing paths.

Changes

MCP observability

Layer / File(s) Summary
Failure reporting and validation
packages/worker/src/mcp/observability.ts, packages/worker/src/mcp/observability.node.test.ts
Sandbox failures return before Sentry interaction, while non-sandbox failures use an error-level scope and capture exceptions. Tests verify event logging, capture behavior, and user scope setup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • kentcdodds/kody#720: Adds console spying infrastructure used by the observability test’s console.info assertions.
  • kentcdodds/kody#917: Makes the corresponding sandbox failure and Sentry reporting changes in the same observability area.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: sandbox MCP failures are no longer reported to Sentry.
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.
✨ Finishing Touches
📝 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-1n-dc45

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.

@github-actions

Copy link
Copy Markdown
Contributor

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

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

Mocks:

This branch was successfully deployed

1 active deployment
preview-918 — 37ae7f38 Deployed Jul 24, 2026 by kody-bot via 🔎 Deploy Preview Resources #4091
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