Skip to content

fix(sentry): drop bare Cloudflare DO isolate reset noise - #962

Merged
kody-bot merged 3 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-2c-c990
Jul 26, 2026
Merged

kody-bot merged 3 commits into
mainfrom
cursor/sentry-triage-kody-cloudflare-2c-c990

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Jul 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Sentry KODY-CLOUDFLARE-2C fired when MCP job_run_now hit JobManager during a burst of heavy runs (~45–50s successes, then failure). Cloudflare reset the Durable Object isolate with:

Durable Object's isolate exceeded its memory limit and was reset.

User job code runs in the LOADER sandbox; this error is the orchestrating JobManager DO exceeding platform memory/CPU limits. The next RPC gets a fresh isolate. App-level retry is unsafe for non-idempotent jobs, and moving heavy orchestration off JobManager is an architectural change outside triage scope.

This PR adds a targeted beforeSend filter for the exact Cloudflare isolate memory/CPU reset strings (same class as D1 object-reset blips). Events are dropped only when every reported message is a bare reset, so chained/wrapped recovery failures stay Sentry-visible. mcp-event logs are unchanged.

Related but separate: #960 stops per-attempt Sentry capture on publish DO-reset retries (RepoSession path).

Test plan

  • npm run test -- --run packages/worker/src/sentry-options.node.test.ts
  • CI validate green
System recap — composes existing primitives (low risk)

Mode: recap · Base: main @ 81799504 · Head: 01dc833f

Classification: composes — observability-only beforeSend filter for exact Cloudflare DO isolate reset strings; no capability, storage, or auth contract changes.

Primitives touched

Primitive Group Impact
(unmatched paths) packages/worker/src/sentry-options.ts — composes — narrow beforeSend drop for bare DO memory/CPU isolate resets

System map

MCP job_run_now (and similar DO RPC callers) can surface Cloudflare isolate resets when a warm JobManager DO hits platform limits; those exact strings no longer open Sentry issues.

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
	jobs["jobs<br/>JobManager / job_run_now"]:::untouched
	sentryOpts["sentry-options<br/>beforeSend filters"]:::touched
	jobs -->|"DO isolate memory/CPU reset"| sentryOpts
	sentryOpts -->|"exact bare message → drop"| sentryOpts
	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

Change flow

sequenceDiagram
	participant Cap as job_run_now
	participant DO as JobManager DO
	participant MCP as mcp-event log
	participant Sentry as Sentry beforeSend
	Cap->>DO: runNow (heavy successive runs)
	DO-->>Cap: isolate memory/CPU reset
	Cap->>MCP: failure still logged
	Cap->>Sentry: captureException
	Note over Sentry: exact bare CF reset string dropped
Loading
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes
    • Reduced noise in error monitoring by filtering transient Durable Object isolate memory and CPU reset events.
    • Improved event classification to correctly drop exact reset message variants across both exception and top-level message.
    • Preserved visibility for exhausted recovery events and unrelated reset errors.

Exact Durable Object memory/CPU isolate-reset messages are transient
platform limit hits (for example successive job_run_now on JobManager).
Filter them in beforeSend while keeping wrapped recovery failures visible.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Durable Object isolate memory and CPU reset messages are normalized, recognized, and filtered from Sentry events. Tests cover prefixed and punctuated variants while preserving recovery-exhausted and unrelated reset events.

Changes

Durable Object reset filtering

Layer / File(s) Summary
Reset detection and Sentry filtering
packages/worker/src/sentry-options.ts
Adds reset message constants, normalization and classification helpers, shared filter integration, and updated beforeSend documentation.
Reset filter test coverage
packages/worker/src/sentry-options.node.test.ts
Tests filtering of exact and normalized reset messages while preserving recovery-exhausted and unrelated Durable Object reset events.

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

Possibly related PRs

  • kentcdodds/kody#960 — Both address transient Durable Object isolate reset Sentry behavior.
  • kentcdodds/kody#926 — Both modify the shared Sentry filtering entry point for message-specific event suppression.
  • kentcdodds/kody#928 — Both add message-specific helpers to the shared Sentry filtering pipeline.
🚥 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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: filtering bare Cloudflare Durable Object isolate reset noise from Sentry.
✨ 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-2c-c990

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 July 26, 2026 14:23
@github-actions

github-actions Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

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

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

Mocks:

@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/sentry-options.ts`:
- Around line 114-119: Update isDurableObjectIsolateResetSentryEvent in
packages/worker/src/sentry-options.ts to preserve events when any exception
message is non-reset, rather than allowing an exact bare reset value anywhere to
discard the event; retain filtering for events containing only reset messages.
In packages/worker/src/sentry-options.node.test.ts, model the recovery failure
as separate outer and inner exception values, with the inner value containing
the bare reset cause, and verify the chained event is preserved.
🪄 Autofix (Beta)

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: 275579f3-d563-4785-952b-b4cd0a5cd9d8

📥 Commits

Reviewing files that changed from the base of the PR and between 8179950 and 1c0e150.

📒 Files selected for processing (2)
  • packages/worker/src/sentry-options.node.test.ts
  • packages/worker/src/sentry-options.ts

Comment thread packages/worker/src/sentry-options.ts Resolved
cursoragent and others added 2 commits July 26, 2026 14:27
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Only drop events where every reported message is a bare Cloudflare
isolate reset, so outer recovery wrappers with an inner reset cause
still reach Sentry.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kody-bot
kody-bot merged commit f370021 into main Jul 26, 2026
10 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-kody-cloudflare-2c-c990 branch July 26, 2026 14:36
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