You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Writes during a D1 handoff fail once: retry CAS-anchored writes safely by reading the anchor back #324
Found by the cluster failover test (#290, PR #322).
When the instance that owns D1 stops gracefully, the D1 Durable Object moves, and a request that was on its way to it gets D1_ERROR: Network connection lost. #322 makes D1Driver retry read-only statements a few times (about 2 s in all). Writes and batches are deliberately not retried, because a lost write may already have been applied. So a write that lands in that window fails once: a Studio save or an agent's tool call returns an error and has to be repeated. The same happens on Cloudflare after a deploy or an eviction.
Idea. Every graph write is a batch() anchored on a content hash (CAS). After a transient error, the writer could read its anchor back:
the new hash is stored → the write was applied, so report success;
the old hash is stored → the write was lost, so retry it once;
anything else → conflict, as today.
That gives an idempotent retry without transactions (AGENTS.md rule 4).
Done when: graph writes caught in a D1 move either succeed or fail with a conflict, never a transient error; the failover test also checks writes during the SIGTERM handoffs; and the conformance suites cover the read-back on SQLite and D1.
Activity
fix(core-ts): graph writes caught in a D1 move are settled, never los…
Merge pull request #347 from cloudhal-dev/claude/d1-handoff-writes-324