Skip to main content

Module handover

Module handover 

Source
Expand description

Taking a branch over from an earlier attempt at the same task.

A retried task can reopen a branch (magi/f82f/A) that the previous run still has checked out in its own worktree. Git holds a branch in one worktree at a time, so the new run’s review cannot start, and the only way forward used to be an agent asking the operator whether the old worktree may be deleted. Auto-fold cannot help: it only folds terminal runs, and an unfinished run keeps its worktrees on purpose so it can be resumed.

When the run holding the branch is an earlier attempt at the same task (crate::queue::Task::earlier_attempts) - superseded or not: blocked, failed, stale or parked alike - and nothing is driving it, its worktree (and only its worktree) is released before the review starts. The branch, every commit and any pull request stay exactly where they were.

decide is pure; release is the only function here that touches git or disk. Only a queue-driven review takes over anything: a hand-run magi review has no task, so it carries no Takeover and behaves as it always did.

Structs§

Holder
What is known about the run and worktree holding the branch.
Refused
The operator has to decide: the takeover was refused, and the text says why.
Released
A worktree that was released, with what is needed to put it back if the review that took the branch over never starts.
Takeover
The earlier attempts at a task a new run may take a branch over from.

Enums§

Decision
The verdict of decide.

Functions§

decide
Whether holder’s worktree may be released to a new run.
release
Release the worktree holding branch to new_run, when an earlier attempt at the same task holds it and it is safe. Returns the run whose worktree was released (see Released), or None when nothing needed (or was allowed) to happen.