Skip to content

fix(sentry): stop reporting D1 long-running export blocks - #930

Merged
kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-7632008645-b586
Jul 25, 2026
Merged

kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-7632008645-b586

Conversation

@kentcdodds

Copy link
Copy Markdown
Member

Summary

Filters Sentry noise from KODY-CLOUDFLARE-22 and sibling KODY-CLOUDFLARE-21 (Error: D1_ERROR: Currently processing a long-running export.).

Cloudflare D1 blocks other database requests while a REST/API export is in progress. Production events landed on /mcp during the nightly DR D1 export window (~02:15 UTC): handleMcpRequest → withAccountWriteLease → D1 write rejected with that exact message. This is expected platform unavailability during backups, not an application bug — the same class of transient D1 failure as SQLITE_BUSY.

This PR extends the existing retryable-D1 matcher so:

  1. runD1WithRetry / cron lane skip / module-artifact transient detection treat the export message like lock contention
  2. beforeSend (filterRetryableD1LockSentryEvent) drops matching events so backups do not open or regress Sentry issues

MCP requests can still fail for users while an export holds the DB (Cloudflare limitation; short app retries cannot cover a multi-minute export). We stop treating that as a platform defect in Sentry.

Test plan

  • d1-retry.node.test.ts matches both D1_ERROR: Currently processing… and bare cause-chain forms; retries export errors; still rethrows syntax errors immediately
  • sentry-options.node.test.ts drops the production exception chain and keeps unrelated D1 errors
  • Pre-push hooks (unit + e2e) passed on push
  • CI npm run validate green
System recap — composes existing primitives (low risk)

Mode: recap · Base: main @ 7b2e5749 · Head: 34a9865b

Classification: composes — narrow extension of the existing D1 transient matcher + Sentry beforeSend filter; no D1 schema, auth, or backup export contract changes.

Primitives touched

Primitive Group Impact
(unmatched) d1-retry.ts / sentry-options.ts observability composes — treat DR export blocks like SQLITE_BUSY for retry + Sentry drop

System map

Nightly DR D1 exports still block production queries; Sentry and cron/retry paths no longer treat that block as a novel platform failure.

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
	drExport["backup-control-plane<br/>Nightly D1 export"]:::untouched
	d1AppDb["d1-app-db<br/>Production D1"]:::untouched
	mcpServer["mcp-server<br/>/mcp write lease"]:::untouched
	d1Retry["d1-retry<br/>Transient matcher"]:::touched
	sentryFilter["sentry-options<br/>beforeSend filter"]:::touched
	drExport -->|"REST export holds DB"| d1AppDb
	mcpServer -->|"D1_ERROR long-running export"| d1AppDb
	d1AppDb -->|"isRetryableD1LockError"| d1Retry
	d1Retry -->|"beforeSend drop"| sentryFilter
	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 

Nightly DR D1 exports block other queries with
"Currently processing a long-running export". Treat that like
SQLITE_BUSY: retry where we already backoff, and drop it in beforeSend
so MCP/cron noise during backups does not open Sentry issues.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c11ba42-bbd4-42df-843e-c2fe4c6c9b72

📥 Commits

Reviewing files that changed from the base of the PR and between 7b2e574 and 34a9865.

📒 Files selected for processing (4)
  • packages/worker/src/d1-retry.node.test.ts
  • packages/worker/src/d1-retry.ts
  • packages/worker/src/sentry-options.node.test.ts
  • packages/worker/src/sentry-options.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/sentry-triage-7632008645-b586

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.

@cursor
cursor Bot marked this pull request as ready for review July 25, 2026 02:25
@github-actions

Copy link
Copy Markdown
Contributor

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

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

Mocks:

@kody-bot
kody-bot merged commit c1687e2 into main Jul 25, 2026
8 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-7632008645-b586 branch July 25, 2026 02:31
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