Repository navigation
π github: exhausted merge request re-evaluates a CI-gate verdict before refusing - #17608
Conversation
β¦re refusing 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 Review findings from docs-currency β reviewed head b031bfb. Operator doc still describes the behaviour this PR removes. Advisory: Review findings from Read the full diff against What I verified:
One trade-off worth having in view (not a defect): a CI-exhausted head now costs one full gate evaluation (PR GET, protection, check runs, workflow runs) per re-request inside the 24 h window, where before it cost nothing. The poll cycle is still not restarted β a fresh Review findings from Conclusion: looks correct to me; read against the v6 tree, not just the diff. What I verified at head
One observation, not a defect: the re-evaluation is unthrottled. A scanner that re-drops the same request every kick will now cost ~4 GitHub reads per kick per stuck PR for up to 24h, where before it cost zero. Given the typical queue size that seems acceptable; if it ever is not, bumping |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
Mutation testing (advisory)Head No surviving mutants in changed files. Advisory only; this job never blocks the PR (#17349). |
There was a problem hiding this comment.
Style/maintainability review (head b031bfb) β approve, one advisory.
src/pkg/github/merge_request_state.go:37-39introducesmergeRequestCIGateReasonPrefix = "ci gate: "and documents it as the prefix that "starts every reason the watcher's pre-merge CI gate (verifyMergeRequestCI) records", but none of the ~16 producers insrc/pkg/github/merge_ci_gate.go(e.g. lines 153, 168, 252, 257, 275, 277, 510) reference it β they still spell the literal. The invariant holds today (everyReasonpersisted viarecordMergeFailure/quarantineMergeRequestatmerge_request_watcher.go:702,755originates from those strings), but a future reason added without the prefix would silently opt out of the re-evaluation atmerge_request_watcher.go:804with no test catching it. Suggest either having the producers build on the constant (e.g. a smallciGateReason(format, ...)helper) or adding a test asserting everyverifyMergeRequestCIreason has the prefix. Not blocking.- Nit: the block comment at
merge_request_watcher.go:460-462still says an exhausted head "is refused with the recorded reason instead of starting another poll cycle"; the new inner comment corrects it, but the outer sentence is now partially stale.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Review follow-ups (below
|
β¦ted heads The operator doc still said an exhausted head is refused for 24h regardless of reason; the refusal message and the watcher's block comment did too. Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Style/maintainability review at head 1b5b368. Fix is sound and well-tested; two advisory notes, neither blocking.
-
Consumer-only constant β
mergeRequestCIGateReasonPrefix(src/pkg/github/merge_request_state.go:38) is used only byreevaluateExhaustedCIGate(merge_request_watcher.go:805), while all ~15 producer sites inmerge_ci_gate.go(e.g. lines 153, 168, 252, 257, 275, 510) still spell the literal"ci gate: ". The constant's doc comment asserts an invariant nothing enforces: a single producer rewording silently turns a CI exhaustion back into a 24h refusal. Suggest moving the constant next to the producers inmerge_ci_gate.goand using it there (or at minimum a test that everyverifyMergeRequestCIreason has the prefix). -
Hint applied to every refusal β
refuseExhaustedMergeRequest(merge_request_watcher.go:790) now tells the caller to "re-run the failing check and re-request" for all exhausted reasons, including conflict / permission / merge-queue-required, where re-running a check does nothing (and the new path refuses them without re-evaluation per line 805). Consider choosing the hint on the same prefix check.
Minor: the verify β downgrade β log triple at merge_request_watcher.go:808-814 duplicates lines 592-599; a small shared helper would keep the two gate call sites from drifting.
β hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
β¦re-run hint to CI refusals Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Addressed the two advisory review notes in ce7ceaa: the CI-gate prefix now lives in merge_ci_gate.go and every producer builds its reason from it (with a test); the re-run hint is scoped to CI-gate refusals; stale comment fixed. 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 |
There was a problem hiding this comment.
Read the diff against the tree at ce7ceaa (watcher, CI gate, state ledger and their callers). This looks correct to me.
What I verified:
- The prefix keying is sound end to end.
recordMergeFailurestores the rawerrMsgasReason(src/pkg/github/merge_request_watcher.go:703), and every path that exhausts a head on a CI verdict β red (:626), pending-timeout (:613, which only appends towhy), gate error (err.Error()fromverifyMergeRequestCI, prefixed atmerge_ci_gate.go:162/171/229) and the never-created quarantine β passes aci gate:-prefixed string through.TestMergeCIGate_ReasonsCarryPrefixpins that. Conflict / merge-queue / permission reasons come fromMergePRerrors and never carry the prefix, so they still refuse without a GitHub call (asserted by thenon-CI reason refusescase). - After a green re-evaluation the code clears the ledger and falls into the normal path at
:481-489, so the human-merge-path, review-hold, policy-gate and min-head-age checks all still run beforeMergePR. The carve-out does not bypass any gate; it only lifts the 24h refusal. - A still-blocking re-evaluation leaves the record untouched (
refuseExhaustedMergeRequestwrites no state), soAtis not refreshed and the 24h window does not slide.
Two notes, neither a defect:
- On the green path the gate is evaluated twice in one tick (
reevaluateExhaustedCIGatethen:597), roughly doubling the PR/checks/workflow-runs GETs for that request. Acceptable for a once-per-recovery event; mentioning so nobody later wonders why the gate logs two verdicts for one request. - Within the 24h window every re-request for a CI-exhausted head now costs a full gate evaluation (several API calls) rather than zero. A scanner re-dropping the request each kick on a head whose check is genuinely red will keep re-polling GitHub. The refusal is still terminal per request, so the poll cycle is not restarted, but the "cannot restart the poll cycle" guarantee in the
mergeRequestExhaustedRefusalcomment is now "cannot restart the poll cycle; does cost one gate evaluation per re-request".
Changelog fragment and hive-merge.md match the behaviour.
β 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 |
Why
The merge-request watcher records an exhausted request against the PR+SHA, then refuses every re-request for that head for 24 hours. That makes sense when the cause is a property of the head, such as a conflict, a permission refusal or merge-queue-required. It does not make sense for a CI-gate verdict. The gate can be wrong (and later fixed), or a check can be re-run green on the same SHA.
#17572 and #17596 were exhausted on the
check-cancelledfalse positive that #17599 fixed. The persisted record outlived the fix, sohive-mergekept refusing both PRs. For a hive-owned branch, the only workaround is an empty bump commit that re-runs the full CI matrix. A fork PR like #17572 has no workaround at all. The hive cannot push a new SHA, so an approved, green PR stays stuck until a person merges it by hand.When the recorded reason is a CI-gate reason (
ci gate: β¦), a re-request now re-evaluates the gate once. If the gate passes, the exhausted record is cleared and the request goes through the normal merge path with all its gates. If the gate still blocks, the request is refused as before, the recorded exhaustion stays in place and the fresh reason is added to the refusal. Non-CI reasons are still refused immediately, without any GitHub call. This is additive: nothing new is persisted and no manual reset flag is needed.Closes #17606
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88