Skip to content

pr-flow: arm auto-merge, rotate reviewers, route change requests - #14

Open
RyanTheTide wants to merge 9 commits into
mainfrom
feat/pr-flow
Open

RyanTheTide wants to merge 9 commits into
mainfrom
feat/pr-flow

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What: finished PRs wait days between "ready" and "merged" because nothing acts on the readiness bot's verdict. pr-flow.py runs every 10 minutes over every open, non-draft PR with the readiness bot's own evaluation: it turns on GitHub auto-merge when only the approval is missing (so the PR merges the moment a counted approval lands), merges approved CLEAN PRs with a normal merge, asks one active reviewer per PR by load with a 4-hour SLA, asks reviewers again after a push with a compare link, routes change requests on lab PRs to the owning lane, and writes a queue with merge metrics. It never changes rulesets, never uses the admin bypass and never approves. Also: pr-readiness trusts verdicts from the organisation's review App by login (GitHub reports its association as NONE).

Tested: no runtime change (organisation tooling, no Mac code). Offline tests: python3 .github/aurora/pr-flow-test.py (row gate incl. the linux#3213 and mesa#1168 cases, lane holds). Live on the buildbox since 15:29: 43 merges in the first 2 hours (34 direct, 9 on approval). Two of them went in before their rows and were reverted (linux#3213 -> #3351, mesa#1168 -> #1200), and mesa#680 + #1183 were each CLEAN but broke the mesa tip together (fixed by #1201). Since b62b3eb the row gate below blocks those cases: on its first run it disarmed 12 armed PRs that lacked a head row or a regression row.

Risk: two-way · none (no Mac affected; disable with a PAUSE file or by stopping the timer)

Not yet: an App approval does not satisfy the rulesets yet (App permission Contents is read-only; code-owner rules cannot name an App), so agent approvals of lab PRs still cannot trigger auto-merge. Owner settings, reported separately.

Details
  • Row gate (stricter than the readiness label) before arming or merging: a head-SHA row line; a second Mac for linux, mesa, aura, installer and u-boot; nothing in Tested or Not yet saying rows are owed or still to run; no lane line holding the PR. One merge per repository per run; one armed PR at a time on mesa. Evaluations from an older gate never arm or merge; PRs our account armed outside pr-flow's state follow the same gate.

  • Arms only PRs GitHub reports BLOCKED (by the review rule), so a PR is never armed where GitHub would merge it without a review. Disarms when the head moves or CI, a change request, a conflict or a hold appears.

  • Never arms or merges: policy repos (.github, agent-guidelines), door:one-way, Stage 1 / boot-object titles, hold / blocked / do-not-merge, excluded PRs, stacked PRs (base not the default branch), private repos (no auto-merge on the plan). They show as merge (by hand) / base / hold in the queue.

  • Reviewers: members of Core, Omarchy Mac and Aurora Maintainers with 3+ reviews in the last 7 days, never the author, capped per person; for PRs not by the lab account, the lab's reviewer agents (a line in their lane file). Ready PRs first, outside contributors first, then oldest.

  • People get a GitHub re-request (no per-PR comment by default); the delta links go into one batched digest every 2 hours.

  • Incremental: a PR's detail is read again only when its head, CI rollup, mergeability, review decision, labels or update time change (or every 6 h). Reads can use a separate token command (the review App's installation token) to keep the maintainer's rate limit free.

  • Docs: docs/pr-flow.md.

The readiness bot says what a pull request still needs; nothing acts on
it, so finished PRs wait days for someone to notice an approval, a push
after a review or a change request.

pr-flow runs every 10 minutes over every open, non-draft PR, using the
readiness bot's own evaluation. When everything but the approval holds
it turns on GitHub auto-merge (merge commit, head pinned), so the PR
merges the moment a counted approval lands; it merges approved CLEAN
PRs with a normal merge and disarms when the head moves or a blocker
appears. It asks one active reviewer per PR by load, moves requests
after a 4-hour SLA, asks reviewers again after a push with the delta,
routes change requests on lab PRs to the owning lane, and writes a
queue with merge metrics. It never changes rulesets, never uses the
admin bypass and never approves.

pr-readiness: trust verdicts and approvals from the organisation's
review App by login (GitHub reports its association as NONE).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide
RyanTheTide requested review from a team and DjDeveloperr as code owners November 27, 2026 04:40
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Two PRs merged before their rows: linux#3213 said 'hardware rows still
owed' and mesa#1168 had one Mac with more rows under 'Not yet'; both
were reverted. Two mesa PRs that were each CLEAN broke the tip together.

Before arming or merging, require a head-SHA row line, a second Mac for
linux, mesa, aura, installer and u-boot, no 'owed'/'still to run' in
Tested or Not yet, and no lane line holding the PR. Merge at most one
PR per repository per run and keep one armed PR at a time on mesa.
Cached evaluations from an older gate never arm or merge. Offline tests
cover both reverted cases.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
mesa keeps approvals after a push, so mesa#700 merged on an approval that
predated a maintainer forward-merge, before its row at the new head.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 5d8174fe4a356ed6cae4b939294f88c7345ef37f

Blockers:

  1. .github/aurora/pr-flow.py:543 takes the direct-merge branch before checking the armed count at line 552. I ran the exact-head decision function offline with one armed Mesa PR and one separately approved, clean Mesa PR. It still issued a direct-merge action for the second PR. The armed PR can land independently alongside it. Make direct merges and arms share the repo's outstanding slot, and account for every live arm. Add coverage for both action orders.
  2. At the detail time budget and error fallback, the code appends a cached evaluation even when the listing fingerprint changed. The mutation loop only checks the evaluation format version. After a same-head evidence edit, the stale approval and row state can still drive a mutation because the head pin remains valid. Keep stale evaluations for queue display and skip writes until the matching detail has been fetched.

Checked: Traced the row, non-default-base, approval, change-request and direct/auto-merge gates. Used an offline action recorder with no GitHub mutations for the first finding. Reviewed token loading and lane routing. No binding, board, private material, or attribution changes found. Because this head is deployed, please route the findings to the timer owner before the next write batch.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more hold-gate case at the same head. lane_holds() overwrites its per-PR candidate whenever a later configured file mentions the PR. It neither compares timestamps nor restricts replacement to explicit hold/release events. A newer HOLD in one file can disappear when a later-scanned file has an older neutral status line. Keep active holds until an authorized explicit release, and test conflicting lines from two files in both scan orders. Today the generated queue listed aura #369 as “merge now” after REVIEW6 logged a hardware HOLD, while GitHub still blocked it. Please check the hold selection along with the original two fixes.

…tions, keep holds until released

Three gaps found in review of 5d8174f:

- A direct merge was taken before the armed count was checked, so a
  repo with one PR armed could still get a second PR merged next to it.
  The armed PR can land on its own approval, untested together with
  the merge. Every live arm (anyone's, bot PRs included) now comes from
  the listing, and no PR merges directly beside another armed PR in its
  repo. Serial repos (mesa) count those arms too.
- When a detail refresh failed or hit the time budget, the cached
  evaluation was used for actions even though the listing showed the PR
  had changed. Such PRs now stay in the queue but are never armed,
  merged, sent for review or routed; an arm of ours on one is turned
  off.
- The lane hold scan kept only the last line per PR in file scan order,
  so an older neutral line in a later file hid a newer HOLD. Holds now
  stay until a newer explicit release (Verdict: MERGE, merge-ready, hold
  lifted) in any scanned file, or a later PASS row with no failures in
  the same file. Times across files are compared, with ties keeping the
  hold.

Offline tests run main() against recorded GitHub fixtures (no network)
for both action orders, live arms set by others, refresh errors and the
budget path, and check conflicting hold lines in both file orders.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

RyanTheTide commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Fixes for the three findings at 5d8174fe, in one push: 0b1fa445.

1. Direct merge beside an outstanding arm (13:13 review, blocker 1). Every live arm now comes from the listing (autoMergeRequest added to LIST_Q, .github/aurora/pr-flow.py:88). That covers arms set by anyone, bot PRs and PRs without a fresh evaluation (:985). The merge path checks for live arms on other PRs in the same repo before any direct merge (armed_others, :632-635). Our own arms and disarms update the set, so a PR armed earlier in the run blocks a later direct merge, and a direct merge still blocks a later arm through repo_actions. Serial repos (mesa) now count every live arm, not only ours (:643). Non-serial repos can still have several arms at once, as before.
Tests (pr-flow-test.py, main: cases, which run main() offline against recorded fixtures): no direct merge beside our live mesa arm, no direct merge beside our live arm (non-serial repo), no direct merge beside a live arm someone else set, no direct merge beside a live arm on a bot PR (not in the evaluated list), and both action orders: arm first, then a merge candidate: arm only and merge candidate first, then an arm: merge only.

2. Cached evidence after a failed refresh (13:13 review, blocker 2). A PR listed from the cache after a detail error or the time budget goes into stale (:1008, :1019, :1028). It still shows in the queue but gets the stale-eval blocker (:1046), so it is never armed or merged. It is also left out of review requests and change-request routing (:1057). The only write it can get is turning off an arm of ours, which is the fail-closed direction.
Tests: refresh error: cached same-head evaluation never merges, refresh error: cached evaluation never arms, detail budget spent: cached evaluation never merges, refresh error on a PR we armed: disarmed (fail closed), nothing else, stale evaluation still listed in the queue, and the control fresh evaluation merges.

3. File-order hold clobber (13:33 follow-up). lane_holds() (:542) no longer keeps just the last line per PR. A HOLD/FAIL/regression/revert/rows-owed line stays active until one of two things is newer than it: an explicit release (RELEASE_RE :474: Verdict: MERGE, merge-ready, hold lifted/released/cleared/removed) in any scanned file, or a PASS row with no failures in the same file (PASS_RE :476). Neutral lines change nothing. line_times() (:480) dates lines across files: YYYY-MM-DD HH:MM lines are dated directly, and bare HH:MM lines are dated from the nearest dated line, or from the file mtime. A hold uses its upper time bound and a release its lower bound. A tie, or a release line with no time of its own, keeps the hold.
Tests: hold across files [ab]/[ba], each case in both scan orders: newer HOLD vs older neutral line in another file (the aura#369 shape), newer neutral line in another file does not release, older explicit release in another file does not release, newer explicit release in another file releases, PASS row in another file does not release a review HOLD, HH:MM lines dated from the file: newer HOLD wins, undated file (times from mtime): newer/older release, and release line without its own time does not release across files.

Effect on today's lane files (read-only comparison of the old and new lane_holds() against the deployed config's scan files): 56 to 87 open PRs held. The 31 new holds come from lines that were hidden before. Some of them are noisy HOLD_RE matches, such as "fails on main" or "regression row" in approval lines. Under the new rule these stay held until a lane posts an explicit release line. That is the intended fail-closed behaviour, but expect more hold rows in the queue.

Tested: python3 .github/aurora/pr-flow-test.py at 0b1fa445 gives 45 ok, 0 failing. The same test file run against 5d8174fe's pr-flow.py gives 19 failing. Each blocker fails there in at least one case (hold cases in at least one scan order). The controls merge candidate first, then an arm, fresh evaluation merges and stale evaluation still listed in the queue pass on both heads, as do the 15 earlier cases. The new LIST_Q was checked with one read-only GraphQL search. No dry run and no live run was made.
Risk: two-way door. This only adds blocks to arm/merge: more PRs held, no direct merge beside an arm, no action on stale data. Revert with one commit.

The timer still runs the deployed tree at 5d8174fe. Redeploying it (tools/pr-flow/dotgithub) after this merges is for its owner (PR-FLOW). This push did not touch it, and I did not restart or redeploy anything.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the hold on 0b1fa44. The offline suite passes, including the earlier stale-refresh, live-arm and cross-file ordering cases.

I added an offline lane-line case: linux#3206 HOLD: second family untested. First family PASS, 0 failures. At this head, lane_holds() leaves the PR out of HOLDS. The passed branch takes precedence over HOLD_RE, so a partial pass on the same line discards the explicit hold. If that file already has an older hold, the same mixed line can release it too. This bypasses the lane veto for a PR that otherwise satisfies the arm or merge checks.

Please give explicit hold language precedence over an inferred pass and add both variants to the offline suite. Keep the standalone passing rerun case as a control.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Fixed at 0bb8d87. An explicit hold now wins over a partial PASS on the same line, both when it creates a hold and when an older hold already exists. A standalone clean rerun still releases a hold in its own file. I merged current main forward and kept its check and review pagination in the pr-flow reader. The offline pr-flow and pr-readiness suites pass, including a failing required check on the second page. This branch has not been deployed.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 0bb8d87

Checked: Explicit hold language now wins over a partial PASS on the same lane line. I replayed the earlier mixed-result case both with and without an older hold. Both kept the hold. The standalone later PASS control still releases its hold, and the exact offline suite passed all 48 checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant