fix(cloud): repoint MCP DO binding to new SQLite class (unbreaks main deploy)#1191
Conversation
…f the deleted KV class CF rejects deleting McpSessionDO while MCP_SESSION still binds it (code 10061), and won't reuse a deleted class name. Rename the concrete class + all refs to McpSessionDOSqlite, repoint the binding, and have v2 delete the old KV McpSessionDO + create the new SQLite class. Verified the built worker exports McpSessionDOSqlite and nothing named McpSessionDO.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
executor-cloud | 7fca096 | Jun 28 2026, 09:52 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | 7fca096 | Commit Preview URL Branch Preview URL |
Jun 28 2026, 09:52 PM |
Greptile SummaryThis PR fixes a broken
Confidence Score: 5/5Safe to merge — all changes are consistent renames with no logic alterations, and the migration correctly leaves no binding referencing the deleted class. Every TypeScript file that previously imported or exported McpSessionDO has been updated to McpSessionDOSqlite. The wrangler binding, the Sentry wrapper export, the .serve() call, and the mcpExport config all agree on the new name. The v2 migration atomically deletes the old KV class (now unreferenced) and creates the new SQLite class in a single step, which is the pattern Cloudflare requires for this scenario. Session state is intentionally ephemeral so there is no data-loss concern. No files require special attention — the rename is mechanical and complete across all five changed files. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant CF as Cloudflare
participant W as Worker (server.ts)
participant AH as agent-handler.ts
participant DO as McpSessionDOSqlite (SQLite)
Note over CF: wrangler deploy (main, non-versioned)<br/>Migration v2 applies atomically:<br/>deleted_classes: [McpSessionDO]<br/>new_sqlite_classes: [McpSessionDOSqlite]
CF->>W: fetch /mcp/...
W->>AH: mcpAgentHandler(request, env, ctx)
AH->>AH: "McpSessionDOSqlite.serve("/mcp", { binding: "MCP_SESSION" })"
AH->>CF: env.MCP_SESSION (→ McpSessionDOSqlite namespace)
CF->>DO: stub.fetch(request)
DO-->>W: Response
W-->>CF: Response
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant CF as Cloudflare
participant W as Worker (server.ts)
participant AH as agent-handler.ts
participant DO as McpSessionDOSqlite (SQLite)
Note over CF: wrangler deploy (main, non-versioned)<br/>Migration v2 applies atomically:<br/>deleted_classes: [McpSessionDO]<br/>new_sqlite_classes: [McpSessionDOSqlite]
CF->>W: fetch /mcp/...
W->>AH: mcpAgentHandler(request, env, ctx)
AH->>AH: "McpSessionDOSqlite.serve("/mcp", { binding: "MCP_SESSION" })"
AH->>CF: env.MCP_SESSION (→ McpSessionDOSqlite namespace)
CF->>DO: stub.fetch(request)
DO-->>W: Response
W-->>CF: Response
Reviews (1): Last reviewed commit: "fix(cloud): use a new SQLite DO class na..." | Re-trigger Greptile |
Cloudflare previewTorn down — the PR is closed. |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
Why
The previous fix attempt (merged) deletes
McpSessionDObut theMCP_SESSIONbinding still referenced it, so the non-versionedmaindeploy failed:maincurrently fails to deploy. Prod is still on the rolled-back (working KV) version.Fix
Use a new SQLite class name and move the binding to it first, so the old KV class is unreferenced and can be deleted (Cloudflare's documented KV→SQLite path):
McpSessionDOSqliteMCP_SESSIONbinding →McpSessionDOSqlitev2:deleted_classes: ["McpSessionDO"]+new_sqlite_classes: ["McpSessionDOSqlite"]Verified locally (the part CI can't check)
The built worker exports
McpSessionDOSqlite×5 andMcpSessionDO×0 — the deleted class is no longer exported and nothing binds it, which is exactly what error 10061 required. typecheck + lint clean.Deploy note
The PR Workers Build will still red with
code 10211("migrations must be applied via a non-versioned deployment") — that's inherent to PR preview builds and not a real failure. Themainbuild is non-versioned (it got to applying the migration last time), so merging applies the migration. Migration state isv1(the prior attempt failed atomically), sov2applies cleanly on merge.