Repository navigation
π automerge: name a standing change request in the review-required ask; no merge call on a conflicting head - #16098
Conversation
β¦k; no merge call on a conflicting head A. When GitHub refuses the merge for want of an approving review and a person's change request still stands (their latest opinionated review is CHANGES_REQUESTED, on any head), the stage/085-needs-decision comment now names the reviewer, the commit they reviewed and a compare link to what the hive pushed since, and asks them to re-review or a maintainer to dismiss the review, instead of asking anyone to Approve over it. noteStageReviews records StandingChangeRequests from the review list the lane already read; drain carries it onto the observation. PRs without a standing request keep today's text. Seen on projectbluefin/utah-packages hivecommons#633: three 085 comments asked for an Approve while @hanthor's CHANGES_REQUESTED stood. B. The self-authored sweep re-checks mergeable_state on its merge-time re-read and skips a dirty head as conflicting, and a 405 "Pull Request has merge conflicts" from any lane is reported as conflicting instead of merge-failed (hivecommons#633 called PUT /merge on a conflicting PR at 18:29Z and bounced 070 -> 080 -> 070). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.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
|
There was a problem hiding this comment.
Read the diff against the tree at 22d5fb0; both fixes look correct to me.
- B (conflict skip).
refusedMergereturns"conflicting"for the 405 (automerge_merge_refusal.go:224), and that reason is not in the refusal set that parks at 085 (automerge_merge_refusal.go:86), so it takes the ordinary skip path; the self lane already maps it throughhumanConflictReasons(automerge_stage_human.go:140), same as the contributor lane does atautomerge_contributor_lane.go:1393. The pre-mergemergeCallConflicting(current)check intrySweepSelfAuthoredPRsits after the head re-read and before the review gate, so it cannot skip a head that was not re-verified. - A (standing change request).
standingChangeRequestskeys on the login's latest APPROVED/CHANGES_REQUESTED/DISMISSED review, so a later COMMENTED review does not clear it and a dismissal does β that matches how GitHub keeps a change request standing across pushes. All threenoteStageReviewscallers (automerge_sweep.go:3071,3347,automerge_human_changes_requested.go:60) pick up the new field with no signature change, anddrain()copies it only underReviewsKnown, so a cycle that did not read reviews cannot blank it. The override inhumanEvidenceruns before the adopt-fence prefix atautomerge_stage_human.go:464, so that prefix still applies.
go build of pkg/github/automerge and pkg/stageengine/prstage passes at this head, and the new test files type-check.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Correctness review (head One edge case, advisory (not blocking): A non-collaborator's CHANGES_REQUESTED is reported as the blocker. (at Review findings from Security perspective (read at head 22d5fb0). Untrusted reviewers can author the hive's 085 ask (medium). Suggested fix β apply the same trust filter the self lane already uses: (at Fix B ( |
|
@Danathar this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (2 waiting): fixes are handed out before new work as soon as you have capacity. |
There was a problem hiding this comment.
Read the diff against the tree at 731a527; this looks correct to me.
- B (conflict skip).
automerge_sweep.go:2218runsmergeCallConflicting(current)on the merge-time re-read, after the head-SHA equality check, so it only ever skips a head that was already verified to be the evaluated one.reject(:1963) closes over the first-readpr, butrejectBeforeLane(:2353) uses it only forpr.GetBase().GetRef(), so passing the stale read there is harmless.mergeConflictMergeErroris scoped to a 405 whose message matches "pull request has merge conflicts", andrefusedMergereturnsconflictingwithout remembering it, which is right since the next read'sdirtystate carries the fact. - A (085 prose).
standingChangeRequests(automerge_stage_labels.go) takes the last APPROVED/CHANGES_REQUESTED/DISMISSED per login in list order and ignores COMMENTED, which matches how GitHub keeps a change request standing; bots and the hive app are excluded viaisHiveAppReviewAuthor(automerge_sweep.go:3389). The map iteration is made deterministic by the sort onSubmittedAt, then login. The compare link slices the review URL at/pull/, which yields the repo URL β correct for GitHub review HTML URLs. - Tests cover both behaviours (merge-time
dirty/conflicting, the 405 path, the unknown-state bool fallback, and the prose shapes), andstage-labels.mdplus the changelog fragment describe the new behaviour.
No findings.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Summary
Two related fixes on the self-authored merge path, both seen on projectbluefin/utah-packages#633 (hive-adopted,
hive/adopt-627, build 6f6a5ca).A. The 085 "approving review required" ask names a standing change request. When GitHub refuses the merge for want of an approving review and a person's change request still stands on the PR, the
stage/085-needs-decisioncomment now:It no longer asks anyone for an Approve over it. PRs without a standing change request get exactly today's text.
B. No merge call on a PR GitHub calls conflicting. The self-authored sweep now re-checks
mergeable_stateon its merge-time re-read and skips adirtyhead asconflicting. A 405 "Pull Request has merge conflicts" from any lane is nowconflicting, notmerge-failed.The bugs
A: asked to approve over a colleague's change request
1760767: the title said seven libraries but only five recipes were added, and the RPM Fusion / negativo17 source policy should be its own PR.reviewDecisionis stillCHANGES_REQUESTED.hive:stage-needs-decisionthree times (10-30 06:02Z, 10-31 11:31Z, 16:12Z), each saying only: "GitHub refused the merge: branch protection requires an approving review β¦ A GitHub Approve review on this head β¦ lets the hive merge it." None mentions the change request.Why, at 6f6a5ca:
latestTrustedHumanChangesRequested(automerge_human_changes_requested.go:19) treats "a changes_requested left on an older commit [as] outdated: the author already pushed past it" (β¨ stage 085: route a maintainer decision / changes_requested on a hive-authored PR back to the author agentΒ #13041). SohumanChangesRequestedForHead(automerge_sweep.go:2036) passes, and the PR reaches the merge call. I kept that.mergeRefusedReviewRE(automerge_merge_refusal.go:44) already matches the ruleset form, "1 review requesting changes by reviewers with write access".automerge_stage_human.go:631), and nothing on the stage detail carried the review.noteStageReviews(automerge_stage_labels.go:627) recorded only a count.B: PUT /merge on a conflicting PR
Hive log, 10-31:
automerge skip β¦ pr 633 reason conflicting.337fa03). It ran every gate and called merge:WARN self-authored automerge sweep skipped PR β¦ reason merge-failed: PUT β¦/pulls/633/merge: 405 Pull Request has merge conflicts.merge-failedreason moved the stage070 β 080(18:30:23Z) and back to070 conflictingat 18:31:56Z.Why, at 6f6a5ca:
trySweepSelfAuthoredPRchecks for a conflict only on its first read (automerge_sweep.go:2067).automerge_sweep.go:2195).refusedMerge(automerge_merge_refusal.go:205) classifies review-required, method-not-allowed and merge-queue 405s, but not the conflict one, so it fell through tomerge-failed(automerge_sweep.go:2246).The fix
A.
Record the requests.
noteStageReviewsnow also recordsStandingChangeRequestson the stage detail: everyone (the hive app and[bot]logins excluded) whose latest opinionated review (APPROVED / CHANGES_REQUESTED / DISMISSED, the same rulehasOutstandingChangesRequesteduses) is CHANGES_REQUESTED, on any head, with commit, time and URL. The reviews were already listed on this pass, so this adds no API call.drain()carries the field onto the observation.Use them in the comment. In
humanEvidence, amerge-refused-reviewcause with standing requests becomesmergeRefusedReviewChangeRequestCause, for example:A request on the current head says "on this head", with no "pushed since". The comment is posted once per head and cause, as before.
Not done: re-requesting the review automatically. It is an unsolicited write that would need its own write-back kind and an owner call on when the hive may ping a person. The comment carries the ask instead. Happy to follow up if wanted.
B.
mergeCallConflicting(current)skips withreject("conflicting"), the same as the first-read check. It is true formergeable_statedirty/conflicting, or formergeable: falsewhile the state is stillunknown/empty. A known state wins over the bool, as inhgithub.MergeableFromState.refusedMergereturnsconflictingfor a 405 "Pull Request has merge conflicts". It is not remembered, since the next read showsdirty. This covers the self-authored, trusted-author, queued and contributor lanes.blockedcannot tell missing reviews from pending checks, and the existing per-head review-refusal memory already stops repeat calls after the first 405 (knownMergeRefusal).Out of scope, unchanged: branch-protection settings, App bypass, and the trusted-author lane's own conflict path (merge-forward).
Tests
pkg/github/automerge/automerge_merge_change_request_test.go:A, the end-to-end feat: per-agent UID isolation for mandatory proxy enforcementΒ #633 shape. A real self-authored sweep pass runs against a fake whose reviews are:
Merge answers 405 review-required. After
drain(), the observation carries only @hanthor's request.humanEvidenceandDecisionCommentname @hanthor, the date,1760767, the review link and the compare link, and ask for a re-review or a dismissal, without "A GitHub Approve review on this head". With no standing request, the cause equalsdecisionCause("merge-refused-review"), today's text.A, text shapes. No requests gives an empty cause; a request on the head doesn't claim a push since; two reviewers read "@hanthor and @castrojo"; no compare link without a URL.
B.
cleanwith a re-readdirty/conflictinggives a skip asconflictingwith zero merge calls.conflicting, nevermerge-failed.mergeCallConflictingreads the bool only while the state is unknown.Fixture.
selfAuthoredPRgainsreviewsandrecheckMergeableState.Results:
go test ./pkg/github/... ./pkg/stageengine/... ./pkg/stagelabels/... ./pkg/review/... ./pkg/dashboard/... ./cmd/hive/...passes;go vetis clean.drain()ornoteStageReviews, counted bots, let the first review win, ignored dismissals, removed the evidence override, dropped the compare link, claimed a push for an on-head request, and joined names wrong.Docs and changelog
src/docs/labels-and-control-signals/stage-labels.md: themerge-refused:*row.changelog.d/fixed-merge-refused-review-change-request.md.Related: #13041, #15159, #15419.
π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1