Repository navigation
π Activity Monitor: an owner's Approve admits the untrusted-author PR head β no adoption, merge as-is; DCO warned before acting - #15156
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: clubanderson <407614+clubanderson@users.noreply.github.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply. |
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
|
@clubanderson this PR is held at Failing checks:
Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path. |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether a dashboard Approve by any collaborator with GitHub write permission (the bar canToggleRepoHold enforces) is meant to admit an untrusted-author head for as-is merge, or whether the record path in operatorAdmission should require isTrustedMerger like the comment-derived path does.
Conclusion: the mechanism is coherent and builds clean at 75d27b7, but (1) CI is red on a fragment-shape problem, and (2) the trust bar the dashboard path actually enforces is weaker than the one #15136 and this PR's own second admission source state. The second point is a policy choice for the owner, not a code defect I can settle.
1. changelog-fragment-guard failure (blocking, trivial)
changelog.d/fixed-owner-approve-admits-untrusted-pr.md:1has no leading-bullet; the guard rejects it (run 40785543482: "a fragment must start with a '- ' entry bullet").changelog.d/fixed-15156.md:1is a second fragment for the same PR (the title-autofix one), so two entries will compile for one change, and its text readsPR head no adoptionβ the dash between them was lost.
Suggest keeping one fragment, bulleted.
2. Trust bar: write permission vs trusted merger (medium, security)
src/pkg/dashboard/api_repo_item_decision.go:271gates every row decision withcanToggleRepoHold, which passes for owner-role, the repo owner, or any user whoseGetPermissionLevelis write (src/pkg/dashboard/api_repo_hold.go:75-114).handlePullRequestDecisionthen callsadmitPullRequestHead(api_repo_item_decision.go:597), which writesadmitted_by: operator-approval:<login>unconditionally.- In the lane,
operatorAdmission(src/pkg/github/automerge/automerge_operator_admission.go:33-38) returns that login straight fromrec.Admission(head)with noisTrustedMergercheck β whereas the comment-derived path three lines below (:40-45) refuses unlessisTrustedMerger(login)is configured and true.
Consequence: a write-permission collaborator who is not in the hive's merger set can press Approve β let hive merge and the contributor lane merges an untrusted author's head under the hive's identity after soak; the same person's /hive decision approve comment would be refused. #15136 scopes this to "an owner / trusted-merger Approve". merge-now already merges at the write-permission bar today, so this is a widening of deferred merge rather than a brand-new capability β which is why I'm routing it rather than calling it a defect. If write permission is the intended bar, a one-line note in operator-reference.md saying so would close the gap; if not, operatorAdmission should apply the same isTrustedMerger check to the record path (and admitPullRequestHead could skip writing when the server can see the user is not a merger).
What I checked and found correct
Record.Admission(stagelabels/store.go:1251-1257) compares the head, so a new push drops the admission as the comment promises;NoteAdmissionis idempotent on the same head/by.adoptionRefusedByAdmission(automerge_operator_admission.go:60-73) is skipped whenrequestedis set, so an explicit Adopt / Re-author still wins; it is called beforemaintainerHoldsAdoptioninadoptContributorPR(automerge_contributor_adopt.go:595).admitContributororders the operator path afteradoptedHeadOwnedByHiveand before the registry path (automerge_contributor_lane.go:619-624), matching the issue's "admitted before the registry / claim-marker paths".go buildofpkg/dashboard,pkg/github/automerge,pkg/stagelabelspasses at this head (tests are CI-only for me).
I have not approved, requested changes, or closed anything.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether a dashboard Approve by a user who only holds GitHub write permission (not a configured trusted merger / owner) may write admitted_by and admit an untrusted author's head to contributor-lane auto-merge, or whether admitPullRequestHead must be gated on the trusted-merger check the /hive decision approve path already applies.
The mechanism is sound and the adoption refusal is wired where it needs to be; one trust-bar question and one reproducible CI failure.
1. Two admission sources, two different trust bars (merge/trust policy β needs an owner call). #15136 scopes this to "an owner / trusted-merger Approve". The engine's comment-derived path honours that: src/pkg/github/automerge/automerge_operator_admission.go:40-46 takes recordedHumanApprovalForHead only if isTrustedMerger(login) is configured and true. The stage-record path does not: lines 33-38 return rec.Admission(head) as-is. That record is written by admitPullRequestHead from the dashboard (src/pkg/dashboard/api_repo_item_decision.go:473 and :597), and the only authorisation in front of it is canToggleRepoHold (:271), which passes a verified owner role, the repo owner, or any signed-in user with GitHub write permission (src/pkg/dashboard/api_repo_hold.go:74-114, cached). Consequence: a write-permission collaborator who is not in the hive's trusted-merger set can, with the plain approve decision (which until this PR only posted a comment), admit an untrusted author's head so the lane merges it under the App identity after soak, and adoptionRefusedByAdmission then keeps the adoption engine off it. If write-permission is the intended bar, say so in the PR body and docs (the title and issue both say "owner"); if not, admitPullRequestHead should consult the same merger authoriser, or the engine should re-check AdmissionLogin(by) against isTrustedMerger before trusting the record.
2. changelog-fragment-guard is red and reproduces locally. bash src/scripts/check-changelog-fragment.sh v5 at 75d27b7 β ::error file=changelog.d/fixed-owner-approve-admits-untrusted-pr.md::a fragment must start with a '- ' entry bullet. The branch also carries a second, autofixed fragment changelog.d/fixed-15156.md for the same change (with a dropped em-dash: "PR head no adoption"). Keep one, starting with - .
What I checked and found correct: admitContributor ordering (adopted-head β operator β registry β claim marker, automerge_contributor_lane.go:619-627) matches the issue's "admitted before the registry / claim-marker paths"; adoptionRefusedByAdmission is called before maintainerHoldsAdoption and skips when the Adopt/Re-author label was requested (automerge_contributor_adopt.go:595), so an explicit Re-author is not blocked by the admission it follows; Record.Admission is head-scoped so a new push drops the override; NoteAdmission returns false without an existing record and the lane's second source covers that case. go build ./pkg/dashboard/ ./pkg/github/automerge/ ./pkg/stagelabels/ passes.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦ head β no adoption, merge as-is; DCO warned before acting An owner/maintainer Approve (approve, queue-merge or merge-now) on a contributor-lane PR is now a trust override for that head: the stage record carries admitted_by: operator-approval:<login>, the contributor lane admits the author for that head (contributor-lane:operator-approval) and merges as-is after checks and soak, and the adoption engine refuses to adopt or supersede while the admission stands (adopt_blocked_by: operator-admission) unless the person explicitly asks for it. A /hive decision approve by a trusted merger is the same admission, derived from the recorded approval and written back. When the head cannot merge as-is (commits without a Signed-off-by) the 090 popover and both Approve confirms say so before acting and offer "Re-author as hive PR" as a separate decision (re-author), which queues adoption with its own note and never merges. Fixes #15136 Signed-off-by: Andrew Anderson <andy@clubanderson.com>
75d27b7 to
c2cd366
Compare
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at c2cd366. |
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Fixes #15136
Live evidence (hive's hive 17:53β17:55 ET): the operator pressed Approve on untrusted-author PRs #15029/#15086/#15090; the approval was reduced to
/lgtm+/approvecomments and the contributor lane's claim-tier rule then adopt-superseded them β "I approved these and then they went to adoptedβ¦".Policy change β Approve is the trust override for that head
approve,queue-merge,merge-now) writesadmitted_by: operator-approval:<login>(+admitted_head,admitted_at) on the stage record before touching GitHub; response + audit carryadmitted_by.contributor-lane:operator-approval, merge comment names who admitted it); hive merges as-is after checks/soak, or immediately for merge-now.adoptContributorPRrefuses (adopt_blocked_by: operator-admission; row reads not adopted: a maintainer approved this head; the hive merges it as-is). An explicit Adopt / Re-author request is the person choosing re-authoring and is not refused./hive decision approveby a trusted merger is the same admission, derived from the recorded human approval and written back.DCO before acting
dco_unsigned/dco_totalon the row), the popover blocker and both Approve confirms say so before acting, and a separate lead action Re-author as hive PR (decision: re-author) appears β queues adoption with its own note, never merges; disabled with the reason on a person's PR.Tests
TestOperatorAdmissionRefusesAdoption(approve-on-untrusted β admitted, no adoption; explicit Adopt proceeds),TestOperatorAdmissionDerivedFromHumanApproval,TestOperatorAdmissionAbsent, admit-path/merge-comment helpers.TestRepoItemDecisionApproveAdmitsTheHead(approve/queue-merge/merge-now),TestRepoItemDecisionApproveWithoutRecordAdmitsNothing,TestRepoItemDecisionReauthorQueuesAdoptionWithItsOwnNote, decision-options subtests (DCO + admitted), ledger mapping, SPA rendererTestStageTrackerReauthorAndApprovalCaveats.TestStoreAdmission.Docs:
dashboard-sections.md,operator-reference.md; changelogchangelog.d/fixed-owner-approve-admits-untrusted-pr.md.