Repository navigation
Description
Target: v6.
Target branch:
v6only. Open the PR with--base v6.hive-open-prdefaults to the repo's default branch (v5) when--baseis omitted.
Citations:path:lineagainstv6@7f89f9d01, paths relative tosrc/.
A PR can merge when the merge would close something the PR does not mean to close: an issue its own body says stays open, or another PR named in a commit message.
What happened
Both cases are from projectbluefin/testsuite on 2026-10-28.
1. A body that says an issue stays open and also closes it. #1057 has "Refs #1023 — partial … remain open" on line 15 and a bare "Closes #1023" on line 33. Its closingIssuesReferences is [1023]. A maintainer comment on #1023 (16:09Z) lists three items explicitly left for later. GitHub closes #1023 when #1057 merges.
- The hive's own partial handling cannot help:
partialForDirectClose(pkg/github/close_on_merge.go:740-748) honoursRefsonly when there is no closing keyword, and no hive path reopens an issue that GitHub closed. - The reviewer flagged the contradiction as a medium intent-alignment finding, which is below
review.severity.block_at, so nothing gated on it. fix: data races in classify and tokens packages #1051 had the same shape until its author edited it. - In these two PRs the
Closesline was appended by the contributor wrapper's auto-close step. A wrapper PR tov6stops that append when the body says the issue stays open: 🐛 fix(gh-wrapper): stop posting empty, blanked and @path bodies for agents #15024. A person or an agent can still write both lines by hand, so the merge itself needs a gate.
2. A commit message that closes another PR. PR #1054's single commit (0636aabff) says "Apply the same fix #1036 makes for Files/apps". On the default branch, GitHub treats "fix #N" as a closing keyword. The hive squash-merged #1054 at 16:07:00Z, and GitHub closed the open PR #1036 at 16:07:02Z with no comment. The timeline closed event carries commit_id 0636aabff and the actor hivecommons-hive[bot], because the App did the merge.
- fix: org/repo/timestamp in hive.yaml download filename #1054's body was empty and its
closingIssuesReferenceswas[], so nothing the hive reads saw it coming. mergeOptions(pkg/github/automerge/automerge_merge_credit.go:22-35) passes""(GitHub's default squash message, which for one commit is that commit's message) unless merge credit rewrites it.- feat: event-driven watcher via pub-sub-tmux #1036 was approved and was a separate change on disjoint files. Its relay re-did the same change as feat: YAML upload/drop + auto-fetch on convert to hosted #1056.
Fix
A. Contradiction gate (all lanes, early).
-
Detector: add a pure function next to
bodySaysIssueStaysOpen(pkg/github/pr_issue_link.go:363), e.g.ClosingContradictions(body, repo string) []int. It returns each same-repo issue N that the body both closes (FindClosingKeywordReference,pkg/github/prclaims.go:507) and says stays open or is partial. "Stays open or partial" means a phrasebodySaysIssueStaysOpenalready recognises, or aRefs/References/Part of … #Nline that also says partial, remaining, deferred, follow-up or not (yet) addressed.- Not a contradiction: a bare
Refs #Nnext toCloses #N, such asRefs #N (reporter confirmation required). The 🐛 github: keep closing keywords on Hive/ClankeR fix PRs #10826 maintainer decision allows it. - Ignore text in code spans (
stripClosingFalsePositiveText).
- Not a contradiction: a bare
-
Gate: add an Engine helper with no API cost, returning reason
closing-contradiction:#N, with the constant inpkg/stageengine/prstage/reasons.go. Call it early in each lane so the PR never reaches 090/095:- contributor lane after
contributorLaneConflictReason(automerge_contributor_lane.go:1199), before admission; - the self-authored, trusted-author and queued lanes at their first label and exempt checks in
automerge_sweep.go.
The existing
linkedIssueGate(automerge_linked_issue.go:67) is too late for this: it runs only for a head that would otherwise merge, after the soak. - contributor lane after
-
Routing: add the reason to
stageFixingReasons(pkg/stageengine/derive_pr_classify.go:304), giving 070 for a hive PR, 072 for a relay and 071 for a human. -
Nudge: add a
nudgeDiagnosiscase (automerge_contributor_nudge.go:90) with this ask: "The body says #N stays open (Refs … partial) and alsoCloses #N, so GitHub would close #N on merge. Keep one: drop the closing keyword, or the partial note. No new commit is needed." Make the nudge's "will not merge it until the head changes" sentence depend on the reason, because here a body edit clears it.
B. Closing keywords that target a PR (merge-ready head).
- Detector: before the hive merges with squash or merge, find every closing keyword in the PR body and in each commit message on the head. Reuse the commit list
MergeCreditor.Preparealready reads where possible (pkg/github/merge_credit.go:187). - Gate: for each target
#Nin the same repo that is a pull request, hold the merge with reasonclosing-keyword-targets-pr:#N. The number is known for a closing claim; useIssues.GetandIsPullRequest(), at most one call per number per head, cached. Route it like A, with an ask to reword the commit ("fix #1036closes PR feat: event-driven watcher via pub-sub-tmux #1036 on merge; writesame change as #1036instead"). A PR is never the intended target of a closing keyword. - Placement: this one can sit with
linkedIssueGate, since it only matters for a head that is about to merge.
Acceptance criteria
- A PR whose body both closes #N and says #N stays open or is partial cannot reach 090, 095 or a merge until the body is fixed. Editing the body (no new commit) releases it.
- A body with only
Refs #N, onlyCloses #N, orCloses #Nplus a bareRefs #N (reporter confirmation required)is unaffected. - A merge-ready PR whose body or commit message has a closing keyword targeting an open or closed PR in the same repo is not merged. It is returned to its author with the ask, and the PR is not closed.
- Closing keywords that target issues behave as today.
Test plan
- Detector table tests in
pkg/github/pr_issue_link_test.go: the real fix: auto-attach tmux so user sees CLI session + auth check #1057 and fix: data races in classify and tokens packages #1051 bodies, Refs-only, Closes-only, the reporter-confirmation pair, aRefsmention inside a code span, and a cross-repoCloses other/repo#N(not this repo). - Lane tests:
automerge_contributor_lane_test.go, and the self-authored, trusted and queued sweep tests: a contradiction PR stays at 072/070/071 with the reason and does not merge, and a fixed body clears it on the next pass. - B: a merge-ready PR whose commit message says "fix feat: event-driven watcher via pub-sub-tmux #1036", where feat: event-driven watcher via pub-sub-tmux #1036 is a PR (mock
Issues.Getreturnspull_request), is not merged. With feat: event-driven watcher via pub-sub-tmux #1036 an issue, it merges. - Routing:
pkg/stageengine/derive_pr_classify_test.goandautomerge_contributor_nudge_test.gocover the new reasons and the nudge text. - Docs:
src/docs/labels-and-control-signals.md: the two new reasons in the PR stage-reason table (~line 472), and thehive/partially-addressedrow (~line 112), which describes how aRefs-only PR leaves its issue open.
Out of scope
- Making the reviewer's intent-alignment finding blocking by class. Severity routing is per severity only (
review_backlog_routing.go:362-388), and findings carry no class, so the deterministic gate above is the cheaper fix. - Rewriting the squash commit message.
- Reopening issues GitHub has already closed.
Activity
hivecommons-hive commentedon Oct 28, 2026
🔒 Claimed by @Karibhou (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply
/unclaimto release, or/claimto take it over if you outrank the holder.hivecommons-hive commentedon Oct 28, 2026
🔓 Claim by @Karibhou released (lease revoked).
hivecommons-hive commentedon Oct 28, 2026
PR #15035 covers this issue: #15035
GitHub only shows its linked-PR icon for closing-keyword PRs that target the repository default branch; this PR targets
v6, so Hive cannot make GitHub display that icon for this issue.🐛 fix(automerge): hold merges whose closing keywords would close the …
hivecommons-hive commentedon Oct 28, 2026
Fixed by #15079 (merged 08e2b44). Closing. Reply /reopen if the problem persists.
github-actions commentedon Oct 28, 2026
Closed by #15079 (merged to
v6).github-actions commentedon Oct 28, 2026
@Danathar this issue was closed by @hivecommons-hive[bot] as completed.
If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it — check your running version against the fix before concluding the fix failed.
If you are still seeing the problem, comment
/reopenand it will be reopened for you — you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.