Cancel Run
POST/runs/:run_id/cancel
Cancel a run that has not yet reached a terminal state.
Flips any non-terminal run (pending / claimed / running) to
cancelled in Postgres. A pending run is thereby dequeued — the worker
only claims pending rows, so a cancelled one is never picked up. A run
already claimed or running is stopped cooperatively: the worker polls the
run status and skips or aborts the in-flight pipeline task once it observes
the cancellation, and the terminal-state gate keeps its own completion write
from overwriting cancelled.
Already-terminal runs (completed / failed / retryable_failed /
cancelled) cannot be cancelled and return 409.
Requires workspace_editor or workspace_admin (or platform admin).
Request
Responses
- 200
- 403
- 404
- 409
- 422
Successful Response
Forbidden
Not Found
Conflict
Validation Error