Repository navigation
✨ feat(github): enforce pin-only exception in merge-request relay - #16607
Conversation
The merge-request relay was the last App merge path that ignored auto_merge.human_merge_pin_only. Wire the policy into the relay's human-merge-path gate: a PR whose author is in trusted_authors, whose head equals the requested head (before and after listing files), whose complete changed-file list classifies as pin replacements, whose every commit is a verified trusted-author commit, and whose action SHAs are anchored upstream is admitted without a hold. Anything else keeps the existing hold, marker comment and refusal; non-GitHub forges stay fail-closed. The provenance checks move from the automerge package into pkg/github/pin_only_provenance.go so the sweep, /approve and the relay share one implementation. Docs and config comments now state the relay enforces the exception. Closes #16265 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Read the relay gate, the shared provenance checks and the boot wiring at What I verified:
Non-GitHub forges remain fail-closed as stated. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
There was a problem hiding this comment.
Decision needed: @hanthor should confirm that the hive-merge relay may now App-merge trusted-author pin-only PRs touching auto_merge.human_merge_paths (the last path that still required a person), as #16265 scopes.
Code reads correct to me and is strictly a refactor-plus-wiring; routing to an approver only because it moves a merge-trust boundary (the relay stops holding a class of PRs that previously always required a human merge).
What I verified (tree at b5c1f96):
src/pkg/github/pin_only_provenance.gois a faithful lift of the sweep'spinOnlyCommitsTrusted/pinOnlyActionPinUpstream/ trusted-login helpers out ofpkg/github/automerge/automerge_human_paths.go; the sweep now callshgithub.PinOnlyActionPinsUpstream/PinOnlyCommitsTrustedso both paths cannot drift. Author, committer (web-flow or trusted), verified signature, head-is-last-commit, tag deref depth 3, andcomparestatusahead|identicalall carry over unchanged.human_merge_paths.go:269-286only lifts the gate when, in order: exception enabled for the repo, PR user intrusted_authors,req.ExpectSHAnon-empty and equal to the fetched head,changed_filescount present and equal to the listed files, classifier ok, commits trusted, pins upstream-anchored, and the head re-fetched after listing still equalsExpectSHA(pinOnlyProvenance, lines 303-308). Any other outcome falls through to the existingHoldForHumanMergePaths+ refusal, so a non-qualifying PR behaves exactly as before.ExpectSHAis also what the eventual merge uses (merge_request_watcher.go:189).SetHumanMergePinOnlyfails closed on duplicate normalised keys and clones slices;notifywire.go:38-44only forwards entriesHumanMergePinOnlyForreports enabled (which already rejects case-duplicate keys and invalid specs).- The non-GitHub-forge branch in
merge_request_watcher.gois untouched, so it stays fail-closed. human_merge_paths_test.go:306-460covers trusted pass, disabled, untrusted, mixed diff, extra file, path outside globs, missing patch/count, incomplete list, wrong head, head moved during fetch, reload, and that green CI is still required.go build ./pkg/github/... ./cmd/hive/is clean on this head.- Docs (
src/docs/hive-merge.md, operator-reference, config comments) updated from "relay pending" to "relay enforces"; matches the code.
One scope note, not a defect: the diff goes beyond #16265's checklist by also running the commit-provenance and upstream-anchor checks in the relay. That is tightening, not loosening, and the body says so; I think it is the right call.
I have not approved anything; an approver should decide whether the relay exception should land.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
… for a decision, not the fixer (#16676) A hive-superseding PR whose every reviewer perspective returned requires_human as a pure approver question (decision requested, no finding above info) was routed to the fixer by the superseder rule. The fixer had nothing to push, the cycle hit its cap, fixer-exhausted re-authored the change, and the next PR repeated it (#16398 -> #16456 -> #16607) while no operator was ever asked. Aggregation now keeps such a head requires_human with its decision question, RouteHuman parks it at 085 needs-decision with approve / request-changes actions, and the tracker's review chevron says the head is verified and waiting on sign-off. Fixes #16675 Signed-off-by: Andrew Anderson <andy@clubanderson.com> Co-authored-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
For the adjudicator's "no human has stated this yet" note: the human-authored policy issue for this exception is #16242 (@hanthor, 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
clubanderson
left a comment
There was a problem hiding this comment.
Owner decision (@clubanderson): approved. The policy is already stated by the delegated maintainer in #16242 (utah#1082): trusted author, exact head, complete diff, pin-only class, fail-closed, consistent across relay/sweep. Sweep and /approve enforce it since #16266; the relay must match. Approved at 687f4cb; CI still gates.
|
LGTM label has been added. DetailsGit tree hash: 0b38e5fc45d4fe87aab38255010ec5419cb00e59 |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clubanderson, hivecommons-hive[bot] The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #16265
Supersedes #16456
The
hive-mergerelay was the last human-merge path that ignored the trusted-author pin-only exception. The automerge sweep and/approvealready enforce it (#16266). This change adds the exception to the relay using the same provenance checks, which now live inpkg/githubso all three paths use one implementation. The relay also requires the exact requested head. A PR that is not a proven pin-only change keeps today's hold, marker comment and refusal, and non-GitHub forges stay fail-closed. Docs, config comments and the changelog now say the relay enforces the exception.Part of #16242
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@hanthor