blueclaw

Task run

A task run is the durable record of one unit of work, from intake to its final reply.

A run has one of nine statuses: planned, running, waiting_user_input, waiting_approval, blocked, interrupted, completed, failed, cancelled (declared in bluecollar's agentcontract/task_run.go). Every transition goes through TransitionTaskRun, which records a transition event.

Restarts are explicit. Runs orphaned by a crash are interrupted at boot, runs in flight are interrupted before a planned shutdown (POST /admin/api/runtime/prepare-shutdown), and interrupted runs are claimed for auto-resume exactly once. A stale-task sweeper and a retention job run under internal/scheduler.

Within a run the model works in steps. A step either calls a tool, speaks to the requester, or fails the task; a final reply closes the task and must cite the observations that prove the work happened (the completion gate in bluecollar).