Repository navigation
feat(mcp): durable Tasks-extension records across server restarts - #745
Conversation
Terminal task records (completed/failed/cancelled) now persist to a durable task store mirroring the session-store pattern: file store under <sessionDir>/tasks locally, Supabase mcp_tasks (migration 037) when the service-role env is present, in-memory no-op otherwise. tasks/get hydrates from the store on a cache miss before reporting unknown. taskIds now embed the minting process's boot token (same scheme as session ids), so a taskId orphaned by a restart — in-flight tasks cannot resume, the bridge dies with the process — reports an honest failed-by-restart status with a re-issue remediation instead of an unknown-id error. When the store is not durable, the CreateTaskResult statusMessage says the handle will not survive a restart. Migration 037 is NOT yet pushed to prod (supabase db push deploys it). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Choji review — Looks good The prior findings (P1 fire-and-forget race, P2 timing-dependent sleep) are both resolved: pendingPersists tracking + flushTaskPersists() replaces the 100 ms sleep, and the persist promise is correctly removed from the set in its own finally handler. The new logic is sound — boot-token discrimination, store hydration on cache miss, and orphan reporting all look correct. No findings — looks good. Verified by ChojiChoji ran your change live — checks failed. 2 checks.
Checks marked environment failed in Choji's sandbox, not against your PR. They never block. No live preview was run for this backend/MCP change. The No issues found in the running app. Reviewed |
… round-trip test Track in-flight terminal-record writes in a module-level set and expose flushTaskPersists(); the durability test awaits it instead of sleeping 100ms and hoping the fire-and-forget save landed. (Choji review on #745.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Addressed the Choji findings in e8446dd: terminal-record persists are now tracked in a module-level set with an exported 🤖 Addressed by Claude Code |
Dismissing prior approval to re-evaluate e8446dd.
What
Stacked on #743 (retarget to
mainafter it merges). Completes the first follow-up from that PR: Tasks-extension records now survive server restarts — without pretending a half-run background tool can resume (it can't; the in-process bridge dies with the process).Three guarantees:
packages/mcp/src/task-store.ts, mirroring the session-store pattern exactly): file store under<sessionDir>/taskslocally, Supabasemcp_tasks(migration 037, capability-keyed + service-role-only likemcp_artifacts) when the env is present, in-memory no-op otherwise.tasks/gethydrates from the store on a cache miss before reporting unknown, and re-caches.task_<tok>_<random>, same scheme as session ids). A prior-boot taskId with no durable terminal record gets astatus:"failed"task result explaining the server restarted mid-run and the call should be re-issued — not an unknown-id error. A same-boot unknown id still errors as a typo.isSessionStoreDurable()is false, theCreateTaskResultstatusMessage notes the handle will not survive a restart (the session-minting tools' pattern).Not included
supabase db push.notifications/progressfrom router/solvers) needs progress hooks through the kernel/WASM boundary and stays deferred.Verification
protocol-2026.test.ts(env-isolated temp dir, per the durability-smoke pattern): terminal round-trip through a simulated restart, failed-by-restart orphan reporting on get and cancel, typo-vs-restart distinction, TTL expiry through the store, and both durability-note branchestsc --noEmitclean;deprecated-surfacetripwire green🤖 Generated with Claude Code