Run Lifecycle
How runs.status and runs.gate_status move through creation, dispatch, finalization, cancellation, and terminal outcomes.
Notes
run createfirst inserts a non-dispatchablecreatingrun with a durable placement ledger and chunk plan. Once every placement is seeded, one control transaction creates dispatch cursors and changes the run topending.- Coordinators claim expired creation leases before dispatch work and resume
pending placement seeds with the original
run_id. Persisted-data conflicts fail creation without opening dispatch cursors. - Coordinator dispatch claims an open
run_id + run_shardcursor, marks a newpendingrun asrunning, selects a bounded shard-local chunk window, and inserts onerun.chunk.readyoutbox event record per selected chunk. - Before dispatch and finalization, the coordinator recovers expired worker chunk leases or marks exhausted chunks failed.
- Finalization only claims runs whose chunks are all terminal and whose finalization lease is open;
pendingorleasedchunks keep the run out of finalization, including chunks waiting for execution retry windows. - Finalization verifies and merges one bounded scorecard per shard, applies the frozen run gates, and stores the scorecard with the final gate status under the same coordinator lease.
- Cancellation applies to
pending,running, andfinalizingruns. Acreatingrun is owned by the creation recovery workflow until it becomespendingorfailed.