Skip to main content

run_claimed

Function run_claimed 

Source
pub async fn run_claimed(opts: &Opts, queue: &Queue, task: &mut Task)
Expand description

Run one task this process has claimed, in this process, through exactly the attempt a daemon would make: the same starter choice (start, resume, review), the same Task::start / settle transitions, attempt counting, quota refund and parking. No second dispatcher - magi run and magi review call this when no daemon is alive.

The caller holds the Queue::claim for the whole call, which is what keeps a daemon that starts meanwhile from taking the task.

The one deliberate difference from the loop: a task the attempt leaves runnable (failed with attempts to spare, or requeued) is held instead. Nobody asked for a retry, and a daemon starting later must not spend agent calls re-running a hand-started task behind the operator’s back; magi task release is the explicit retry.