Docs
Execution states (canonical contract)
Execution states (canonical contract)
Terminal execution semantics for workflow runs and tasks — QUEUED, RUNNING, SUCCEEDED, FAILED, SKIPPED, TIMEOUT, and CANCELLED.
Cascades persists Prisma enums (WorkflowRunStatus, TaskRunStatus). Public HTTP contracts and integrations should use the canonical state names below for stable docs and clients.
Workflow run (canonical)
| Canonical | Persisted mapping |
|---|---|
QUEUED | PENDING (awaiting worker / executor handoff) |
RUNNING | RUNNING |
SUCCEEDED | SUCCESS |
FAILED | FAILED (no task timeout detected) |
TIMEOUT | Derived when any failed task error matches a timeout pattern (e.g. [TIMEOUT], timeout after …) |
CANCELLED | CANCELLED |
Every run should end in a terminal canonical state (SUCCEEDED, FAILED, TIMEOUT, or CANCELLED). If the executor crashes mid-run, it finalizes the row to FAILED and fails open tasks so nothing stays stuck in RUNNING indefinitely.
Task run (canonical)
| Canonical | Persisted mapping |
|---|---|
QUEUED | PENDING or QUEUED |
RUNNING | RUNNING |
RETRYING | RETRYING |
SUCCEEDED | SUCCESS |
FAILED | FAILED (non-timeout) |
SKIPPED | SKIPPED |
TIMEOUT | FAILED where error indicates executor timeout |
CANCELLED | CANCELLED |
Task timeouts use the executor’s withTimeout guard; timeout failures are labeled in the stored error field so callers can surface TIMEOUT without a DB migration.
API surfaces
- Experimental proof summary:
GET /api/workflows/{id}/proof— returnscanonicalWorkflowStateand per-task canonical states (see OpenAPI Proof APIs under/openapi.json). - Run submission:
POST /api/workflows/run— may return 503 whenENV_TIERisstagingorproductionand the BullMQ worker path is not configured.
Related
- Queue workers — API vs worker process separation
- Failure recovery