babysit-pull-requests
Babysit open pull requests in THIS repository through the magus merge queue, spending agent work only where code must change. Use when asked to babysit, merge or ship open pull requests until they reach main. hack/ci/pull-requests.buzz decides each one's action; this skill chains the hack/dev scripts that act on it. Hand-authored, never shipped.
- License 许可
- GPL-3.0
- 所属仓库
- egladman/magus
- 最近更新
- 2026-11-14
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- babysit-pull-requests
- metadata
- { "source": "workspace" }
- description
- Babysit open pull requests in THIS repository through the magus merge queue, spending agent work only where code must change. Use when asked to babysit, merge or ship open pull requests until they reach main. hack/ci/pull-requests.buzz decides each one's action; this skill chains the hack/dev scripts that act on it. Hand-authored, never shipped.
03 SKILL.md 正文
Babysitting pull requests
hack/ci/pull-requests.buzz decides; the orchestrator acts on what it prints. Never
derive a state, an action or a model from gh yourself. When a record looks wrong,
fix the pure function that produced it and its test, then run it again.
The loop
-
Read the board. The queue's own page is the run summary of the latest
queue-apply.yamlrun, written by itsqueue dashboardjob. It lists every open pull request's place in the queue, with its reason and a person's command../magus buzz hack/ci/pull-requests.buzz -- dashboard --all --preview --out dashboard.mdrenders the same page locally. Thestatusrecords are what you act on:./magus buzz hack/ci/pull-requests.buzz -- status [--pr <n>]... [--author <login>]With no selector it reads your own open pull requests;
--allreads everyone's. It prints one JSON record per pull request:state,stage,reason,action,model,evidence, and sometimesmerge.stateis what the checks on the head say:running: a check has not finished, or none has reported yet.green: every check finished and passed.red-inherited: every failing check and failing Go test also fails on main's latest completed CI run;evidencenames both runs.red: anything else;evidencenames the failures main does not have.
The
merge-queuestatus is the queue, not CI, andstateleaves it out. It stays pending on every pull request outside the queue. Its description says why:not queued: CI has not passed,not queued: waiting for an approving review, orready: ...once only merge intent is missing. Never count it as a running check or wait for it to pass.stageis what else stands before a merge:merged,closed,draft,waiting-below,conflicting,kicked-back,behind,queued,needs-queue.mergeappears only on agreenorred-inheritedrecord whose stage allows a merge. It is the person's command: hand it over, never run it. -
Take the actions that change no code, with the same selectors:
./magus buzz hack/ci/pull-requests.buzz -- apply [--pr <n>]... [--author <login>]It queues a
greenstack by the label on its top and reruns aredthat is not the change's, once per head. It prints each command it ran.- It never enables auto-merge. For a
greenpull request in no stack it prints the command underfor_person; you tell the person to run it. - It never acts on
red-inherited. Nothing in the change is broken, and the queue would refuse it for main's failures.
- It never enables auto-merge. For a
-
Run the script chain for a record yourself, without asking the person. Each step is one script. Never stand in for one with raw
git,ghor a hand-run gate: each script already absorbs the failure that recurs there.hack/ci/pull-requests.buzz -- statusnames the action../magus buzz hack/dev/bootstrap-checkout.buzz -- --here --verify-readymakes the checkout verify-ready. It builds./magusat HEAD, stops pool parents of other builds, removes untracked stamped skill installs, and builds the graph and symbol digest. The scripts below run it themselves. An MGS7003 naming a binary built at another commit means this step did not run.- Refresh the branches the action names:
rebase-branches-onto-base: run the record'sevidence.rebaseline. The branch still carries the commits of a pull request that squash-merged below it (evidence.squashed_base). The script rebases its own commits onto the base in a fresh checkout job, gates, and force-pushes with a lease.- a branch behind its base with nothing squash-merged below it: run
./magus buzz hack/dev/merge-base-into-branches.buzz -- --branches <a,b,c>. It merges the base into each independently. Add--stackwhen each branch sits on the one before. Both scripts take local branches origin lacks. - When either stops at a source conflict, it names the files and the checkout; hand those to an agent of the record's model as below.
./magus buzz hack/dev/bootstrap-checkout.buzz -- --here --verify-ready, then./magus affected ci, which waits for the build budget itself, gates the result once; on failure it closes with each failed target's ref and cause. Fix from those, never rerun../magus buzz hack/dev/land-commits.buzz -- --branch <name> --from <ref> --title <text> --body-file <file>opens a pull request for commits that have none, after CI's hygiene checks pass locally.
For every record the chain cannot finish whose
modelissonnetoropus, spawn one agent of that model:- in its own worktree cut from the pull request's branch (
head), never in your checkout; - with the record's
action,reasonandevidenceas its brief; - told to commit there and stop: it never pushes, queues or reruns.
An opus agent may fan out sonnet agents for mechanical parts of its work (a regeneration, an import block), each in its own worktree.
-
When an agent reports, check its branch with a narrow test of what it changed. Then you, and only you, push it. Queuing it again is the person's: tell them
gh pr merge <n> --auto --squash, which you never run, or for a stack themerge-queue: <method>label on its top pull request. Aqueue: <state>label is the queue's answer, never intent. -
Schedule the next pass with the host's wakeup about every 20 minutes (the queue's validation time), or with its pull request monitor. Repeat from 1.
- A record with
action: noneneeds no agent. It is queued, waiting on the pull request below it,running, orred-inheritedwith amergefor the person. - A
draftorclosedstage never merges on its own. Tell the person and drop it from the selection.
- A record with
Stop when every selected record's stage reads merged. That status output is the
proof; a green check or the queue's comment is not.
The magus advice comment
The bot's advice comment runs the same advisors ./magus diff --impact runs
locally (localAdvisors in cmd/magus/diff.go). It never blocks a merge, so it is
not a review comment to answer. Read it locally:
./magus diff --no-tui --impact --rev origin/main...HEAD -o json. A section the
comment shows and the local run does not is a bug in that advisor. Fix the
advisor in .github/actions/advice/; don't rename code to quiet it.
Never
- Never admin-merge (
gh pr merge --admin) yourself. It skips the queue's validation and ordering, so nothing checked the combination that merges. The record'smergeis for the person to run. - Never enable auto-merge (
gh pr merge --auto, or theenablePullRequestAutoMergemutation throughgh api). A person enables it; the repo's guard denies it. Tell the person the command.--disable-autoand readingautoMergeRequestare yours. - Never force-push a pull request branch. Reviews and the queue's candidates name
commits, and a rewrite orphans both. The one rewrite is
rebase-branches-onto-base.buzzon arebase-branches-onto-baserecord: the squash already orphaned the commits it drops. - Never run two agents on one pull request branch at a time. One branch has one agent until you have pushed its result.
- Never rerun a red by hand after
applydeclined to. It reruns a head once; red again on the same head is a real failure, and the record then saysfix.