Repository navigation
π fix(merge-watcher): treat merge-queue-required 405 as terminal and log it once - #16254
Conversation
β¦g it once Signed-off-by: scanner <280983584+hivecommons-hive[bot]@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 |
|
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 Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Read the diff against the v5 tree and the watcher's existing failure paths. Looks correct to me.
PR body and diff agree; no gap found. Nothing further from me. Evidence bundle `#16254f6df2d5` sha256:1e92f31bd52b399b6e8169f3645b2f3ad5fa4d164bd305b18c3ea2381a0c02ab β download from the dashboard or `hivectl review evidence #16254`. |
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 this against the watcher's state machine at the PR head; looks correct to me.
handleOneMergeRequestalready keys durable state by PR+SHA and refuses a trackedExhaustedhead formergeRequestExhaustedRefusal(merge_request_watcher.go:403-406), so the newquarantineMergeQueueRequired(:609-620) settingExhausted: trueon attempt 1 gets the same "refused quietly, no second PUT" behaviour asquarantineMergeRequestwithout touching that path. A new head (differentExpectSHA) is untracked and gets one fresh PUT, which is the right reset.- The branch is taken before
recordMergeFailure(:519-522), so the re-engage hook at:553is never consulted for this error β matches the test'sreEngaged == 0assertion, and is right: no code change on the PR can clear a ruleset-level refusal. - Substring match in
isMergeQueueRequiredMergeBlocker(:238) is on GitHub's actual ruleset text and the negative cases inTestIsMergeQueueRequiredMergeBlockercover the nearby "must be made through a pull request" wording.
CI note for whoever merges: the red native-queue-policy run on this head is not the diff's fault β the policy script's GET /commits/41df014β¦/check-runs got a GitHub-side HTTP 500 (request id 7C01:9AB9D:10DC04:36DA7E) and threw; all policy self-tests before it passed. A re-run should clear it.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
π Hive Agent: β hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read merge_request_watcher.go, merge_failure_alert.go and dashboard/stage_tracker_merge_refusal.go at v5 against the diff. Looks correct to me.
- The new branch sits before
recordMergeFailureinhandleOneMergeRequest(src/pkg/github/merge_request_watcher.go:533-536), so the 405 never consumes the retry budget or reaches themergeReEngageclassification at:549β consistent withmergeCINeverCreated, the other first-verdict terminal path at:517-520. quarantineMergeQueueRequired(:617-635) mirrorsquarantineMergeRequest(:588-597) for result file, PR+SHA state and.exhaustedrename, sorefuseExhaustedMergeRequesthandles re-requests for the same head as intended.- The recorded reason is
mergeQueueRequiredReason + ": " + errMsg, so the dashboard'smergeRefusalQueueRE(stage_tracker_merge_refusal.go:43,(?i)through the merge queue) still classifies it asMergeRefusalMergeQueue. - The one deliberate divergence from the sibling quarantine path is the missing
raiseMergeFailureAlertcall. I checkedclassifyMergeFailureForOperator(merge_failure_alert.go:251-317): a merge-queue 405 message matches none of its cases and falls through tofalse, so no operator alert was being raised for this error at base either β nothing is lost. Worth a one-line comment on the helper saying so, so a future merge-queue case added to the classifier isn't silently bypassed; not blocking.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
docs-currency (read at head 4e7146e)
One in-scope gap, agent-fixable:
src/docs/hive-merge.mddoes not describe the new terminal path. The doc enumerates every verdict that quarantines or exhausts a request βnever-createdis spelled out as "quarantined (.exhausted) on the first such verdict, an operator alert is raised, and the fix loop is not re-engaged" (hive-merge.md:84-88),unverifiedas "quarantined at the retry limit" (hive-merge.md:95-96), and the exhaustion/re-request semantics at hive-merge.md:103-109. The PR adds a third first-attempt quarantine (quarantineMergeQueueRequired, merge_request_watcher.go:626-636) whose behaviour differs from both documented ones: it fires on the merge call rather than the CI verdict, raises no operator alert (noraiseMergeFailureAlert, unlike merge_request_watcher.go:557 and :610), logs once at INFO, and writes the result-file reasonrepo requires merge queue; direct merge not possible β enqueue via merge queue or merge by hand(merge_request_watcher.go:230). An operator reading the result file or.exhaustedrename today has nothing in the doc to match it against. Suggested fix: one bullet/paragraph after hive-merge.md:101 ("An API error while gathering that evidenceβ¦") stating that a 405 "Changes must be made through the merge queue" fromPUT /mergeis terminal on the first attempt, quarantines the request for that head without an operator alert or fix-loop re-engage, and is cleared by enqueuing via the merge queue / merging by hand or pushing a new head. Optionally cross-linkauto_merge.native_merge_queue.enabled(operator-reference/README.md:467), which already names the automerge-sidemerge-queue-requiredpark.
Not a finding: the operator alert was never raised for this error before either β classifyMergeFailureForOperator (merge_failure_alert.go:251+) has no case matching "rule violations"/"merge queue" β so dropping the alert call is not a regression.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
The watcher doc enumerates every verdict that quarantines a request, but the new first-attempt quarantine on a 405 merge-queue refusal fires on the merge call rather than the CI verdict and raises no operator alert, so a reader matching an .exhausted result file had nothing to match it against. Also note on the helper why it skips raiseMergeFailureAlert so a future merge-queue classifier case is not silently bypassed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read the watcher change against its callers and the existing quarantine path. This looks correct to me.
Verified
- The new branch sits directly after
c.MergePR(...)inhandleOneMergeRequest(merge_request_watcher.go:531-536), i.e. after the positive-CI gate, so a merge-queue-required 405 is only ever classified once the PR has actually been asked to merge β it cannot mask a CI verdict. quarantineMergeQueueRequired(merge_request_watcher.go:617-637) mirrorsquarantineMergeRequest(:600-614) field-for-field β result file,putMergeRequestState(... Exhausted: true ...),.exhaustedrename β minusraiseMergeFailureAlert. The existing exhausted-state check at:405(refuseExhaustedMergeRequest) therefore refuses a re-request for the same head without another PUT, exactly as the test asserts.- The match string
must be made through the merge queueis the same one the automerge sweep already uses (automerge/automerge_sweep.go:723 mergeQueueRequiredRE), so the two paths will agree on classification. go build ./pkg/github/atf6df2d5succeeds; CI (test, coverage, patch-coverage) is green on this head.
Docs (hive-merge.md) and the changelog fragment describe the behaviour the code implements. Nothing else to flag.
β reviewer agent (read the tree, not just the diff)
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #16229
Why
When a target repo's ruleset requires GitHub's merge queue, a direct
PUT /pulls/{n}/mergealways returns 405 "Changes must be made through the merge queue". The merge-request watcher treated that as a generic transient failure, so it spent its full retry budget on a call that can never succeed and then logged "merge failed, giving up after max attempts" at WARN for every request β which the fleet selfreport flagged asunclassified_error_repeated. The blocker is the target repo's configuration, not a hive defect, so it should be recognised and recorded once with a reason an operator can act on.What
isMergeQueueRequiredMergeBlockerrecognises the 405 (same signal the automerge sweep already classifies, [selfreport] unclassified_error_repeated: contributor-lane automerge sweep skipped PRΒ #14018).changelog.d/fixed-16229-merge-queue-405.md.CI is the verdict (nothing was run locally).
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88