Skip to content

fix(cloud): unbreak main deploy — create SQLite DO without same-deploy delete#1193

Merged
RhysSullivan merged 1 commit into
mainfrom
fix-cloud-do-no-delete
Jun 28, 2026
Merged

fix(cloud): unbreak main deploy — create SQLite DO without same-deploy delete#1193
RhysSullivan merged 1 commit into
mainfrom
fix-cloud-do-no-delete

Conversation

@RhysSullivan

Copy link
Copy Markdown
Owner

Incident state

main currently fails to deploy (#1191): Cloudflare rejects the deleted_classes: ["McpSessionDO"] migration with code 10061 — it validates the delete against the live binding, which still points at McpSessionDO. So moving the binding and deleting the class can't happen in one deploy. Prod is on the rolled-back (working KV) version meanwhile.

Fix

Stop deleting in this deploy. v2 now only creates the new SQLite class and the binding moves to it:

  • migration v2: new_sqlite_classes: ["McpSessionDOSqlite"] (no deleted_classes)
  • MCP_SESSION binding → McpSessionDOSqlite
  • old KV McpSessionDO left orphaned + unbound, kept as a stub export in server.ts so the migration stays valid
  • regenerated MCP_SESSION binding type → McpSessionDOSqlite

No delete → no 10061. Session state is ephemeral, nothing lost.

Verified locally

  • typecheck 0, lint clean
  • built worker exports McpSessionDOSqlite (real, bound) and McpSessionDO (stub) — both present, which is what the migration needs

Expectations

  • PR Workers Build will still red with 10211 (versioned uploads can't apply DO migrations) — inherent, ignore.
  • The main deploy is non-versioned and applies the migration. This time v2 has no delete, so the 10061 can't recur.

Follow-up

Once this is live, a trivial later deploy can add deleted_classes: ["McpSessionDO"] + drop the stub (the binding is already off it).

…me deploy

The delete migration kept failing (code 10061): Cloudflare validates a class
delete against the LIVE binding, which still pointed at McpSessionDO, so binding
move + delete can't happen in one deploy. Drop the delete: v2 only creates the
new SQLite class McpSessionDOSqlite and the MCP_SESSION binding moves to it. The
old KV McpSessionDO is left orphaned (kept as a stub export so the migration
stays valid) and can be deleted in a later deploy now that nothing binds it.
Also repoint the generated MCP_SESSION binding type to McpSessionDOSqlite.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
executor-cloud fb561c3 Jun 28 2026, 10:28 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing fb561c3 Commit Preview URL

Branch Preview URL
Jun 28 2026, 10:27 PM

@greptile-apps

greptile-apps Bot commented Jun 28, 2026

Copy link
Copy Markdown

Greptile Summary

This PR is a targeted hotfix to unblock the main deploy that was failing with Cloudflare error 10061, caused by attempting to delete McpSessionDO and move its binding in the same migration step.

  • wrangler.jsonc: Removes deleted_classes: ["McpSessionDO"] from the v2 migration so it only creates McpSessionDOSqlite via new_sqlite_classes, avoiding the 10061 validation error; the MCP_SESSION binding moves to the new class.
  • server.ts: Adds a minimal McpSessionDO extends DurableObject {} stub export (with a detailed comment) so the v1 migration entry remains valid — Cloudflare requires all migration-listed classes to be exported from the worker entrypoint.
  • worker-configuration.d.ts: Updates the MCP_SESSION binding type to reference McpSessionDOSqlite.

Confidence Score: 5/5

Safe to merge — the change is a minimal, well-scoped hotfix that removes the problematic deleted_classes entry and adds a no-op stub export with a clear cleanup note.

All three files make exactly the changes described: the migration no longer tries to delete McpSessionDO in the same step that moves its binding, the stub export satisfies Cloudflare's requirement that every migration-listed class be exported, and the binding type declaration is correctly updated. Session state is ephemeral so there is no data-loss concern. The follow-up cleanup path is clearly documented in both the comment and the PR description.

No files require special attention.

Important Files Changed

Filename Overview
apps/cloud/wrangler.jsonc Removes deleted_classes: ["McpSessionDO"] from the v2 migration; v2 now only creates McpSessionDOSqlite via new_sqlite_classes. The binding update and updated comment are correct.
apps/cloud/src/server.ts Adds a well-documented empty McpSessionDO extends DurableObject {} stub export to keep the v1 migration valid; adds the required DurableObject import. No runtime path touches the stub.
apps/cloud/worker-configuration.d.ts Auto-generated file; updates MCP_SESSION binding from McpSessionDO to McpSessionDOSqlite. The GlobalProps.durableNamespaces field still only lists "McpSessionDO" (pre-deploy state), which is expected — it will update on the next wrangler types run after deploy.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Dev as Developer
    participant CF as Cloudflare
    participant W as Worker (main)

    Note over Dev,W: Previous broken deploy (PR #1191)
    Dev->>CF: "Deploy v2 migration<br/>(deleted_classes: McpSessionDO +<br/>new_sqlite_classes: McpSessionDOSqlite)"
    CF-->>Dev: "Error 10061 — cannot delete class<br/>while live binding still references it"

    Note over Dev,W: This PR — Phase 1
    Dev->>CF: "Deploy v2 migration<br/>(new_sqlite_classes: McpSessionDOSqlite only)"
    CF->>W: Create McpSessionDOSqlite (SQLite-backed)
    CF->>W: Move MCP_SESSION binding to McpSessionDOSqlite
    Note over W: McpSessionDO stub still exported<br/>(satisfies v1 migration, unbound)
    CF-->>Dev: Deploy succeeds

    Note over Dev,W: Future follow-up deploy — Phase 2
    Dev->>CF: "Deploy v3 migration<br/>(deleted_classes: McpSessionDO)"
    CF->>W: Remove McpSessionDO class
    CF-->>Dev: Cleanup complete
Loading
%%{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 Dev as Developer
    participant CF as Cloudflare
    participant W as Worker (main)

    Note over Dev,W: Previous broken deploy (PR #1191)
    Dev->>CF: "Deploy v2 migration<br/>(deleted_classes: McpSessionDO +<br/>new_sqlite_classes: McpSessionDOSqlite)"
    CF-->>Dev: "Error 10061 — cannot delete class<br/>while live binding still references it"

    Note over Dev,W: This PR — Phase 1
    Dev->>CF: "Deploy v2 migration<br/>(new_sqlite_classes: McpSessionDOSqlite only)"
    CF->>W: Create McpSessionDOSqlite (SQLite-backed)
    CF->>W: Move MCP_SESSION binding to McpSessionDOSqlite
    Note over W: McpSessionDO stub still exported<br/>(satisfies v1 migration, unbound)
    CF-->>Dev: Deploy succeeds

    Note over Dev,W: Future follow-up deploy — Phase 2
    Dev->>CF: "Deploy v3 migration<br/>(deleted_classes: McpSessionDO)"
    CF->>W: Remove McpSessionDO class
    CF-->>Dev: Cleanup complete
Loading

Reviews (1): Last reviewed commit: "fix(cloud): create SQLite DO without del..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@RhysSullivan RhysSullivan merged commit 8109db1 into main Jun 28, 2026
14 of 15 checks passed
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.

1 participant