Skip to content

πŸ› Lead 090 merge-gate action is Approve and let hive merge - #15668

Merged
clubanderson merged 4 commits into
v5from
fix/let-hive-merge-lead
Oct 30, 2026
Merged

clubanderson merged 4 commits into
v5from
fix/let-hive-merge-lead

Conversation

@clubanderson

Copy link
Copy Markdown
Member

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

  • Tracker 090 rows β€” inline lead action, row-menu first item, decision popover, delegate-plan dialog merge button and toasts now lead with 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-now is 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 in tracker-filter.js) agree on order and wording via shared constants.
  • Automerge β€” the trusted-author sweep now honours an operator's recorded queue-merge admission on an untrusted-author PR (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"").
  • Docs (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, regenerated static/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

  • New: 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.
  • Updated label/order expectations across dashboard and automerge tests.
  • go test ./pkg/dashboard/... ./pkg/github/automerge/ ./pkg/delegatedecision/ ./pkg/rebasemerge/ ./pkg/github/ green. No static-src/js/*.test.js exist (JS tests are Go-driven).

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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#15516 πŸ“– docs: split the operator reference same files src/docs/operator-reference.md
#15671 πŸ› review: the hive closes its own already-landed PRs instead of asking a person same files src/docs/hive-merge.md
#15308 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files src/docs/labels-and-control-signals.md
src/pkg/github/automerge/automerge_sweep.go
src/pkg/github/automerge/automerge_sweep_test.go
#15530 πŸ› fix(dashboard): issue-row linked PR passes null when the lineage chip is empty same files src/pkg/dashboard/static-src/js/tracker-row.js
src/pkg/dashboard/static/index.html
#15566 🌱 refactor: split stage tracker UI tests same files src/pkg/dashboard/static/index.html
#15658 πŸ› fix(tracker): PRs at CI / Review ride no merge train; overlap hint instead same files src/docs/dashboard-sections.md
src/pkg/dashboard/static-src/js/tracker-filter.js
src/pkg/dashboard/static-src/js/tracker-row.js
src/pkg/dashboard/static/index.html
#15405 πŸ› fix: require verified signature for email-only hive commit identity match CONFLICT src/docs/operator-reference.md
#15633 🌱 refactor: split stage tracker UI tests same files src/pkg/dashboard/static/index.html
#15669 ✨ Stream the tracker's sounds on the Activity Monitor Twitch stream same files src/pkg/dashboard/static/index.html
#15521 🌱 refactor: split tracker row source same files src/pkg/dashboard/static-src/js/tracker-row.js
#15680 πŸ› review: one backlog issue per finding; carried-over notes never refile same files src/docs/dashboard-sections.md
src/pkg/dashboard/static-src/js/tracker-filter.js
src/pkg/dashboard/static-src/js/tracker-row.js
src/pkg/dashboard/static/index.html
#15684 πŸ› ci-maintainer: cap open merge-hotspot refactor issues (default 2) same files src/docs/operator-reference.md

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>
@kubestellar-prow kubestellar-prow Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • relative links and anchors resolve

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission β†’ 071-needs-author: optional-check-failing:relative links and anchors resolve

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • golangci-lint

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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>
@clubanderson
clubanderson merged commit c8731a8 into v5 Oct 30, 2026
75 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/let-hive-merge-lead branch October 30, 2026 05:03
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:

  1. src/pkg/github/client.go:3053-3141 β€” QueuePRAutoMergeWithNoteResult skips the APPROVE review on hive-own PRs, falls back to a comment, and api_repo_item_decision.go:591-604 then calls RecordOperatorPullRequestApprovalWith(... LiftNeedsHuman: true ...). This is defensibly coupled (the new default button would otherwise 422 on hive-own 090 rows), but the body should say so.
  2. src/pkg/github/review_request_watcher.go:559-575 β€” handleOneReviewRequest now 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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ⚠️-titled PR with Approve & merge as maintainer, a button that no longer exists after this PR (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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

hivecommons-hive Bot added a commit to Karibhou/hive that referenced this pull request Oct 30, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracker 090: lead merge action should be "Approve and let hive merge", not a direct maintainer merge

1 participant