Expand description
Runs started by hand are tasks.
magi run and magi review used to mint a run no task knew about: no
detail page, no attempt history, invisible to duplicate detection, and an
orphan the moment anything cleaned up after it. They now file a task first,
through the queue like magi task add, and then either hand it to a live
loop or execute it here through the daemon’s own attempt
(crate::daemon::run_claimed). There is no second dispatcher in this
module: it decides who runs the task and watches it, nothing more.
- A live loop in another process (a fresh
daemon.jsonheartbeat, seecrate::daemon::foreign_loop) gets the task asurgent, runs it in its own urgent slot, and the callerfollows it. The caller never claims or executes it: two processes must not drive one task. - Otherwise the caller claims the task before it is written, so a loop that starts mid-run finds the claim and leaves it alone, and executes it.
Structs§
- Adopted
- A run opened inside this process (the follow-up review of
magi fix) and the task that owns it. Seeadopt. - Filing
- What to file. Everything
magi run/magi reviewtake that changes what the run does rides on the task, so a loop that executes it behaves the same as this process would have. - Followed
- How a followed task ended up.
Enums§
- Filed
- Who will execute a filed task.
Functions§
- adopt
- Give a run this process is about to execute an owning task. A parent task
that exists and is queued, failed or held is claimed, started with the
run and settled by
Adopted::finishexactly like an ownerless run’s; if somebody else holds its claim, or the task is Done, blocked or running, the run is only linked and nothing is settled. With no such parent, a task is filed and claimed for the duration.Ok(None)when no magi home is pinned, or when the run was only linked to its parent. An error means the run has no owner and must not be executed: filing or claiming the new task failed. - config_
for - The config a task’s run is built with: the task’s
--configlayer, then its overrides andsolo. What the loop’sattemptdoes, for the dry run. - file
- File
filingand decide who runs it.homeis the magi home whosedaemon.jsonis judged;own_pidis this process (a loop of our own is not “another” one).force_local(--dry-run) never hands over: a dry run spends no agent call and a loop would not honour that. - follow
- Watch
iduntil the loop that owns it is done with it, callingseenwith each run id the first time it appears on the task, andprogresswith a line whenever the newest run’s status changes.