Repository navigation
fix(skills): prohibit bot from merging PRs or enabling auto-merge - #124
Merged
Merged
Conversation
The ci-fix workflow created a PR and then autonomously ran `gh pr merge --squash --auto`, enabling GitHub auto-merge without any skill instruction to do so. This happened because the ci-fix skill ends at "monitor CI" with no guidance on what to do after CI passes, so Claude improvised. Add a clear prohibition in the running-in-ci base skill (loaded by all workflows): never `gh pr merge` or `gh pr merge --auto`. Remove the existing merge instructions from the weekly skill for consistency — the bot approves dependency PRs but leaves merging to the maintainer. Co-Authored-By: Claude <[email protected]>
tend-agent
approved these changes
Mar 30, 2026
Move secrets, merging, and hanging-commands prohibitions into one "Restrictions" section. Remove duplicates from Security, Merging PRs, and CI Monitoring sections. Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
tend-agent
approved these changes
Mar 30, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
#1544) With `workflows.review.await_ci: false` under `merge: yolo`, a review still waited for CI on a head the bot pushed itself, because under yolo it lands those, and it polled any fix it pushed. In Leaf that was 28 of the last 40 merged PRs, each holding a runner for the ~50-minute suite. This hands those landings to the completion of CI: the review records the head and ends. When CI finishes green, a short event-started session lands it. **Design.** Each fact is recorded or judged where it is known. Code decides only what is crisp. - **Who pushed: recorded by the session that pushed.** Under yolo, a bot session that pushes to a PR branch runs `land_pr.py pushed <sha>` (**After the push** in `push-commits`). That sets a `tend/land/pushed` status, which only the bot's token can create. Commit metadata doesn't establish who pushed, so it is no longer read. A missing record errs safe: that head's landing waits for a maintainer. - **The landing record: written by the review.** A review settles everything `merge-pr` asks of a head except its CI: reviewed head, no draft, no hold, no unresolved finding, no owning run. It then runs `land_pr.py intend <pr> <sha> <reviewed-base> [--skip ...]`, which sets a `tend/land/<pr>` status on that exact head. The description is JSON naming the base the review read and the checks its CI policy skips. - `review_preflight.py start` now writes `$TMPDIR/reviewed-base` beside `reviewed-head`. - `intend` refuses, with exit 3 and no record, when the head has no `tend/land/pushed` record, when the PR has moved off that head or that base, or when the policy is too long for a description. - A check may finish between the review's read and the record. The record is itself a commit status, so its creation wakes tend-land like any other status, and the check reads every check again. - **What CI completion decides: agentless code.** A generated `tend-land` workflow wakes on whatever its gate reads: every workflow but Tend's own (`workflow_run` with `["**", "!tend-*"]`), a commit `status`, or another app's `check_suite`. A narrower wake-up would strand a recorded head whose last check comes from outside it. Its `check` job skips workflow runs on this repository's default branch, though a fork's own `main` is still a PR head. It runs a new composite action, `max-sixty/tend/[email protected]` (`land_pr.py check`), with no agent and no checkout of the PR, and decides only two crisp things: whether a PR at that commit carries the bot's `tend/land/<pr>` record for that head and base, and whether every check except the recorded skips finished green. It names every eligible PR at the commit, not just the first. The wake-up is near-free. Events that can't land or repair anything are dropped by the job's `if:` before a runner is allocated: pending statuses, Tend's own `tend/land/pushed` and `tend/land/repair` markers, and workflow runs or check suites with no PR in this repository. Only one check runs per commit at a time (`cancel-in-progress: false`, so a burst collapses to the running check plus the newest). - **The landing decision: an agent.** Green with a record starts `land`, a short `merge-pr` session. It reads the PR afresh for holds in prose, findings, the approval and ownership, then makes the pinned merge. Earlier rounds of this PR tried to code these as timestamp and metadata gates. Each review round found another hole, which is the accretion tend's Code-vs-Agent guidance warns about, so they're judged here instead. The cost is one session of a few minutes, and only when a recorded head goes green, against the ~50-minute wait it replaces. - **Repair: an agent.** A red on a PR with no human author starts `repair`, a `continue-pr` session, whether or not the head was recorded. This matches what the review that waited used to repair, including Dependabot and Renovate PRs, which `continue-pr` now covers. The first event to see the red starts it, even while sibling checks still run, and marks the head with a `tend/land/repair` status. Every later event on that head finds the mark and starts nothing more, whichever event came first. Red is the rollup's own classification, so a timed-out run and a status's `error` count. `continue-pr` defers to an owning run that is still active. A red on a human's PR stands beside the approval for its author. - **No session waits after a push.** A repair or landing that pushes records the push and ends, as the review does. A landing session that finds checks running again (a rerun) ends too, since their completion starts another landing. Each session first checks that its head is still the PR's, before `setup:` or the agent. A session queued behind one that already moved the head (another repair's push) ends at that step, and `continue-pr` with the wait off polls no head. - **Sessions.** `land` and `repair` run one job per PR (a matrix over the check's output). Each runs in the review's concurrency group for that PR (`tend-review-<pr>`, `queue: max`), so it never runs beside a review of the same PR. Each job is named for its PR (`land #7`), and `active_subject_runs.py` reads tend-land runs' active job names, so a notifications poll or `continue-pr` sees the session as the PR's owner. Both run on the review's harness, model, effort and arguments, whose credentials the install already provisions. **What the review does now.** Under the option, the review no longer waits on a bot-pushed head or polls a fix it pushed, including an accepted fix on a human's PR: it records the push, and the queued review records the head. A head a human pushed is left for a maintainer while its checks run, as before. **Option for you (not in this PR).** The landing record could cover human-pushed heads too. Under yolo, a human's approved PR whose checks are still running would then land through the same session when CI completes, instead of waiting for a maintainer. That widens what yolo lands without a person present, so it's left as a choice. It would be one change to `intend`'s `tend/land/pushed` requirement. **Why not GitHub auto-merge.** `merge-pr` forbids it (#124, #1172). Auto-merge stays enabled across pushes by anyone with write access, so it can land a head no review read. The landing session's merge passes the recorded SHA, which GitHub refuses once the head moves. **Cost per landing (estimate, not yet measured live).** A bot-pushed head in Leaf wakes the check about twice: the review's own landing record (a status) and the `ci` run completing. Pending statuses, the push marker and Tend's own workflows are filtered out. Each check is a sub-minute job that GitHub bills as one runner-minute, so a landing costs about 2–3 runner-minutes of checks plus one landing session. That session checks out the default branch with no `setup:` and runs a short `merge-pr` agent, a few minutes. Together that is roughly 5–8 runner-minutes per landing, against the ~50 a waiting review held. A repair costs one check plus the repair session, which runs `setup:` as before. The first live adoption should measure both from the runs' timing data. **Limits** - The wake-up uses `workflow_run`'s documented glob support with a `!tend-*` negation. GitHub documents negation for branch and path filters, not explicitly for `workflows`, so the first live adoption should confirm that Tend's own runs don't wake it. If they do, it only means extra agentless check runs. - Consumers whose `setup:` keys a secret on `github.event_name == 'workflow_run'` hand it to the new `repair` job too. That job continues a bot PR and so runs PR code. Leaf's Cloudflare token export is one such expression, and it should check `github.workflow` when Leaf adopts this. The `land` job runs no `setup:`. **Key files** - `plugins/tend-ci-runner/scripts/land_pr.py`: the three records and the check, in its header. - `land/action.yaml` - `generator/src/tend/templates/land.yaml.j2` and `generate_land` - **Without the CI wait** in `plugins/tend-ci-runner/skills/review/references/approving.md` - **After the push** in `push-commits` - `merge-pr`'s **Reviewed head**: the record stands for the review - `continue-pr`'s ownership - `docs/security-model.md` and `docs/tend.example.yaml` **Eval** (`review-without-ci-wait`, updated for the records and given an eighth session, a human PR the review pushed an accepted fix to; Claude executor, 3 repeats per arm; historical = main at ea2ed4a). The old guidance failed 3 of 3 in every run: it polled the bot-pushed heads (`pending-self`, `pending-bot-push-on-human`) to a terminal result and merged them itself, and polled both of its own pushes (`own-push`, `own-push-human`). The new guidance passed 2 of 3 on each of the last three versions, the final one included. Every new-guidance run made the decisions the case targets: it recorded both bot-pushed heads with their base, recorded its pushes and ended, and left `pending-human` for a maintainer. Each failure was the grounding rubric objecting to closing lines that described a proposed offline command (`land_pr.py pushed`, a merge) in the past tense. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ci-fix workflow autonomously ran
gh pr merge --squash --autoon max-sixty/worktrunk#1815 after creating the PR and seeing CI pass. No skill instructed this — Claude improvised because the ci-fix skill ends at "monitor CI" with no guidance on what happens next.Add a "Restrictions" section to the
running-in-cibase skill (loaded by all workflows) consolidating all hard prohibitions: secrets exposure, merging/auto-merge, cross-org scope, and hanging commands (--watch). Previously these were scattered across Security, Conduct > Scope, and CI Monitoring sections. Also remove merge instructions from theweeklyskill — the bot approves dependency PRs but leaves merging to the maintainer.