Recovery and resume
Recovery persists run and step progress to PostgreSQL when exec_config.recovery_enabled is true. After failure or interrupt, a new run or resume API can continue from the last committed state instead of restarting from step zero. Linear recovery is production-ready. Graph checkpoint persistence exists, but full resume dispatch from mid-graph checkpoints is partial (Graph recovery resume).
Architecture: Execution model. Known gap detail: Maturity and known gaps.
Enabling recovery
Requirements:
ARCFLOW_POSTGRESQL_URLon server (or SDK with Postgres-backed features)- Migrations applied:
arcflow migrate up(000001 through 000007) - Server
/readyreturns 200 only when migrations are current
Embedded SDK runs without Postgres skip persistence unless you configure a database URL for recovery features.
What gets persisted
| Store | Contents |
|---|---|
arcflow_recovery_state | Recovery id, completed steps, graph checkpoint fields |
arcflow_runs | Run status, result snapshot, interrupt payload |
RecoveryState fields (Postgres)
| Field | Linear | Graph |
|---|---|---|
recovery_id | Yes | Yes |
original_run_id | Yes | Yes |
completed_steps | Step indices committed | Node completion tracking |
failed_at_step_index | Resume point hint | May apply |
execution_mode | linear | graph |
current_node_id | N/A | Last checkpoint node |
graph_iteration_count | N/A | Loop counter |
pending_join | N/A | Join synchronization state |
Graph columns added in migration 20240531000002.
Linear resume (production-ready)
After each committed step, state is durable. On resume:
WorkflowRecoveryStartedtrace withresume_from_step- Engine skips completed steps
- Continues from next step
WorkflowRecoveryCompletedwithsteps_re_executed
Example trace excerpt:
Linear flows: Linear workflows.
Graph checkpoints (Graph recovery resume partial)
After each graph node, when recovery is enabled, persist_graph_checkpoint upserts:
current_node_idgraph_iteration_countpending_join(join synchronization)
Graph recovery resume: Schema and persist path are implemented. Resume dispatch that continues mid-DAG from checkpoint is incomplete. Do not depend on graph resume in production until Graph recovery resume closes ().
Safe today:
- Graph forward execution with checkpoints written
- Linear recovery
- Re-run graph workflows from entry after failure (new run)
Not production-complete:
- Resume API continuing exact graph node after crash mid-parallel branch
Graph authoring: Graph workflows.
HITL and recovery
Human-in-the-loop requires recovery_enabled. Interrupt state lives in Postgres (arcflow_human_approvals, run snapshot columns, migration 20240531000004).
Flow:
Poll interrupt payload:
Approve:
Response:
Idempotency
Idempotency-Key header on POST /v1/runs deduplicates identical submissions within the server window (Postgres-backed). Distinct from recovery resume but prevents duplicate runs from client retries.
Migrations and operations
Pending migrations cause /ready to fail. See Install and build and Server API quickstart.
Run state machine
ExecutionStatus values: Pending, Running, Completed, Failed, Retrying, Cancelled, Interrupted.
Trace persistence
When configured, trace data policy events also land in arcflow_trace_events (migration 20240531000005). CLI: arcflow trace <run_id>. Server: GET /v1/runs/{id}/trace.
Testing recovery
Use test mode for step outputs plus recovery enabled:
Simulate failure between steps in integration tests by aborting process mid-run, then invoking resume API per your deployment's supported surface (server/SDK).