Repository navigation
Description
Parent epic: #2116
Priority and sequence
P0 within the Context Engine epic · CE06. Required for the first two-song/two-brief checkpoint.
Customer journey
A request loses its browser connection or one research provider fails. The customer reconnects to the same request and keeps completed analysis without paying to repeat it.
Customer value and architecture
Make enrichment recoverable and independent from website generation.
Scope
- Persist a domain request ID before dispatch; accept owner-scoped idempotency keys and recover dispatch gaps and lost responses.
- Run independent modules with explicit attempts, workflow/provider IDs, input versions, progress and partial outcomes; persist each useful result before other modules finish.
- Deduplicate compatible active module work within the same authorized owner scope; return the existing logical request on retries.
- Define cancellation of this request, including running/completed work and settlement; cross-customer sharing of running jobs is out of scope.
- Use Vercel Workflows in API; no new Trigger.dev jobs, separate scheduler or global four-minute workflow cap. Provider timeouts/retries remain bounded and recoverable.
Acceptance criteria
- Concurrent duplicate submissions and response loss recover one logical request and its status.
- Successful modules remain available after another module fails; retries rerun only missing/invalidated work.
- Dispatch recovery and worker restarts do not repeat completed provider work unnecessarily.
- Request success, provider success, valid parsing, coverage and accepted document state stay distinct.
- Cancellation, permission changes and retry limits have deterministic persisted outcomes.
Blocking dependencies
These are completion prerequisites, mirrored by native GitHub blocked-by links. Contracts, fixtures and independent scaffolding may begin earlier.
Execution gates
Synthetic runs first. Every paid provider invocation must pass CE07 authorization.
Validation
Inject dispatch loss, callback/response loss, crash after module commit, mixed success/failure, cancellation races and duplicate requests using fake providers.
Owning implementation
API Vercel Workflows + shared context operations
Delivery conventions
Shared API business logic serves HTTP, MCP and workers; clients do not duplicate it. Validate input with Zod and use the existing Supabase access layer. Database changes go through database-repository migrations and PRs. Use Vercel Workflows for new durable work. Reuse existing credits and record costs without exposing credentials or private traces. Every owning repository uses a feature branch and PR; distinguish fixture, local, merged and deployed verification.
Implementation checkpoint — 2026-09-22
Current saved-request workflow invokes Spotify metadata only. Connect the server-built module plan to durable per-module execution, authorized dispatch and saved receipts; test dependency ordering, independent parallel work, revocation and recovery without duplicate paid attempts.
Activity
Add owner-scoped cancellation for saved Context requests
sidneyswift commentedon Nov 6, 2026
Partly done. Requests are saved before dispatch with idempotency keys, execution plans and per-node outcomes are recorded (recoupable/database#77, recoupable/api#917), and uncertain claims or lost save acknowledgements stop for reconciliation instead of recording false failures (recoupable/api#974).
Still open: the durable Context workflow does not yet run planned modules (blocked-plan recording is off by default), and owner-scoped cancellation is unmerged (recoupable/api#1017, recoupable/database#106).