Skip to content

Fix MCP init crash on remote connector snapshot timeout - #914

Merged
kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-kody-cloudflare-1d-83c3
Jul 24, 2026
Merged

kody-bot merged 1 commit into
mainfrom
cursor/sentry-triage-kody-cloudflare-1d-83c3

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Jul 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

Sentry KODY-CLOUDFLARE-1D: RemoteConnectorSnapshotTimeoutError for connector "home" was aborting /mcp session setup.

  • Capability registry already soft-failed stalled connector snapshots (Bound stalled remote connector snapshot reads #847)
  • MCP Durable Object init() still loaded remote-connector instruction summaries without a catch, so a 5s snapshot timeout rejected Promise.all and failed the whole handshake (handleMcpRequest → getServerByName → retryDurableObjectOperation)
  • Extract loadRemoteConnectorInstructionSummaries and omit stalled connectors instead of failing init
  • Add regression coverage for mixed healthy/stalled connectors

Validation

  • npm run validate passed (format, lint, typecheck, 1282 unit tests, 18 Playwright e2e, 2 MCP e2e, primitives, migrations)

Do not merge until CI is green and reviewed.

System recap — extends existing primitives (medium risk)

Mode: recap · Base: main @ 49893e20 · Head: 81982f5f

Classification: extends — MCP session init now soft-fails stalled remote-connector snapshot reads used for instruction summaries.

Primitives touched

Primitive Group Impact
mcp-server surfaces extends — instruction-summary loading no longer fails MCP DO init when a connector snapshot times out

System map

MCP init loads instruction summaries and the capability registry in parallel; only the registry path was fail-soft before this change.

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
	mcpRequest["/mcp request"]:::untouched
	mcpServer["mcp-server<br/>MCP DO init"]:::extended
	snapshotCache["remote connector<br/>snapshot cache"]:::untouched
	registry["capability-registry"]:::untouched
	mcpRequest --> mcpServer
	mcpServer -->|"instruction summaries: catch timeout → omit"| snapshotCache
	mcpServer -->|"already fail-soft (#847)"| registry
	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

Invariants

Connector snapshot cache keys remain user-scoped; soft-fail omits only the stalled connector's instruction summary and never substitutes another user's connector data.

Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Remote connector information now loads more reliably during MCP session initialization.
    • Unavailable or stalled connectors no longer prevent healthy connector information from being included.
    • Connector snapshot failures are handled individually, allowing sessions to continue successfully.
  • Tests

    • Added coverage for stalled connector requests and timeout handling.

Capability registry already soft-failed stalled connectors, but MCP session
init still loaded instruction summaries without a catch, so a 5s snapshot
timeout aborted the whole /mcp Durable Object handshake.
@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: 3e075af0-d5b2-4a46-b3f5-9449ef5aad44

📥 Commits

Reviewing files that changed from the base of the PR and between 49893e2 and 81982f5.

📒 Files selected for processing (3)
  • packages/worker/src/mcp/index.ts
  • packages/worker/src/mcp/remote-connector-instruction-summaries.node.test.ts
  • packages/worker/src/mcp/remote-connector-instruction-summaries.ts

📝 Walkthrough

Walkthrough

The remote connector instruction summary loader moves into a dedicated module. MCP initialization imports the helper, and a new test verifies stalled connector snapshots do not prevent healthy connector summaries from being returned.

Changes

Remote connector summaries

Layer / File(s) Summary
Implement and validate summary loading
packages/worker/src/mcp/remote-connector-instruction-summaries.ts, packages/worker/src/mcp/remote-connector-instruction-summaries.node.test.ts
The extracted helper normalizes references, fetches snapshots concurrently, returns successful summaries, omits failed connectors, and is tested with a stalled snapshot.
Wire the extracted loader into MCP initialization
packages/worker/src/mcp/index.ts
MCP initialization imports the dedicated helper and removes the former local implementation and its unused dependencies.

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

Possibly related PRs

  • kentcdodds/kody#418: Updates remote connector MCP clients and status APIs to use user-scoped operations.
  • kentcdodds/kody#847: Adds timeout-bounded remote connector snapshot reads and cache eviction.
🚥 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: preventing MCP init crashes when remote connector snapshot requests time out.
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-1d-83c3

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.

@kentcdodds
kentcdodds marked this pull request as ready for review July 24, 2026 18:31
@github-actions

Copy link
Copy Markdown
Contributor

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

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

Mocks:

@kody-bot
kody-bot merged commit dc25e71 into main Jul 24, 2026
8 checks passed
@kody-bot
kody-bot deleted the cursor/sentry-triage-kody-cloudflare-1d-83c3 branch July 24, 2026 18:58
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