Landing

Note

New goals go through the wizard, whose Go step starts their swarm; this page is the reference for the swarm machinery Go runs.

Once every task has its pull request, a swarm is landing. Its PRs merge in a merge order: what a task waits for merges first, and otherwise the plan's order. heed shows that order everywhere the swarm's PRs are, holds a PR back while what it waits for is unmerged, moves a stacked PR on once the PR it stacks on merged, and ends the swarm once every task merged. The merging itself is the pilot's: each PR merges by its get it merged setting (the swarm's, when you gave it one), and a swarm never merges anything to main on its own.

A landing swarm: the merge order on the right, the two PRs stacked on #412 held after it

The order is the plan's tasks with every task after the tasks it waits for (its after), and otherwise as the plan lists them. Only the plan's own tasks order it: what a task waits for outside the plan does not.

Each task shows its place as 2/4 · after #412: its position, then the PRs it waits for (a task's plan number when it has no PR yet). A task that waits for nothing and that nothing waits for says any order: it may merge before or after the others, so not every position is a real constraint. The Merge order panel in the plan pane lists every task in turn with its PR and its state (no PR, open, held, merged, closed):

The merge order panel

m in the plan pane (:swarm.order) shows the outline itself in merge order instead of by phase; m again goes back. Tasks move up and down (J K) only by phase: the merge order follows what each task waits for.

The outline in merge order

The same label is on the swarm's PRs in Autopilot's Now, in the PRs view, in the inspector and in the merge queue: swarm 1 · 3/4 · after #412 held. A done swarm's PRs keep it until each has merged or closed as heed last saw it; a stopped swarm's lose it.

A PR whose task waits for a task that has not merged is held, however green it is:

A stacked PR held after its parent

  • The merge queue (gM, :merge.run) holds it with the reason, and turns GitHub's auto-merge off on it if it was on (auto-merge would merge it the moment GitHub's own requirements are met).
  • Merge now (zM) refuses it and says why: #415 waits (swarm 1, 4/4 · after #412): after #412, which is not merged yet: dependencies merge first.
  • It does not count as ready to merge on the rows.

So a stacked child never merges before its parent, into its parent's branch or past it.

A task's PR is green by the pilot's verdict (the rules z? lists: no conflicts, up to date when required, checks pass, threads resolved, no changes requested) once heed has fetched its detail; before that, by its checks passing. A PR that is not green says what holds it (#416 conflicts with main), and a green one that waits says so too (#415 green · merges after #412).

gM (:merge.queue <repo>) on the swarm's repo takes the swarm's PRs in merge order. Its other PRs keep their places (oldest first): the swarm's PRs are put in its order into the places they hold among them.

The merge queue in the swarm's order

The queue only holds PRs with get it merged on. heed tracks each swarm PR in the session its worker ran in (the lead's), so the pilot watches it like any PR a session opened.

A swarm's PRs follow its get it merged setting: as each PR's repo says (its [pilot] settings, the default), or off, auto or heed for every PR of the swarm. Set it in the swarm form or with :swarm.merge off|auto|heed (:swarm.merge repo goes back to the repo's); the plan's header says which applies (Get it merged: as the repo says (off)), and each change is a steering row. Whichever applies, the swarm's PRs merge in merge order and a held child waits for its parent. A PR's own choice (zm on it) still wins over the swarm's. With the default, and a repo whose get it merged is off, nothing of the swarm merges to main until you say so.

A stacked PR goes against its parent's branch. Once the parent merges, heed:

  1. Moves it to where the parent merged: gh pr edit --base <that branch>, the default branch unless the parent was itself stacked on a PR still open (then that PR's branch). GitHub moves a PR itself when its base branch is deleted; then only heed's record changes.
  2. Records the new base on the task's worker and as a steering row by heed: #415 now goes against main: #412 merged (was swarm/<goal>/heading-ids).
  3. Has its branch rebased there: a rebase item on the PR's get it green feedback (queued when its get it green is auto; otherwise New, for you to send). A squash merge leaves the parent's commits on the child as different commits, so it is rebased onto the new base past them (git rebase --onto origin/main <the parent's last commit>), conflicts resolved, the tests run, and pushed with --force-with-lease to the PR's own branch only. Nothing is ever forced to main.

A rebase after a parent merged, and a merge conflict on any swarm PR, go back to the task's own worker: the agent and model that did the task start again in the worktree it kept (swarm/<goal>/<task>), on a prompt that says what the PR needs now and that it pushes to its own branch only and never merges. Its tab opens in the lead's session, as when it first worked; the PR's feedback counts as sent to it. A steering row by heed says so: #415 rebases onto main (#412 merged): back to its worker, codex · o4.

When that worker cannot take it, a get it merged run does, as for any PR, and the steering row says why:

  • the swarm is stopped, paused or done;
  • the worker's agent is not set up on this Mac, or is rate limited;
  • its worktree is gone (or the worker never started); for a worker on a host, its host does not answer, or heed looks there over ssh before it starts and finds the worktree gone.

A worker still at work on the task gets it once its turn ends.

A PR's other feedback for a swarm (review threads, failing checks) goes to a run of its own even when the repo's run_in is session: the session is the lead's.

If gh refuses the move, a steering row says why and heed tries again after ten minutes; b in the plan pane (:swarm.land) on the task tries at once, or says why there is nothing to move (#415 goes against main already).

Landing is GitHub's business, so it runs on this Mac whatever machine the workers are on: heed reads the PRs and moves a stacked one with gh here, against the branch its worker pushed to GitHub. Nothing about it needs the worktree. The rebase after a parent merges, or a conflict, goes back to the task's worker where it ran: a worker on a host starts again there, in the worktree it kept on the host, even if the task has moved since. When a get it merged run takes it instead, that run works where the lead's session does (on this Mac or its host), in a clone of the repo there.

A task that waits for two tasks whose PRs are both open does not start: it waits until one merges, then stacks on the other (Running). heed does not make a combined base for it. A branch that merges two open PRs is nobody's PR: it could not be retargeted when either parent merges, and a change to either parent would leave it stale. Waiting keeps every stacked PR on exactly one parent, which is what holding and moving on rely on.

Once every task of the plan has merged (or is done by its evidence, with no PR), the swarm is done: a steering row by heed says Done: every task merged, in merge order, and the swarm ends. The holds are what keep the merges in order.

A done swarm

Done ends the swarm, not the goal. The goal is done only by its own rule (every criterion has evidence and every lens meets its bar), which may need a follow-up swarm. The goal's page says so:

A goal whose swarm landed

With the goal's GitHub mirror on, each item's sub-issue says what it comes after (After #12, #14., the other sub-issues), and the meta issue gains a section for the swarm going (or the last one, once it is done): its state, how many tasks merged, and every task in merge order with its PR and what it comes after. These are ordinary edits of heed's issues: written in the same batches, at the same rate, as every mirror write.

Key Command
m swarm.order The plan in merge order, or by phase again
b swarm.land Move the task's stacked PR to where its parent merged, now
gM merge.queue The repo's merge queue, in the swarm's order
zM pilot.merge.now Merge now: refused for a held PR
swarm.merge Get it merged for the swarm's PRs: off, auto, heed or repo

A right-click on a task offers both, and the hints in the Merge order panel are clickable.