Skip to content

feat(code-review): default to approve plus auto-merge where the repository allows it - #1951

Merged
potiuk merged 5 commits into
apache:mainfrom
potiuk:feat/code-review-auto-merge-default
Nov 1, 2026
Merged

potiuk merged 5 commits into
apache:mainfrom
potiuk:feat/code-review-auto-merge-default

Conversation

@potiuk

@potiuk potiuk commented Nov 1, 2026

Copy link
Copy Markdown
Member

Summary

  • When the target repository allows auto-merge and the viewer can enable it, code-review's disposition now defaults to APPROVE+AUTO-MERGE, or FIXUP+APPROVE+AUTO-MERGE when the fixup applies. Maintainers stop waiting on CI that GitHub would gate anyway: real CI that is still running no longer blocks this path when every running check is required.
  • Failing CI, bot-only green rollups, workflows waiting for approval, unresolved threads, standing change requests and unanswered questions stay gates; a truncated check list counts as unknown/pending. render --auto-merge re-runs the disposition gates, takes the viewer from the saved read, and pins the merge with --match-head-commit <reviewed sha>.
  • Before relying on auto-merge, the flow releases workflow runs held in action_required at the head (release-runs / release-result, plus a new run-rerun op, falling back from "not waiting for approval" to a re-run) — only for a head the viewer approved, or a single verified-signed fixup commit by the viewer on top of it. Repositories without auto-merge are unaffected.

Type of change

  • Skill change (plugins/magpie-pr-management/skills/code-review/)
  • Python package (tools/pr-management, tools/vetted-ops)

Test plan

  • prek run --all-files passes (validator, surface hash, token stamp, family-plugin sync)
  • uv run pytest passes for tools/pr-management and tools/vetted-ops, rebased on fix(marketplace): ship every family's framework tools, not just security's #1937
  • New tests: auto-merge defaults; every gate on the render path (failing CI, open thread, CHANGES_REQUESTED, unanswered question, self-authored, unknown/mismatched viewer); non-required pending check; truncated check list; release plan and the 403 / already-running fallbacks; stale/unapproved head; fixup forged, unsigned, invalidly signed, signed by someone else, unlinked author, co-authored, wrong parent, merge commit
  • Eval suite / new eval fixture for the auto-merge disposition — not included yet (the runner here had no model to grade with); happy to add one in review

RFC-AI-0004 compliance

  • HITL — approval, fixup push and auto-merge all stay behind the maintainer's disposition confirmation; workflow-approve / run-rerun go through vetted-op, which prompts
  • Sandbox — no new host access; the new op is a fixed, policy-scoped gh call
  • Write-access discipline — nothing is posted without confirmation

Notes for reviewers

  • Maintainers need to grant runs-at-head, workflow-approve and run-rerun to pr-management-code-review in .apache-magpie-overrides/tools/vetted-ops/config.toml for the release flow to run on this repo (an edit-denied security control, so not changed here).
  • Developed against apache/airflow reviews; three roborev passes and an automated security review were addressed in the follow-up commits (gate parity on render, head binding for held-run release, fail-closed on truncated checks, signature-verified fixups).

Generated-by: Claude Opus 5

…itory allows it

When the target repository allows auto-merge and the viewer can enable it, the disposition that ends in an APPROVE now defaults to APPROVE+AUTO-MERGE, or FIXUP+APPROVE+AUTO-MERGE when the fixup is eligible. Real CI that is still running no longer gates that path: the approval and auto-merge go in at once and GitHub holds the merge until the required checks pass. Failing CI, bot-only green rollups and workflows waiting for approval stay gates (Golden rule 8), with ci_action naming the runs to approve or re-run first. gql-cr-pr reads autoMergeAllowed, viewerCanEnableAutoMerge, viewerDefaultMergeMethod and autoMergeRequest; render --auto-merge emits the gh pr merge --auto command and refuses self-authored PRs.

Generated-by: Claude Opus 5
…held runs

render --auto-merge now re-runs the disposition gates with the same viewer and flags and fails closed on an unknown or mismatched viewer, so it can no longer emit a merge command the gates would refuse. The merge command pins the reviewed head with --match-head-commit, and the docs refresh the liveness read before the post-review guard. Running CI only stops gating the auto-merge path when every running check is required (isRequired), since auto-merge does not wait for the rest. Before relying on auto-merge, the flow releases workflow runs held in action_required at the head: release-runs reads runs-at-head, workflow-approve releases first-time-contributor runs, and the new run-rerun op re-runs the ones GitHub says are not waiting for approval.

Generated-by: Claude Opus 5
…t unread checks as pending

release-runs now loads the saved gql-cr-pr read and refuses a head it does not show, and any head other than the reviewed one unless it is the viewer's own single fixup commit on top of it, so CI never runs an unreviewed head's code. A statusCheckRollup read that stops short of every context (hasNextPage, or totalCount above the nodes read) now counts the unread checks as pending and not required, keeping the CI gate closed instead of failing open. The fixup path re-reads gql-cr-pr after the push and re-runs disposition before approving, so render pins the merge to the fixup SHA.

Generated-by: Claude Opus 5
…rified-signed fixup

Author metadata is free text, so release-runs no longer trusts it. The viewer now comes from the saved gql-cr-pr read (a missing or different --viewer is refused), the head must carry an APPROVED review by that viewer, and a fixup on top of an approved head is accepted only as a single commit whose only parent is that head, with a verified signature by the viewer and the viewer as its only linked author. The last two commits are read separately (headCommits, with parents and signature), which also keeps the check working on PRs with more than 100 commits.

Generated-by: Claude Opus 5
@github-actions github-actions Bot added family:pr-management pr-management-* skills family:tools tools/* family:docs Docs, MISSION.md, READMEs capability:review Deep per-item code review or contributor mentoring substrate:analytics Tool substrate: read-only metrics / dashboards / renderers substrate:sandbox Tool substrate: agent isolation, egress control, settings audit labels Nov 1, 2026
@potiuk
potiuk enabled auto-merge (squash) November 1, 2026 10:27
Regenerate plugins/magpie-security-tools/tools/pr-management from
tools/pr-management so check-family-plugins passes.

Generated-by: Claude Opus 5
@potiuk
potiuk merged commit 87ad524 into apache:main Nov 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:review Deep per-item code review or contributor mentoring family:docs Docs, MISSION.md, READMEs family:pr-management pr-management-* skills family:tools tools/* substrate:analytics Tool substrate: read-only metrics / dashboards / renderers substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant