Skip to content

agent rules: update only the next PR to merge - #1184

Merged
scuttletoby merged 2 commits into
mainfrom
pr-queue-update-next
Nov 28, 2026
Merged

scuttletoby merged 2 commits into
mainfrom
pr-queue-update-next

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Part of #1094 (F8: one update per PR, right before it merges).

Where the Update-branch merges came from

All 534 PRs merged 11-14..11-28, every main-into-branch merge commit on each:

  • 265 GitHub "Update branch" merges (committer web-flow, author the owner account: the update-branch API with the owner's token), on 239 PRs: 215 once, 22 twice, 2 three times. Another 121 were local git merge origin/main commits (conflict fix rounds), not counted here.
  • Not the pr-queue: fork-pr-queue.yml has no runs on this repository (no caller workflow), and none of a random sample of 20 updated PRs has a queue comment.
  • Agents: spread over all 24 UTC hours (lowest hour 1, highest 25), median 8 min before the merge (p10 5, p90 20): the merge routine updating, waiting for CI, then merging.
  • Main's main: CI before merge ruleset has strict_required_status_checks_policy: false. That is on purpose: the one update right before the merge gives the same check against current main (Owner: require PR branches to be up to date before merging into main? (recommend yes) #444) without an update on every move of the base.

Change

So the pr-queue is left as it is (it already updates one PR per run) and the rule goes in docs/fork/agent-rules.md, as the issue asks when agents are the source. It replaces "never update by hand when a merge queue does it", which did not apply here because no queue runs. The new rule: before you merge a PR that is behind main, update it once, wait for its CI, then merge; never update PRs that are only waiting, and never on each move of the base. If the update fails on a conflict, merge main in locally and fix it: that is a new fix round, and the lenses read it again. docs/fork/updates.md no longer says main's ruleset requires up-to-date branches. It now says strict is off on purpose and that the single update before the merge runs the seam checks on both changes together.

No guard: one does not fit. A Bash hook cannot tell from the command which PR merges next, and T3's pull-request tools update branches outside Bash, so a guard would refuse right calls and still miss wrong ones.

Left for #1094

The orchestrator's merge conveyor (outside this repository) follows the rule: one update of the PR it merges next, then CI, then the merge.

General vs project

General: the rule is in the general agent rules. Project facts (strict off here, the numbers) are in this PR only.

Checks

Docs-only change, so no test. doc_check.py on both docs: 0 problems. vp fmt, vp lint. Fork checks: the schema, upstream-files and seam tests (197 pass) and scripts against this commit all pass.

🤖 Generated with Claude Code

The fork's ~265 Update-branch merges (11-14..11-28) came from agents
calling update-branch with the owner's token, not the pr-queue (it has
no runs on the fork). Replace the merge-queue-only rule with one that
holds without a queue: update only the pull request merged next, once,
right before it merges.

Part of #1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: claude-opus-5-5 · read at: a242850

blocker: none
major: The new rule only limits updates; it never requires one. With the live ruleset at strict_required_status_checks_policy: false, nothing in the rule or on GitHub makes the PR merged next get tested against current main, so a PR many commits behind can merge on CI from an old base. That goes against the owner decision in #444: "Agents bring a behind PR up to date (merge main in) and wait for CI again before merging." Fix: make the safe step part of the rule, for example "Before you merge a PR that is behind its base, update it once, wait for its CI, then merge. Never update the PRs still waiting, and never again on each later move of the base." That keeps the cut (one update per merged PR instead of one per move) and keeps the test against main.
major: Docs and settings disagree, and the PR body builds on that. docs/fork/updates.md:190-192 says main's ruleset "requires a branch to be up to date with main before it merges (#444)", and the seam checks rely on that for two branches that are fine apart but not together. The live ruleset has strict off, so either someone switched it off after #444 or it drifted. "Left for #1094" proposes skipping the update when strict is off, which would remove the only time those two branches get checked together. Drop that proposal from the hand-off, and raise strict off with the owner as drift (switch it back on, or change updates.md) instead of using it as the reason.
minor: Say what to do when Update branch fails on a conflict: merge main in locally. That is a fix round, and its head is not "the same change" for head-check (fork-ci/actions/head-check/README.md, "The same change"), so the lenses read it again. As written, "at most once" plus a failed update has no next step.
minor: The Why, "they were a quarter of all extra pushes", has no number behind it in the PR (265 of how many?). "Each update is a full CI run" is enough on its own, or add the total to the PR body.

Checked: the diff is one bullet in docs/fork/agent-rules.md. I grepped docs/fork, the fork-ci READMEs and fork-kit for update-branch, merge queue and up to date. The pr-queue and head-check READMEs agree with the rule: the queue updates one PR per base push, and a clean update keeps the lens reads, so updating once right before the merge needs no new review. The only conflict is updates.md above. I read the rulesets through the API (strict false) and read #444 with its owner comment. No tests run (docs only).

State question: runs again: "at most once" means a second move of the base before the merge goes untested, which is acceptable only if the merge follows the green CI at once. Stops half-way: an updated PR that does not merge (red CI, agent stopped) stays next in line, and the rule does not say whether a later agent may update it again; "once per merge attempt" would make that clear. Old or empty state: a far-behind or conflicting PR gets tested against main only if the first major is fixed, and its conflict path is the first minor.

🤖 Generated with Claude Code

Fix round 1 (code lens): the rule now requires the single update of a
behind PR before its merge and says what to do when it conflicts;
updates.md no longer says main's ruleset requires up-to-date branches.

Part of #1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Fix round 1, head 07524f8:

  • major 1: the rule now requires the step. Before you merge a PR that is behind main, update it once, wait for its CI, then merge. Never update PRs that are only waiting, and never on each move of the base.
  • major 2: docs/fork/updates.md no longer says the ruleset requires up to date. It now says strict is off on purpose, and that the single update before the merge runs both seam checks together (Owner: require PR branches to be up to date before merging into main? (recommend yes) #444). I dropped the "skip the update when strict is off" idea from the PR body.
  • minor 1: an update that fails on a conflict: merge main in locally and fix it. That is a new fix round, and the lenses read it again.
  • minor 2: the Why gives the total: 265 updates on 239 of 534 PRs merged 11-14..11-28.

Checks: doc_check on both files (0 problems), plus vp fmt, vp lint and the fork-check scripts (schema, upstream files, seam). All pass.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: claude-opus-5-5 · read at: 07524f8

blocker: none
major: none
minor: Two merges close together can still skip the joint check. With strict off, GitHub merges a behind PR without complaint. If A and B are both updated and green and A merges first, B is behind again, and updates.md ("the single update before the merge gives the same check") holds only if B is updated again. The rule's "update it once" and "never on each move of the base" can be read as forbidding that. One clause fixes it: "check that it is behind at the moment you merge; if main moved during its CI, that is the one update for this merge, so do it again" (or "merge one PR at a time").
minor: fork-ci/actions/head-check/README.md (~line 146) still says to turn on "Require branches to be up to date before merging" so that a second PR's config is judged on the merged base. updates.md now says strict is off here on purpose. That README is general tool docs, so it can stay, but updates.md could add half a sentence saying that the update before the merge covers head-check's case too, so the two don't look like they disagree.
minor: The rewrapped updates.md line ("before the merge gives the same check without an update on every move of main. A branch made before fork-follow last") is 118 characters, while its paragraph wraps at about 100. Cosmetic.

Round 1, fixed: the rule now requires the update (before you merge a behind PR: update once, wait for CI, merge), so the PR is tested against current main as #444 asks.
Round 1, fixed: updates.md no longer says the ruleset requires up to date. It says strict is off on purpose and points the seam check at the update before the merge. The "Left for #1094" hand-off now follows the rule instead of skipping the update.
Round 1, fixed: the conflict path is there (merge main in locally, a new fix round, the lenses read it again). That matches head-check's "The same change", where a local merge is a new change.
Round 1, fixed: the Why now has its numbers (265 updates on 239 of 534 PRs).

Checked: the full diff (two bullets/paragraphs in docs/fork/agent-rules.md and docs/fork/updates.md), and round 1's comment against it. I grepped docs/fork, fork-ci and fork-kit READMEs for update-branch, up to date, strict and merge queue: the only remaining tension is the head-check README line above. The pr-queue README describes a queue for repositories with strict on, which doesn't run here, as the PR body says. No tests run (docs only).

State question: runs again: a second update is needed only if main moved between the update and the merge (first minor). Otherwise one update per merged PR, and waiting PRs are left alone. Stops half-way: an updated PR whose CI goes red, or whose agent stops, stays behind-or-current. The next agent that merges it applies the same rule at its own merge time, so nothing is lost. Old or empty state: a far-behind PR gets one update and a full CI before it merges. A conflicting one goes through a local merge and a fresh lens read.

🤖 Generated with Claude Code

@scuttletoby scuttletoby added the fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) label Nov 28, 2026
@scuttletoby
scuttletoby merged commit c967137 into main Nov 28, 2026
29 checks passed
scuttletoby added a commit that referenced this pull request Nov 28, 2026
* agent rules: update only the next pull request to merge

The fork's ~265 Update-branch merges (11-14..11-28) came from agents
calling update-branch with the owner's token, not the pr-queue (it has
no runs on the fork). Replace the merge-queue-only rule with one that
holds without a queue: update only the pull request merged next, once,
right before it merges.

Part of #1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* agent rules: one update right before the merge, strict off on purpose

Fix round 1 (code lens): the rule now requires the single update of a
behind PR before its merge and says what to do when it conflicts;
updates.md no longer says main's ruleset requires up-to-date branches.

Part of #1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@scuttletoby
scuttletoby deleted the pr-queue-update-next branch November 29, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork:merge-ready Merge conveyor: lenses done, merge when green (PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant