Repository navigation
Conversation
β¦wrong thing A PR could merge when GitHub would then close something it did not mean to close (projectbluefin/testsuite, 2026-10-28): - hivecommons#1057's body said "Refs hivecommons#1023 β partial β¦ remain open" and also "Closes hivecommons#1023"; GitHub closed hivecommons#1023 on merge. - hivecommons#1054's only commit said "Apply the same fix hivecommons#1036 makes"; the squash merge closed the open PR hivecommons#1036. A. ClosingContradictions (pkg/github) returns each repo issue the body both closes with a GitHub closing keyword and says stays open or is partial. Every lane refuses it right after its label checks with closing-contradiction:#N, at no API cost, so the PR never reaches 090/095; a body edit releases it. A bare "Refs #N" next to "Closes #N" is unaffected (hivecommons#10826). B. The linked-issue gate now also refuses with closing-keyword-targets-pr:#N when a closing keyword in the body, or in a commit message on the head (Options.ScanCommitClosingKeywords, on in the hive), names a pull request. Target kinds are cached per number and commit messages per head. Both reasons route to 070/071/072 by author kind, and the contributor nudge names the fix; for a contradiction it says a body edit is enough. Only the form GitHub acts on counts as a close (GitHubClosingRefs): "Fixes the bug in hivecommons#12" does not. Hive-Run: hivecommons#15025 Hive-Plan: hivecommons#15025 Fix A (contradiction gate) + Fix B (closing keywords that target a PR) Hive-Spec: hivecommons#15025#acceptance-criteria Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HRH6km45ugnaTypgmg1q61 Signed-off-by: Karibhou <Karibhou@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
|
|
hive/check-report (head Per-package floor:
Fix: add table-driven cases in Everything else on this head is green, so this is the only thing between the PR and the lane. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
@Karibhou this PR is back in your court ( Failing checks:
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 at 617a03f plus automerge_linked_issue.go and the three lane call sites in automerge_sweep.go. The parsing side (GitHubClosingRefs, ClosingContradictions, the word-boundary fix in issueStaysOpenPhrase) is careful and well tested. One medium finding on where the gates fire, one small body issue, one nit.
Medium β both gates hold PRs whose merge would close nothing, because neither checks that the PR targets the default branch. GitHub acts on closing keywords in a PR body only when the PR targets the repository's default branch, and on keywords in commit messages only when those commits reach the default branch (docs: "If the pull request targets any other branch, then these keywords are ignored, no links are created"). closingKeywordPRGate (src/pkg/github/automerge/automerge_closing_link.go:54-85) and closingContradictionGate (:39-50) take pr but never compare pr.GetBase().GetRef() against the repo's default branch, and the lanes call them unconditionally (automerge_sweep.go:1702, :2294, :2641; automerge_linked_issue.go:96). This repo's default branch is v5; this PR, and most forward-development work, targets v6. Consequences:
- A
v6PR whose commit saysfix #<some PR>is held atclosing-keyword-targets-pr:#Non every sweep until someone rewords a commit β for a close GitHub would never perform. Forward-merge PRs (v5βv6) carry up to 250 upstream commit messages intocommitClosingRefs(:124-162), so one such phrase anywhere in the line parks the whole forward-merge. - Every merge-ready head on a non-default base pays the
ListCommitsread (up to 3 pages) for a hazard that cannot occur there.
Suggested shape: early-return "" from both gates when pr.GetBase().GetRepo().GetDefaultBranch() != "" and differs from pr.GetBase().GetRef() (go-github populates Base.Repo.DefaultBranch on the PR payload), and add a test with a non-default base to each. If you intend the contradiction gate to flag a self-contradictory body regardless of base, say so in its comment β but the PR-target gate's own doc ("would close that PR on merge") is only true on the default branch.
Low β body does not reference the issue. The changelog fragment is fixed-15025-closing-keyword-merge-gates.md and the code comments cite #15025, but the PR body is only the agent footer: no Closes #15025. That is likely why verify PR contents is red, and β fittingly for this PR β it means the issue stays open after merge.
Nit (style) β issueStaysOpenPhrase (src/pkg/github/pr_issue_link.go) calls regexp.MustCompile on every invocation; the contradiction gate now runs it per closed ref per PR per lane per sweep. A small sync.Map/cache keyed by issue, or a single pattern with the number matched as a group and compared, would avoid the recompiles.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@Karibhou the hive has adopted this PR ( |
GitHub acts on closing keywords only when a PR merges into the repository's default branch, so a PR into another base (a forward-merge carrying upstream commit messages) closes nothing; both gates now pass it without a read. issueStaysOpenPhrase compiles its pattern once. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
@Karibhou the hive has adopted this PR ( |
A named baseRef makes trySweepSelfAuthoredPR read the base branch (release hold, protection, rules, compare), which the self-sweep guard fixture does not serve, so TestClosingLinkGatesSkipNonDefaultBase hit the fixture's unexpected-request Fatalf and returned release-hold-check instead of merging. The front now answers those routes the way the contributor-lane fixture does. Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
@Karibhou 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. Your relay session received this as a |
There was a problem hiding this comment.
Delta re-review (67a2d53 β 5135709; intent-alignment). The delta is a test-fixture-only change, no scope creep. It does not yet clear the previous correctness finding.
TestClosingLinkGatesSkipNonDefaultBase still fails at head (CI job 123079416718, test (rest 1/4)): automerge_sweep_guards_test.go:178: unexpected request: GET /repos/acme/widget/branches?per_page=100&protected=true.
Mechanism: with base.ref = "v6" (automerge_closing_link_test.go:282), v6 matches releaseLineBranchRe, so the sweep calls Repositories.ListBranches(... Protected: true) (pkg/github/pullrequest.go:99-102). The new serveBaseBranch (automerge_linked_issue_test.go:58-83) serves branches/<ref>, protection, rules, status and compare, but not the branch list, so the request falls through to the strict guard API and t.Fatalfs. Serving an empty list makes found == "" and the sweep proceeds:
switch r.URL.Path {
case prefix + "branches":
json.NewEncoder(w).Encode([]any{})
case prefix + "branches/" + baseRef:
(Insert the branches case before the branches/<ref> case in serveBaseBranch; the query string is not part of r.URL.Path.) Please confirm on the next CI run that no further base-branch read falls through after this one β I could not run go test here.
β hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
test (rest 1/4) fails on head 5135709 for a fixture gap β serveBaseBranch is one route short. (Same failure on the hive adoption #15079; I left the full write-up there and the identical fix applies here.) The gate code itself reads correct to me; details below.
Why TestClosingLinkGatesSkipNonDefaultBase fails (job for this head: 123079416718)
Log:
automerge_sweep_guards_test.go:178: unexpected request: GET /repos/acme/widget/branches?per_page=100&protected=true
--- FAIL: TestClosingLinkGatesSkipNonDefaultBase
Mechanism:
- The test sets
front.baseRef = "v6"(automerge_closing_link_test.go:282). v6matchesreleaseLineBranchRe = ^v\d+$(src/pkg/github/pullrequest.go:35), so the forward-merge guard callsHeadMergesReleaseLine(pullrequest.go:82), which issuesRepositories.ListBranches(... Protected: true)(pullrequest.go:99-102).serveBaseBranch(automerge_linked_issue_test.go:57-83) servesbranches/<ref>,.../protection/required_status_checks,rules/branches/<ref>,commits/base1/status,compare/<ref>...sha7β but notbranches?protected=true, so the request falls through to the sweep-guards fixture'sdefault: t.Fatalf(automerge_sweep_guards_test.go:178).
The production path tolerates it (the guard logs head-history check failed and keeps the method, pullrequest.go:163-166) β it is only the fixture's Fatalf that fails the test. The coverage and test jobs are downstream of this.
Fix (one case in serveBaseBranch):
case prefix + "branches": // forward-merge guard: HeadMergesReleaseLine lists protected branches
json.NewEncoder(w).Encode([]any{})β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Correctness (delta re-review, head 5135709) β previous finding still present, one route further along.
TestClosingLinkGatesSkipNonDefaultBase still fails on this head (CI test (rest 1/4), job 123079416718: automerge_sweep_guards_test.go:178: unexpected request: GET /repos/acme/widget/branches?per_page=100&protected=true β --- FAIL: TestClosingLinkGatesSkipNonDefaultBase; coverage fails as a consequence).
Mechanism: the new serveBaseBranch (automerge_linked_issue_test.go:58-83) serves branches/v6, protection, rules, status and compare, so the sweep now reaches the merge step. With base v6, hgithub.ResolveForwardMergeMethod (pkg/github/pullrequest.go:161) calls HeadMergesReleaseLine, which lists protected branches (pkg/github/pullrequest.go:99-102) because v6 matches releaseLineBranchRe. That path is not in serveBaseBranch, falls through to the guard API, and newSelfSweepGuardAPI's default arm t.Fatalfs (automerge_sweep_guards_test.go:178). The 502 is swallowed by the guard itself, but the fixture has already failed the test.
Fix β serve the branch list as empty (no other protected vN line, so the squash stands):
case prefix + "rules/branches/" + baseRef:
json.NewEncoder(w).Encode([]any{})
case prefix + "branches":
// A release-line base makes ResolveForwardMergeMethod list protected
// vN branches; none besides the base keeps the squash.
json.NewEncoder(w).Encode([]any{})
(insert after the rules/branches/ case at automerge_linked_issue_test.go:73-74; r.URL.Path excludes the query string, so the bare branches path matches.)
β hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
The remaining red check on this head is one missing fixture route. I wrote up the full chain on the hive's adopted copy, #15079, whose head differs from yours only in this test file; summary here so you can push the fix to your branch too.
TestClosingLinkGatesSkipNonDefaultBase (src/pkg/github/automerge/automerge_closing_link_test.go:275-290) names base v6 and expects a merge. Because v6 matches releaseLineBranchRe (src/pkg/github/pullrequest.go:88-91), the merge path's HeadMergesReleaseLine (pullrequest.go:99-102) sends GET /repos/acme/widget/branches?per_page=100&protected=true. Your serveBaseBranch (automerge_linked_issue_test.go:58-84) serves branches/v6, protection, rules, status and compare β but not the bare branches list β so the request falls through to t.Fatalf("unexpected request: β¦") at automerge_sweep_guards_test.go:178. CI job 123079416718:
automerge_sweep_guards_test.go:178: unexpected request: GET /repos/acme/widget/branches?per_page=100&protected=true
--- FAIL: TestClosingLinkGatesSkipNonDefaultBase
Fix β one case in serveBaseBranch:
case prefix + "branches":
json.NewEncoder(w).Encode([]any{})The gate logic itself (automerge_closing_link.go:45-49, :55-68, :78+) reads correctly to me against #15025. Your fixture is a superset of the one on #15079 (it also serves rules/branches/<base> and compare/<base>...sha7), so whichever of the two branches lands, this version of the fixture plus the route above is the one to keep.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Closing as superseded by #15079, the hive's copy of this PR (re-homed for sign-off attribution). It keeps @Karibhou's original commits and |
Hold merges whose closing keywords would close the wrong thing: a body that both closes an issue and says it stays open (
closing-contradiction:#N), and a closing keyword in the body or a commit message that names another pull request (closing-keyword-targets-pr:#N). Both gates apply only to PRs into the default branch, where GitHub acts on closing keywords.Closes #15025
π Hive Agent:
contributor| SHA:617a03fd1β hive: backend=claude model=claude-opus-5-5 claude=2.1.312 (Claude Code)