Repository navigation
π Lead 090 merge-gate action is Approve and let hive merge - #15668
Conversation
The maintainer has the last word on untrusted-author PRs, but the default way to exercise it is to approve and let hive merge through its own App (queue-merge: next automerge tick once CI is green, soak and self-merge ban apply). Direct merge stays available as the secondary 'Merge now as maintainer'. - Tracker 090 rows: inline lead, row menu, delegate-plan dialog button and toasts lead with decide:queue-merge; decide:merge-now is secondary (its 'Rebase, then merge as maintainer' variant stays secondary too). - Automerge trusted-author sweep now honours an operator's recorded queue-merge approval on an untrusted-author PR and attributes the merge comment to that operator. - Docs, glossary, help-coverage test, changelog fragment. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
[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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
GitHub refuses an App's APPROVE on its own pull request (422 'Can not approve your own pull request'), so 'Approve and let hive merge' on a hive-authored PR failed with 'effect outcome uncertain'. On a PR the hive opened, QueuePRAutoMerge now posts the queue line as a comment and applies the label without a review (the same fallback runs when GitHub answers that 422 for an author the hive did not recognise); the dashboard records the operator's approval in the hive's store exactly as the plain Approve does, so the self-authored lane merges on it. The review-request watcher downgrades a refused own-PR review to a COMMENT instead of retrying. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
@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. |
|
stage 080-awaiting-merge-admission β 071-needs-author: optional-check-failing:relative links and anchors resolve |
Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
@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. |
|
stage 080-awaiting-merge-admission β 071-needs-author: required-check-failing:golangci-lint |
Keeps the direct-write ratchet at its baseline and drops the ineffectual apiEvent assignment golangci-lint flagged; adds the relay test. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
There was a problem hiding this comment.
Intent alignment vs #15666 (read at a4d2f3e)
All four expectations in #15666 are implemented: decisionHumanMergeLeadOptions leads with queue-merge (src/pkg/dashboard/stage_tracker_decision.go:389-394), labels match verbatim (:378,:382), decide:queue-merge writes the admission before any GitHub call (src/pkg/dashboard/api_repo_item_decision.go:583) and the sweep now consumes it via trustedAuthorOrOperatorDecision β operatorAdmission (src/pkg/github/automerge/automerge_sweep.go:2280-2291, automerge_operator_admission.go:27-50), with the operator named in the merge comment (automerge_sweep.go:2667-2669).
Undocumented scope (low): the PR body does not mention two behavioral changes that the changelog fragment does:
src/pkg/github/client.go:3053-3141βQueuePRAutoMergeWithNoteResultskips the APPROVE review on hive-own PRs, falls back to a comment, andapi_repo_item_decision.go:591-604then callsRecordOperatorPullRequestApprovalWith(... LiftNeedsHuman: true ...). This is defensibly coupled (the new default button would otherwise 422 on hive-own 090 rows), but the body should say so.src/pkg/github/review_request_watcher.go:559-575βhandleOneReviewRequestnow downgrades a refused own-PR APPROVE/REQUEST_CHANGES to a COMMENT review. This is the agent review-relay path, not the 090 merge gate or the trusted-author sweep; nothing in #15666 asks for it.
Requested change: either add both items to the PR body's Changes section (so the body matches the changelog and diff), or split (2) into its own PR referencing a separate issue. No code change needed if you choose the former.
Not verified from this perspective: that the self-authored lane actually merges on the store-recorded approval (claimed in the changelog); the untrusted-author sweep path is covered by TestTrySweepTrustedAuthorPROperatorApprovalAdmitsUntrustedAuthor.
β hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Style / maintainability review (head a4d2f3e)
1. The PR body omits the own-PR review fallback that is ~40% of the diff β src/pkg/github/client.go:3004-3141 (PRAutoMergeQueueResult, IsOwnPullRequestReviewRefusal, pullRequestSelfAuthored, QueuePRAutoMergeWithNoteResult), src/pkg/github/review_request_watcher.go:559-575 (every agent review on a hive-authored PR is now downgraded to COMMENT), and the RecordOperatorPullRequestApprovalWith fallbacks in api_repo_item_decision.go:590-606 / api_repo_item_decide_delegated.go:794-811. The changelog fragment describes it, but the body's "Changes"/"Tests" sections (and #15666) do not, so a reader of the PR page cannot tell this behaviour change is here β and the watcher change affects reviews outside the 090 flow. Please add a bullet to the body, e.g.:
### Changes
+- **Hive's own PRs** β `QueuePRAutoMergeWithNoteResult` skips the App review on a self-authored PR (GitHub 422 "Can not approve your own pull request"), leaves the queue note as a comment and records the operator approval via `RecordOperatorPullRequestApprovalWith` so the self-authored lane merges on it; the review-request watcher downgrades such a refused APPROVE/REQUEST_CHANGES to a COMMENT review instead of retrying to quarantine (`client.go`, `review_request_watcher.go`).and list TestRepoItemDecisionQueueMergeOnHivePRRecordsApprovalWithoutReview / TestReviewRelay_OwnPRApproveRefusedBecomesComment under Tests.
2. Operator login smuggled through TrustedAuthorDecision.Role as "operator-approved:<login>" β automerge_sweep.go:2273,2290 is written once and parsed back three times (:2296, :2340, :2667). The struct at :709-712 is the natural home for it; a field avoids the prefix-strip in each consumer and keeps Role meaning a role:
type TrustedAuthorDecision struct {
Allowed bool
Role string
+ // AdmittedBy is the operator whose "Approve and let hive merge"
+ // admitted this head when the author holds no trusted role.
+ AdmittedBy string
}Advisory β not blocking.
3. One-shot retry written as for {} β review_request_watcher.go:559-575 loops forever with ownPRNote != "" as the exit sentinel to express "call once; if refused as own PR, downgrade and call once more". A straight-line second call reads more plainly than an unbounded loop whose termination depends on a string being non-empty. Advisory.
β hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
docs-currency β one stale operator-facing label survives the rename.
src/docs/operator-reference.md:435 (auto_merge.human_merge_title_prefixes row) still tells the owner to merge a src/pkg/dashboard/stage_tracker_decision.go:380-384 defines only Approve and let hive merge / Merge now as maintainer). The PR body states all "Approve & merge as maintainer" wording was aligned; hive-merge.md:331-333 got the equivalent fix but this row did not. The new stale-wording guard (src/pkg/dashboard/stage_tracker_merge_gate_help_test.go:34-38) only scans index.html and dashboard-sections.md, so it cannot catch it.
Suggested edit at src/docs/operator-reference.md:435 β replace the clause
-the owner merges it with **Approve & merge as maintainer** or on GitHub.
+the owner merges it with **Merge now as maintainer** (**Approve and let hive merge** is greyed, since the lanes never merge a breaking change) or on GitHub.Optionally add operatorReferenceDoc to the stale-wording loop in stage_tracker_merge_gate_help_test.go so the guard covers it.
β hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Reviewed (correctness) β contract #15666 is met; one low-severity edge in the own-PR fallback the diff adds.
Verified at a4d2f3e: queue-merge writes the head-bound admission before the GitHub call (src/pkg/dashboard/api_repo_item_decision.go:583), the self-merge ban still gates it (:572-575), and trustedAuthorOrOperatorDecision honours it with operator attribution (src/pkg/github/automerge/automerge_sweep.go:2280-2291, :2666-2669); TestTrySweepTrustedAuthorPROperatorApprovalAdmitsUntrustedAuthor covers no-approval / other-head / admit / permission-bypass.
Low β refused own-PR APPROVE is journaled as applied, so a repeat press skips the fallback (src/pkg/github/client.go, QueuePRAutoMergeWithNoteResult). When SelfAuthored is false and GitHub answers 422, the effect returns Result{}, nil, so the KindReviewSubmit claim is journaled applied. A second identical press (same head, same body digest) replays idempotently without running the effect: refusedAsOwn stays false, ReviewSubmitted becomes true, and the caller at api_repo_item_decision.go:590-603 skips RecordOperatorPullRequestApprovalWith and the comment β nothing is recorded for that press. Both new tests use the no-op boundary so this is not exercised. Carry the refusal in the provenance so replays see it:
if IsOwnPullRequestReviewRefusal(apiErr) {
// Policy, not a fault: nothing to reconcile later.
- refusedAsOwn = true
- return effects.Result{Provenance: provenance}, nil
+ return effects.Result{Provenance: provenance + ownPullRequestRefusedSuffix}, nil
}
return effects.Result{Provenance: provenance}, apiErr
})
if err != nil {
return res, fmt.Errorf("approving PR: %w", err)
}
+ refusedAsOwn = strings.HasSuffix(out.Provenance, ownPullRequestRefusedSuffix)(bind out, err = effects.ExecuteReconciling(...) and add const ownPullRequestRefusedSuffix = "#own-pr-refused".)
β hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
Port the v5 tracker-row.js changes (hivecommons#15657, hivecommons#15664, hivecommons#15668, hivecommons#15680) into the split files: stageTrackerAnchor under-repair column (tracker-row.js), acted labels (tracker-row-strip.js), queue-merge pending copy (tracker-row-acted.js), and stageTrackerLead / left_train / subRows / review notes (tracker-row-layout.js). static/index.html regenerated and matches the auto-merge byte for byte. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Fixes #15666
Maintainer: "'approve and merge as administrator' button should be 'approve and let hive merge'". The maintainer keeps the last word on untrusted-author PRs, but the default way to exercise it is now to approve and let hive merge through its own App (queue-merge: next automerge tick once CI is green; soak and self-merge ban apply). Direct merge stays available as the secondary action.
Changes
decide:queue-merge, labelled Approve and let hive merge (short Let hive merge; acted: "approved β hive will merge on the next tick once CI is green").decide:merge-nowis secondary Merge now as maintainer (its Rebase, then merge as maintainer variant stays secondary). Enabling rules/permissions unchanged. Server (decisionHumanMergeLeadOptions, delegated-plan alternatives) and JS (tracker-actions.js,tracker-row.js, glossary intracker-filter.js) agree on order and wording via shared constants.trustedAuthorOrOperatorDecision), bypassing the trusted-role / GitHub-permission requirement only for that explicit approval; the merge comment names the operator ("merged by Hive on behalf of @login β¦ with "Approve and let hive merge"").hive-merge.md,dashboard-sections.md,operator-reference.md,dashboard-copy-inventory.md,labels-and-control-signals.md,api-reference/packs-and-acmm.md), decision glossary,changelog.d/changed-let-hive-merge-lead.md, regeneratedstatic/index.html."as administrator" did not exist anywhere in
src/; all "Approve & merge as maintainer" / "Approve β let hive merge" / "Approve & merge as-is" wording was aligned.Tests
TestStageTrackerDecisionHumanMergeLeadOptions(lead selection),TestStageTrackerMergeGateLabelsHelpCoverage(Go consts β JS labels β help page, stale-wording guard),TestTrySweepTrustedAuthorPROperatorApprovalAdmitsUntrustedAuthor(automerge accepts an untrusted-author PR on operator approval, attributed comment), delegate-plan dialog cases for queue-merge lead vs merge-now fallback.go test ./pkg/dashboard/... ./pkg/github/automerge/ ./pkg/delegatedecision/ ./pkg/rebasemerge/ ./pkg/github/green. Nostatic-src/js/*.test.jsexist (JS tests are Go-driven).