diff --git a/changelog.d/fixed-18900-never-adopt-covered-contributor-pr.md b/changelog.d/fixed-18900-never-adopt-covered-contributor-pr.md
new file mode 100644
index 0000000000..8ed4411385
--- /dev/null
+++ b/changelog.d/fixed-18900-never-adopt-covered-contributor-pr.md
@@ -0,0 +1 @@
+- **The hive no longer adopts a contributor PR when a person's or the hive's own open PR already covers the issue.** On #18866 the hive adopted contributor PR #18870 as #18879 while the owner's #18873 for the same issue was open, and the dashboard then offered "Let hive decide" over two mid-CI PRs. Before adopting, the engine (the `AutoAdoption` executor) and the "Let hive decide" ladder (new rung `covered-by-other-pr`, just before the adopt rung) now look for another open PR on the same base branch that closes the same issue and is an owner's, an `author/human`'s, a collaborator's (not driving a clanker) or the hive's. If there is one the contributor PR is closed as a duplicate of it with a thank-you note that credits the contributor, the head records `covered-by-open-pr`, and the tracker row says why; a write-back gate refusal or failed close leaves it open with adoption still off. The hive's own copy of the PR, another contributor's PR, a PR on another release line and a duplicate the merge queue holds behind this one do not count, so "green first, then earlier-opened" only breaks ties between equal-trust PRs. With only a person's or hive agent's live claim on the issue (no PR yet) the ladder recommends leaving the PR open and names the holder. ([#18900](https://github.com/hivecommons/hive/issues/18900), part of [#18890](https://github.com/hivecommons/hive/issues/18890)).
diff --git a/src/docs/labels-and-control-signals/glossary-and-operations.md b/src/docs/labels-and-control-signals/glossary-and-operations.md
index 7a0ff58037..125e4f8b82 100644
--- a/src/docs/labels-and-control-signals/glossary-and-operations.md
+++ b/src/docs/labels-and-control-signals/glossary-and-operations.md
@@ -16,6 +16,7 @@ The plain-words comment the delegate posts has four lines — **Hive decided** (
| `capability-gap` | the GitHub App lacks a permission; deciding cannot clear it | The blocker is a missing GitHub App permission (for example `workflows`). Approving a direction would only re-apply needs-human, so the park stays until the owner grants the permission or a person applies the change. |
| `ci-ratchet` | a CI hygiene gate, landed as a ratchet | A new CI hygiene gate lands as a ratchet: it records today's baseline and fails only on increases, so existing work is never blocked. |
| `contributor-offline` | the author hasn't been reachable since the nudge | The PR's author (or their clanker or hive) has been offline since the hive nudged them, so the hive takes the work over instead of waiting. The decision itself names which: the author's clanker, a connected hive, or the author. |
+| `covered-by-other-pr` | a person's or the hive's PR already covers the issue; closed as a duplicate, not adopted | Another open PR from a person or from the hive covers the same issue (or a person or the hive holds a live claim on it). Adoption takes over work a contributor abandoned, and this work is not abandoned, so the hive closes the contributor PR as a duplicate with a thank-you note and credit instead of opening a copy beside it. Green first, then earlier-opened only breaks ties between PRs of equal trust. |
| `dedupe` | an older issue already tracks this | An older issue already tracks the same work; one thread keeps it moving. |
| `proposal-approve-evidence` | a proposal backed by an incident or a repeated class; approved | The hive-filed proposal names an incident it would have prevented, or prior instances of the same class fixed one at a time, so its cost is justified and it is approved as proposed. |
| `proposal-not-now` | a hive-filed proposal with no incident or recurrence behind it; declined for now | The proposal shows neither an incident it would have prevented nor a repeated class it would end, so its value is speculative. The hive declines it for now and closes it as not planned; re-propose with evidence. |
diff --git a/src/docs/labels-and-control-signals/stage-labels.md b/src/docs/labels-and-control-signals/stage-labels.md
index 8bd6f1b4a1..ec72fdf17a 100644
--- a/src/docs/labels-and-control-signals/stage-labels.md
+++ b/src/docs/labels-and-control-signals/stage-labels.md
@@ -840,6 +840,25 @@ When a contributor-agent PR goes red the hive does not just relabel it (a human-
(`contributor-offline`, supersede now) only fires for an author who is not
reachable, the same condition. This follows the documented rule that a
contributor who has gone quiet is superseded now (#13975).
+ **A contributor PR another open PR already covers is never adopted**
+ ([#18900](https://github.com/hivecommons/hive/issues/18900), child of
+ #18890: the hive adopted #18870 as #18879 while the owner's #18873 for the
+ same issue was open). Before it adopts, the automatic path (`adoptContributorPR`,
+ the executor behind the `AutoAdoption` clock) and the ladder (rung 5a,
+ `covered-by-other-pr`, just before rung 5) look for another open PR, on the
+ same base branch, that closes an issue this PR closes and is a person's (an
+ owner or `author/human`, or an owner/member/collaborator not driving a
+ clanker) or the hive's. If there is one the contributor PR is closed as a
+ duplicate of it with one thank-you note that credits the contributor, and the
+ head records the block `covered-by-open-pr` (tracker row: "another open PR
+ already covers the issue"); a write-back gate refusal or a failed close
+ leaves the PR open with adoption still off. The hive's own copy of this PR
+ (`Supersedes #N`), a PR on another release line, another contributor's PR and
+ a duplicate the merge queue holds behind this one do not count: "green first,
+ then earlier-opened" only breaks ties between PRs of equal trust. With no
+ competing PR but a live claim by a person or a hive agent on the issue, the
+ ladder recommends leaving the PR open and names the holder, and the engine
+ refuses adoption (`human-claim`, see [maintainer commands](../maintainer-commands.md#claiming-an-issue)).
2. Relay contributors (the author has a contributor profile and a live relay
connection) also receive the diagnosis in their relay session as a
`fix-pr` task with `priority: interrupt`. Presence = a relay heartbeat
diff --git a/src/pkg/claims/claims.go b/src/pkg/claims/claims.go
index 3c4a296ba1..ed7fa1f6ce 100644
--- a/src/pkg/claims/claims.go
+++ b/src/pkg/claims/claims.go
@@ -792,6 +792,12 @@ const ReasonLeaseExpired = "lease expired"
// HumanClaimReason: "human claim: assigned by andy".
const ReasonHumanClaim = "human claim"
+// ReasonHiveClaim prefixes the reason for a live ledger claim by one of the
+// hive's own agents: "hive claim: scanner". Adoption does not open a copy
+// beside work the hive already holds (hivecommons/hive#18900). It is not a
+// HumanClaimReason, so it never triggers the contributor yank.
+const ReasonHiveClaim = "hive claim"
+
const humanClaimBy = " by "
// HumanClaimReason renders the admission/release reason for a person's claim
diff --git a/src/pkg/dashboard/delegated_pr_context.go b/src/pkg/dashboard/delegated_pr_context.go
index 8a7cb737a9..bf238bca3c 100644
--- a/src/pkg/dashboard/delegated_pr_context.go
+++ b/src/pkg/dashboard/delegated_pr_context.go
@@ -9,6 +9,7 @@ import (
"time"
gh "github.com/google/go-github/v72/github"
+ "github.com/hivecommons/hive/pkg/claims"
"github.com/hivecommons/hive/pkg/config"
"github.com/hivecommons/hive/pkg/delegatedecision"
"github.com/hivecommons/hive/pkg/github"
@@ -125,16 +126,61 @@ func (s *Server) gatherDelegatedPRContext(ctx context.Context, repo string, pr *
winner, _ := delegatedTrainDuplicate(s.stageStoreOrShared(), repo, number)
in.Competing = append(in.Competing, delegatedecision.CompetingPR{
Number: number, HiveAuthored: s.deps.GHClient.IsHiveAuthorLogin(other.GetUser().GetLogin()),
- Mergeable: mergeable,
- Current: state != "behind" && state != "unknown" && state != "" && !other.GetDraft(),
- HeldDuplicate: winner == pr.GetNumber(),
+ PersonAuthored: s.delegatedPersonAuthoredCompetitor(other),
+ Mergeable: mergeable,
+ Current: state != "behind" && state != "unknown" && state != "" && !other.GetDraft(),
+ HeldDuplicate: winner == pr.GetNumber(),
})
}
+ in.IssueClaimHolder, in.IssueClaimIssue = s.delegatedIssueClaimHolder(repo, pr)
in.TrainDuplicateOf, in.TrainDuplicateIssue = delegatedTrainDuplicate(s.stageStoreOrShared(), repo, pr.GetNumber())
in.ClaimConflictWith, in.ClaimConflictIssue = delegatedClaimConflict(s.stageStoreOrShared(), repo, pr.GetNumber())
return nil
}
+// delegatedPersonAuthoredCompetitor reports whether a competing PR was
+// pushed by a person: author/human, one of this hive's owners, or an
+// owner/member/collaborator who is not driving a clanker (a contributor
+// relay's PR is a clanker's whoever its login is). The ladder lets only a
+// person's or the hive's competitor cover a contributor PR's issue
+// (hivecommons/hive#18900).
+func (s *Server) delegatedPersonAuthoredCompetitor(other *gh.PullRequest) bool {
+ var labels []string
+ for _, l := range other.Labels {
+ labels = append(labels, l.GetName())
+ }
+ if s.delegatedHumanAuthor(labels) || s.isAuthorizedUserLogin(other.GetUser().GetLogin()) {
+ return true
+ }
+ if s.delegatedClankerAuthor(labels) {
+ return false
+ }
+ switch strings.ToUpper(other.GetAuthorAssociation()) {
+ case "OWNER", "MEMBER", "COLLABORATOR":
+ return true
+ }
+ return false
+}
+
+// delegatedIssueClaimHolder names the person or hive agent holding a live
+// claim in the issue ledger on an issue pr closes, with that issue; "" when
+// none. Contributor and external claims are not a person's or the hive's.
+func (s *Server) delegatedIssueClaimHolder(repo string, pr *gh.PullRequest) (string, int) {
+ l := s.claimsLedger()
+ if l == nil {
+ return "", 0
+ }
+ for _, ref := range github.ParseClaimedIssues(pr.GetTitle()+"\n"+pr.GetBody(), repo) {
+ if ref.Issue <= 0 || (ref.Repo != "" && !strings.EqualFold(ref.Repo, repo)) {
+ continue
+ }
+ if c, ok := l.Lookup(repo, ref.Issue); ok && (c.Kind == claims.KindHuman || c.Kind == claims.KindAgent) {
+ return c.Holder, ref.Issue
+ }
+ }
+ return "", 0
+}
+
// delegatedClaimConflict reads the stage store for the cross-lane
// same-issue hold the merge queue recorded on a PR
// (hivecommons/hive#15810): the other claimant and the shared issue, 0
@@ -205,6 +251,23 @@ func (s *Server) delegatedHumanAuthor(labels []string) bool {
return isHuman
}
+// delegatedClankerAuthor: the labels carry the configured author/clanker
+// label, i.e. a contributor relay drove the PR.
+func (s *Server) delegatedClankerAuthor(labels []string) bool {
+ clanker := authorKindLabelPfx + authorKindClanker
+ if s != nil && s.deps != nil && s.deps.Config != nil {
+ if c := strings.TrimSpace(s.deps.Config.Governor.Labels.Author.Clanker); c != "" {
+ clanker = c
+ }
+ }
+ for _, l := range labels {
+ if strings.EqualFold(strings.TrimSpace(l), clanker) {
+ return true
+ }
+ }
+ return false
+}
+
// isAuthorizedUserLogin: login is one of this hive's dashboard.authorized_users.
func (s *Server) isAuthorizedUserLogin(login string) bool {
login = strings.TrimSpace(strings.TrimPrefix(login, "@"))
diff --git a/src/pkg/dashboard/stage_tracker_adoption.go b/src/pkg/dashboard/stage_tracker_adoption.go
index 64e9e3d652..6a1d232795 100644
--- a/src/pkg/dashboard/stage_tracker_adoption.go
+++ b/src/pkg/dashboard/stage_tracker_adoption.go
@@ -213,6 +213,8 @@ func stageTrackerAdoptionText(author string, a StageTrackerAdoption, now time.Ti
text += " — maintainer-owned: automatic adoption is disabled by maintainer_policy=never"
case a.BlockedBy == stagelabels.AdoptBlockedOperatorAdmission:
text += " — contributor-managed: operator approval recorded for this head; existing review/CI requirements still apply"
+ case a.BlockedBy == stagelabels.AdoptBlockedCoveredByOpenPR:
+ text += " — another open PR (a person's or the hive's) already covers the issue: the hive will not adopt this one"
case a.BlockedBy == stagelabels.AdoptBlockedHumanClaim:
text += " — an owner or maintainer has claimed the issue: the hive will not adopt this PR unless they release the claim"
case a.BlockedBy != "":
diff --git a/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js b/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js
index 7122f06d10..627cc1d950 100644
--- a/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js
+++ b/src/pkg/dashboard/static-src/js/tracker-filter-fetch.js
@@ -98,6 +98,7 @@
"contributor-lane:sentinel-blocked": {"kind": "reason", "plain": "security-sensitive files changed; a maintainer must approve", "detail": "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label."},
"contributor-lane:workflow-path": {"kind": "reason", "plain": "the PR edits .github/workflows; the hive's App lacks the `workflows` permission, so it cannot adopt it", "detail": "The PR changes files under .github/workflows. The hive's GitHub App has no `workflows` permission, so the adoption fence refuses to publish those edits from the hive. Grant the App the `workflows` permission and re-run the decision, or have a person rebase and merge it on GitHub, or close it as superseded."},
"contributor-offline": {"kind": "rule", "plain": "the author hasn't been reachable since the nudge", "detail": "The PR's author (or their clanker or hive) has been offline since the hive nudged them, so the hive takes the work over instead of waiting. The decision itself names which: the author's clanker, a connected hive, or the author."},
+ "covered-by-other-pr": {"kind": "rule", "plain": "a person's or the hive's PR already covers the issue; closed as a duplicate, not adopted", "detail": "Another open PR from a person or from the hive covers the same issue (or a person or the hive holds a live claim on it). Adoption takes over work a contributor abandoned, and this work is not abandoned, so the hive closes the contributor PR as a duplicate with a thank-you note and credit instead of opening a copy beside it. Green first, then earlier-opened only breaks ties between PRs of equal trust."},
"dco": {"kind": "reason", "plain": "a commit is missing its sign-off", "detail": "A commit on the branch is missing its Developer Certificate of Origin sign-off; the author must sign it off."},
"dco-missing": {"kind": "reason", "plain": "a commit is missing its sign-off", "detail": "A commit on the branch is missing its Developer Certificate of Origin sign-off; the author must sign it off."},
"dedupe": {"kind": "rule", "plain": "an older issue already tracks this", "detail": "An older issue already tracks the same work; one thread keeps it moving."},
diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html
index 89dfe137f5..07ee61e01a 100644
--- a/src/pkg/dashboard/static/index.html
+++ b/src/pkg/dashboard/static/index.html
@@ -25014,6 +25014,7 @@
All labels
"contributor-lane:sentinel-blocked": {"kind": "reason", "plain": "security-sensitive files changed; a maintainer must approve", "detail": "Security-sensitive files changed. The hive never merges until a maintainer reviews and removes the sentinel label."},
"contributor-lane:workflow-path": {"kind": "reason", "plain": "the PR edits .github/workflows; the hive's App lacks the `workflows` permission, so it cannot adopt it", "detail": "The PR changes files under .github/workflows. The hive's GitHub App has no `workflows` permission, so the adoption fence refuses to publish those edits from the hive. Grant the App the `workflows` permission and re-run the decision, or have a person rebase and merge it on GitHub, or close it as superseded."},
"contributor-offline": {"kind": "rule", "plain": "the author hasn't been reachable since the nudge", "detail": "The PR's author (or their clanker or hive) has been offline since the hive nudged them, so the hive takes the work over instead of waiting. The decision itself names which: the author's clanker, a connected hive, or the author."},
+ "covered-by-other-pr": {"kind": "rule", "plain": "a person's or the hive's PR already covers the issue; closed as a duplicate, not adopted", "detail": "Another open PR from a person or from the hive covers the same issue (or a person or the hive holds a live claim on it). Adoption takes over work a contributor abandoned, and this work is not abandoned, so the hive closes the contributor PR as a duplicate with a thank-you note and credit instead of opening a copy beside it. Green first, then earlier-opened only breaks ties between PRs of equal trust."},
"dco": {"kind": "reason", "plain": "a commit is missing its sign-off", "detail": "A commit on the branch is missing its Developer Certificate of Origin sign-off; the author must sign it off."},
"dco-missing": {"kind": "reason", "plain": "a commit is missing its sign-off", "detail": "A commit on the branch is missing its Developer Certificate of Origin sign-off; the author must sign it off."},
"dedupe": {"kind": "rule", "plain": "an older issue already tracks this", "detail": "An older issue already tracks the same work; one thread keeps it moving."},
diff --git a/src/pkg/delegatedecision/decision_glossary.go b/src/pkg/delegatedecision/decision_glossary.go
index c907653c6c..71d9fcb920 100644
--- a/src/pkg/delegatedecision/decision_glossary.go
+++ b/src/pkg/delegatedecision/decision_glossary.go
@@ -89,6 +89,8 @@ var glossary = []GlossaryEntry{
// Rules — why the delegate chose what it chose.
{Slug: RuleContributorOffline, Kind: GlossaryRule, Plain: "the author hasn't been reachable since the nudge",
Detail: "The PR's author (or their clanker or hive) has been offline since the hive nudged them, so the hive takes the work over instead of waiting. The decision itself names which: the author's clanker, a connected hive, or the author."},
+ {Slug: RuleCoveredByOtherPR, Kind: GlossaryRule, Plain: "a person's or the hive's PR already covers the issue; closed as a duplicate, not adopted",
+ Detail: "Another open PR from a person or from the hive covers the same issue (or a person or the hive holds a live claim on it). Adoption takes over work a contributor abandoned, and this work is not abandoned, so the hive closes the contributor PR as a duplicate with a thank-you note and credit instead of opening a copy beside it. Green first, then earlier-opened only breaks ties between PRs of equal trust."},
{Slug: RuleAlreadyFixed, Kind: GlossaryRule, Plain: "the issue was already fixed by a merged PR; closed as superseded",
Detail: "The issue this PR fixes is already closed and a merged PR closed it (or a merged PR declares it supersedes this one), so nothing is left to deliver. The hive closes the PR as superseded with a note naming the merging PR; it never adopts it."},
{Slug: RuleMergeableAsIs, Kind: GlossaryRule, Plain: "mergeable and green as it is; handed to the merge queue",
diff --git a/src/pkg/delegatedecision/ladder.go b/src/pkg/delegatedecision/ladder.go
index 72d04c786b..f5a7a1cb43 100644
--- a/src/pkg/delegatedecision/ladder.go
+++ b/src/pkg/delegatedecision/ladder.go
@@ -34,12 +34,17 @@ const (
// (or has picked the rework up), so the PR goes back to them with the
// fix list instead of being adopted.
RuleReturnToContributor = "return-to-contributor"
+ // RuleCoveredByOtherPR: another open PR from a person or the hive (or a
+ // person's or the hive's claim on the issue) already covers the issue,
+ // so the contributor PR is closed as a duplicate with credit, never
+ // adopted (hivecommons/hive#18900).
+ RuleCoveredByOtherPR = "covered-by-other-pr"
// RuleContributorOffline: the last rung — adopt in supersede mode.
RuleContributorOffline = "contributor-offline"
)
// ladderRungs is the evaluation order.
-var ladderRungs = []string{RuleAlreadyFixed, RuleMergeableAsIs, RuleRebaseThenMerge, RuleReturnToContributor, RuleContributorOffline}
+var ladderRungs = []string{RuleAlreadyFixed, RuleMergeableAsIs, RuleRebaseThenMerge, RuleReturnToContributor, RuleCoveredByOtherPR, RuleContributorOffline}
// AuthorTooling says what the PR's author drives: a hive, a clanker (a
// relay), a person pushing by hand, or unknown. It picks the words a
@@ -222,6 +227,15 @@ func decideLadder(in Input, ref string) (Decision, bool) {
}
skip(RuleReturnToContributor, in.OfflineWording())
+ // Rung 5a — covered by another PR or claim. Adoption takes over work a
+ // contributor abandoned; work a person or the hive already has in flight
+ // is not abandoned. "Green first, then earlier-opened" only breaks ties
+ // between equal-trust PRs, so it never lets a contributor copy win over a
+ // person's or the hive's PR (hivecommons/hive#18900).
+ if d, why, ok := decideCoveredByOtherPR(in, ref); ok {
+ return out(d, why)
+ }
+
// Rung 5 — adopt-supersede, the last resort. Reaching it means the
// author is NOT reachable (rung 4 returned the PR otherwise), and for
// an unreachable author a "back in your court" nudge asks for work
@@ -249,6 +263,59 @@ func decideLadder(in Input, ref string) (Decision, bool) {
return Decision{}, false
}
+// coveringCompetitor is the open competing PR that outranks a contributor PR:
+// a person's or the hive's, and not one the merge queue holds as this PR's own
+// duplicate.
+func coveringCompetitor(in Input) (CompetingPR, bool) {
+ for _, other := range in.Competing {
+ if other.HeldDuplicate || other.Number <= 0 {
+ continue
+ }
+ if other.HiveAuthored || other.PersonAuthored {
+ return other, true
+ }
+ }
+ return CompetingPR{}, false
+}
+
+// decideCoveredByOtherPR is rung 5a: with a person's or the hive's open PR
+// covering the same issue the contributor PR is closed as a duplicate of it,
+// with credit; with only a person's or the hive's claim on the issue (no PR
+// yet) it is not adopted and the decision names the holder. A paused repo
+// gets the recommendation instead of a write.
+func decideCoveredByOtherPR(in Input, ref string) (Decision, string, bool) {
+ if other, ok := coveringCompetitor(in); ok {
+ winner := "#" + itoa(other.Number)
+ whose := "a person's"
+ if other.HiveAuthored && !other.PersonAuthored {
+ whose = "the hive's"
+ }
+ text := fmt.Sprintf("superseded by %s with credit: %s PR already covers the same issue, so %s is closed as a duplicate instead of being adopted", winner, whose, ref)
+ rationale := fmt.Sprintf("%s is %s open PR for the same issue; adoption takes over abandoned work and this is not abandoned, so %s closes as a duplicate with credit and a contributor copy never wins over it (hivecommons/hive#18900)", winner, whose, ref)
+ why := "covered by " + whose + " open PR " + winner + "; closed as a duplicate, not adopted"
+ if in.RepoPaused {
+ return recommendOnly(RuleCoveredByOtherPR, rationale+"; the repo is paused, so the hive only recommends", "close "+ref+" as a duplicate of "+winner), why + " (repo paused: recommend only)", true
+ }
+ note := fmt.Sprintf("Thank you for this PR. %s PR %s already covers the same issue and the hive keeps one PR per issue, so it is closing this one as a duplicate instead of adopting it. Your work is credited on the issue.", strings.ToUpper(whose[:1])+whose[1:], winner)
+ return Decision{
+ Verdict: VerdictCloseSuperseded, Rule: RuleCoveredByOtherPR, Text: text,
+ Rationale: rationale,
+ Actions: []Action{{Kind: ActionCloseDuplicate, Target: other.Number, Text: note}},
+ }, why, true
+ }
+ if holder := strings.TrimSpace(in.IssueClaimHolder); holder != "" {
+ issue := "the issue"
+ if in.IssueClaimIssue > 0 {
+ issue = "issue #" + itoa(in.IssueClaimIssue)
+ }
+ why := holder + " holds a claim on " + issue + "; not adopted unless they release it"
+ return recommendOnly(RuleCoveredByOtherPR,
+ fmt.Sprintf("%s holds a live claim on %s, so the hive does not adopt %s over it", holder, issue, ref),
+ fmt.Sprintf("leave %s open: %s has claimed %s; ask them to release the claim, or close %s", ref, holder, issue, ref)), why, true
+ }
+ return Decision{}, "", false
+}
+
// ContributorReachable reports whether the author's clanker or hive is
// connected or has picked the rework up: the condition under which rung 4
// returns the PR to them and rung 5 never fires.
diff --git a/src/pkg/delegatedecision/ladder_covered_test.go b/src/pkg/delegatedecision/ladder_covered_test.go
new file mode 100644
index 0000000000..58da643ee1
--- /dev/null
+++ b/src/pkg/delegatedecision/ladder_covered_test.go
@@ -0,0 +1,107 @@
+package delegatedecision
+
+import (
+ "strings"
+ "testing"
+)
+
+// hivecommons/hive#18900: on #18866 the hive adopted contributor PR #18870 as
+// #18879 while the owner's #18873 for the same issue was open. A person's or
+// the hive's open PR (or claim) on the issue closes the contributor PR as a
+// duplicate with credit; "green first, then earlier-opened" never lets a
+// contributor copy win over it.
+func TestLadderCoveredByOtherPR(t *testing.T) {
+ // The #18870 scenario: an offline contributor clanker, CI red, which rung
+ // 5 would adopt.
+ adoptable := Input{Repo: "hivecommons/hive", Kind: KindPR, Number: 18870, Title: "Fix the hold", Author: "Karibhou",
+ Labels: []string{"author/clanker"}, CIGreen: false, ContributorOnline: false, AuthorTooling: AuthorToolingClanker}
+ if d, ok := decideLadder(adoptable, "#18870"); !ok || d.Verdict != VerdictAdoptSupersede {
+ t.Fatalf("control: the uncovered PR must be adopted, got %+v (ok %v)", d, ok)
+ }
+
+ covered := func(mut func(*Input)) Input { return with(adoptable, mut) }
+ cases := []struct {
+ name string
+ in Input
+ verdict Verdict
+ target int
+ textHas string
+ }{
+ {
+ name: "owner PR open for the issue: closed as a duplicate of it with credit",
+ in: covered(func(i *Input) { i.Competing = []CompetingPR{{Number: 18873, PersonAuthored: true}} }),
+ verdict: VerdictCloseSuperseded, target: 18873, textHas: "superseded by #18873 with credit: a person's PR",
+ },
+ {
+ name: "hive PR open for the issue: closed as a duplicate of it",
+ in: covered(func(i *Input) { i.Competing = []CompetingPR{{Number: 18873, HiveAuthored: true}} }),
+ verdict: VerdictCloseSuperseded, target: 18873, textHas: "the hive's PR already covers",
+ },
+ {
+ name: "a conflicting contributor head still loses to the person's PR it competes with",
+ in: covered(func(i *Input) {
+ i.Competing = []CompetingPR{{Number: 18873, PersonAuthored: true}}
+ i.CIGreen, i.Conflicting = false, true
+ }),
+ verdict: VerdictCloseSuperseded, target: 18873,
+ },
+ {
+ name: "paused repo: recommend only, no write",
+ in: covered(func(i *Input) {
+ i.Competing = []CompetingPR{{Number: 18873, PersonAuthored: true}}
+ i.RepoPaused = true
+ }),
+ verdict: VerdictRecommendOnly, textHas: "close #18870 as a duplicate of #18873",
+ },
+ {
+ name: "a person's claim on the issue and no PR yet: not adopted, the holder is named",
+ in: covered(func(i *Input) { i.IssueClaimHolder, i.IssueClaimIssue = "andy", 18866 }),
+ verdict: VerdictRecommendOnly, textHas: "andy has claimed issue #18866",
+ },
+ }
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ d, ok := decideLadder(tc.in, "#18870")
+ if !ok || d.Rule != RuleCoveredByOtherPR || d.Verdict != tc.verdict {
+ t.Fatalf("decision = %+v (ok %v), want %s / %s", d, ok, RuleCoveredByOtherPR, tc.verdict)
+ }
+ for _, a := range d.Actions {
+ if a.Kind == ActionAdoptSupersede {
+ t.Fatalf("a covered PR must never be adopted: %+v", d.Actions)
+ }
+ }
+ if tc.target > 0 {
+ if len(d.Actions) != 1 || d.Actions[0].Kind != ActionCloseDuplicate || d.Actions[0].Target != tc.target {
+ t.Fatalf("actions = %+v, want one close-duplicate of #%d", d.Actions, tc.target)
+ }
+ if !strings.Contains(d.Actions[0].Text, "Thank you for this PR") || !strings.Contains(d.Actions[0].Text, "credited") {
+ t.Fatalf("the close note must thank and credit the contributor: %q", d.Actions[0].Text)
+ }
+ }
+ if tc.textHas != "" && !strings.Contains(d.Text, tc.textHas) {
+ t.Fatalf("text %q missing %q", d.Text, tc.textHas)
+ }
+ if d.Ladder == nil || d.Ladder.Decision != RuleCoveredByOtherPR {
+ t.Fatalf("ladder note missing: %+v", d.Ladder)
+ }
+ if AdoptsImmediately(tc.in) {
+ t.Fatal("AdoptsImmediately must be false for a covered PR: the nudge side must not promise an adoption")
+ }
+ })
+ }
+
+ // Equal trust is a tie, not cover: another contributor's PR, or the
+ // competitor the merge queue holds as this PR's own duplicate, do not stop
+ // the adoption.
+ for name, comp := range map[string][]CompetingPR{
+ "another contributor's PR": {{Number: 18890}},
+ "a duplicate held behind this one": {{Number: 18891, PersonAuthored: true, HeldDuplicate: true}},
+ } {
+ t.Run("not covered: "+name, func(t *testing.T) {
+ d, ok := decideLadder(covered(func(i *Input) { i.Competing = comp }), "#18870")
+ if !ok || d.Verdict != VerdictAdoptSupersede {
+ t.Fatalf("decision = %+v (ok %v), want adoption to proceed", d, ok)
+ }
+ })
+ }
+}
diff --git a/src/pkg/delegatedecision/policy.go b/src/pkg/delegatedecision/policy.go
index 0fee26304c..887645d359 100644
--- a/src/pkg/delegatedecision/policy.go
+++ b/src/pkg/delegatedecision/policy.go
@@ -193,6 +193,11 @@ type CompetingPR struct {
// train as a duplicate of the item (same `Fixes #N`,
// hivecommons/hive#15395); the item is the PR the queue kept.
HeldDuplicate bool
+ // PersonAuthored: a person pushed it (author/human, or one of this
+ // hive's owners). With HiveAuthored it is the trust that lets the
+ // competitor cover a contributor PR's issue (RuleCoveredByOtherPR,
+ // hivecommons/hive#18900): a contributor copy never beats either.
+ PersonAuthored bool
}
// Input is everything the delegate reads about one parked item.
@@ -250,6 +255,12 @@ type Input struct {
Overlaps []int
// Competing lists the other open PRs for the same work.
Competing []CompetingPR
+ // IssueClaimHolder names a person or hive agent holding a live claim on
+ // an issue this PR closes ("" = none), IssueClaimIssue is that issue:
+ // work a person or the hive already holds is not adopted from a
+ // contributor (hivecommons/hive#18900).
+ IssueClaimHolder string
+ IssueClaimIssue int
// TrainDuplicateOf is the open PR the merge queue kept for the same
// issue when it held this one as a duplicate (0 = not held);
// TrainDuplicateIssue is that issue (hivecommons/hive#15395).
diff --git a/src/pkg/github/automerge/automerge_adoption_covered.go b/src/pkg/github/automerge/automerge_adoption_covered.go
new file mode 100644
index 0000000000..4df545f5d0
--- /dev/null
+++ b/src/pkg/github/automerge/automerge_adoption_covered.go
@@ -0,0 +1,163 @@
+package automerge
+
+import (
+ "context"
+ "fmt"
+ "slices"
+ "strings"
+ "time"
+
+ gh "github.com/google/go-github/v72/github"
+
+ hgithub "github.com/hivecommons/hive/pkg/github"
+ "github.com/hivecommons/hive/pkg/stagelabels"
+ "github.com/hivecommons/hive/pkg/writeback"
+)
+
+// Never adopt a contributor PR another open PR already covers
+// (hivecommons/hive#18900, child of #18890). On #18866 the hive adopted
+// contributor PR #18870 as #18879 while the owner's #18873 for the same issue
+// was already open; the dashboard then offered "Let hive decide" over two
+// mid-CI PRs. Adoption is the hive taking over a contributor's abandoned work,
+// and there is nothing abandoned about work a person (or the hive) already has
+// in flight: "green first, then earlier-opened" breaks ties between equal
+// trust, it never lets a contributor copy win over a person's or the hive's PR.
+
+// AdoptionCoveredMarker opens the one note a covered contributor PR gets when
+// the hive closes it as a duplicate instead of adopting it.
+const AdoptionCoveredMarker = "\n"+
+ "Thank you for this PR. %s PR #%d already covers #%d and the hive keeps one PR per issue, so it is closing this one as a duplicate instead of adopting it. "+
+ "Your work is credited on the issue; if #%d does not land, comment here and a maintainer can reopen this PR.",
+ AdoptionCoveredMarker, nonEmpty(hiveID, "hive"), cover.Number, cover.Issue, obs.HeadSHA,
+ strings.ToUpper(cover.Who[:1])+cover.Who[1:], cover.Number, cover.Issue, cover.Number)
+}
+
+// closeCoveredContributorPR closes the contributor PR as a duplicate of the
+// covering PR, with one thank-you note. Adoption is refused whatever happens
+// here: the block is recorded on the stage record (the tracker row says why)
+// and a write-back gate refusal or a failed close leaves the PR open with
+// adoption still off. It runs once per head: a recorded block is not
+// re-posted. It returns the number of comments posted.
+func (c *Engine) closeCoveredContributorPR(ctx context.Context, store *stagelabels.Store, key string, obs stageObservation, policy StageLabelPolicy, cover coveringPR, now time.Time) (int, error) {
+ rec, _ := store.Get(key)
+ if rec.AdoptionBlocked(obs.HeadSHA) == stagelabels.AdoptBlockedCoveredByOpenPR {
+ return 0, nil
+ }
+ logArgs := []any{"repo", obs.Display, "pr", obs.Number, "author", obs.Author, "head", obs.HeadSHA, "covered_by", cover.Number, "issue", cover.Issue}
+ store.NoteAdoptionBlocked(key, obs.HeadSHA, stagelabels.AdoptBlockedCoveredByOpenPR, now)
+ body := AdoptionCoveredComment(obs, policy.HiveID, cover)
+ if d := c.writebackAllowed(obs.Display, writebackItemForObservation(obs), writeback.KindContributorAdopt, body); !d.Allowed {
+ c.info("stage labels: covered contributor PR not adopted; close suppressed by the write-back gate, left open", append(logArgs, "writeback_reason", d.Reason, "writeback_detail", d.Detail)...)
+ return 0, nil
+ }
+ if _, _, err := c.gh.Issues.CreateComment(ctx, obs.Owner, obs.Repo, obs.Number, &gh.IssueComment{Body: gh.Ptr(body)}); err != nil { // writeback:gated
+ c.warn("stage labels: covered contributor PR note failed; adoption stays off", append(logArgs, "error", err)...)
+ return 0, err
+ }
+ if _, _, err := c.gh.PullRequests.Edit(ctx, obs.Owner, obs.Repo, obs.Number, &gh.PullRequest{State: gh.Ptr("closed")}); err != nil { // writeback:gated
+ c.warn("stage labels: closing the covered contributor PR failed; adoption stays off", append(logArgs, "error", err)...)
+ return 1, err
+ }
+ c.info("stage labels: contributor PR closed as a duplicate of an open PR that covers the issue; not adopted", logArgs...)
+ return 1, nil
+}
diff --git a/src/pkg/github/automerge/automerge_adoption_covered_test.go b/src/pkg/github/automerge/automerge_adoption_covered_test.go
new file mode 100644
index 0000000000..fbe3842fe2
--- /dev/null
+++ b/src/pkg/github/automerge/automerge_adoption_covered_test.go
@@ -0,0 +1,121 @@
+package automerge
+
+import (
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/hivecommons/hive/pkg/stagelabels"
+)
+
+func coveredComments(h *adoptHarness) []string {
+ var out []string
+ for _, c := range h.api.comments {
+ if strings.HasPrefix(c, AdoptionCoveredMarker) {
+ out = append(out, c)
+ }
+ }
+ return out
+}
+
+func openPR(number int, login, association, body string, labels ...string) map[string]any {
+ ls := []map[string]any{}
+ for _, l := range labels {
+ ls = append(ls, map[string]any{"name": l})
+ }
+ return map[string]any{
+ "number": number, "state": "open", "title": "fix", "body": body,
+ "user": map[string]any{"login": login},
+ "author_association": association,
+ "labels": ls,
+ "base": map[string]any{"ref": "v5"},
+ "head": map[string]any{"sha": "other", "ref": "x"},
+ }
+}
+
+// With an owner's PR open for the issue, a contributor PR that is the
+// adoption candidate is closed as a duplicate of it with a thank-you note,
+// not adopted (hivecommons/hive#18900: #18870 was adopted as #18879 while the
+// owner's #18873 was open). Once the owner's PR is gone the same PR is
+// adopted as usual.
+func TestAdoptionClosesCoveredContributorPRInsteadOfAdopting(t *testing.T) {
+ h, done := newAdoptHarness(t, ContributorNudgeOutcome{Mode: "queued"}, adoptPolicy())
+ defer done()
+ start := h.clock.at
+ h.sink.presence = &ContributorPresence{Registered: true, Online: false}
+ h.observe(adoptPR(7, "aaa"), "conflicting")
+ if len(nudgeComments(h.api)) != 1 {
+ t.Fatalf("no nudge: %v", h.api.comments)
+ }
+ labels := []string{"stage/072-returned-to-contributor", "role/contributor", "author/clanker"}
+ key := stageKey("acme", "widget", 7)
+
+ // The owner's PR for the same issue (adoptPR closes #12 and #13).
+ h.adopt.openPRs = []map[string]any{openPR(50, "andy", "OWNER", "Fixes #12")}
+ h.api.reset()
+ h.clock.at = start.Add(31 * time.Minute)
+ res := h.observe(adoptPR(7, "aaa", labels...), "conflicting")
+ if len(h.adopt.pulls) != 0 || len(adoptionComments(h.api)) != 0 {
+ t.Fatalf("adopted a PR another open PR covers: pulls=%v comments=%v", h.adopt.pulls, h.api.comments)
+ }
+ notes := coveredComments(h)
+ if len(notes) != 1 || res.Comments != 1 {
+ t.Fatalf("want one covered note, got %v (res %+v)", h.api.comments, res)
+ }
+ for _, want := range []string{"covered_by=50", "A person's PR #50 already covers #12", "Thank you for this PR", "credited"} {
+ if !strings.Contains(notes[0], want) {
+ t.Fatalf("covered note missing %q:\n%s", want, notes[0])
+ }
+ }
+ if len(h.adopt.prEdits) != 1 || h.adopt.prEdits[0] != "7:closed" {
+ t.Fatalf("contributor PR not closed as a duplicate: %v", h.adopt.prEdits)
+ }
+ rec, _ := h.e.stageStoreOrShared().Get(key)
+ if rec.AdoptionBlocked("aaa") != stagelabels.AdoptBlockedCoveredByOpenPR {
+ t.Fatalf("block not recorded: %+v", rec)
+ }
+
+ // Later passes do not repeat the note or the close.
+ h.api.reset()
+ h.clock.at = start.Add(46 * time.Minute)
+ h.observe(adoptPR(7, "aaa", labels...), "conflicting")
+ if got := coveredComments(h); len(got) != 0 {
+ t.Fatalf("covered note repeated: %v", got)
+ }
+}
+
+// Equal trust is a tie, not cover: another contributor's PR for the issue does
+// not stop the adoption, and neither does the hive's own copy of this PR.
+func TestAdoptionNotBlockedByAnotherContributorsOrItsOwnCopyPR(t *testing.T) {
+ for name, other := range map[string]map[string]any{
+ "another contributor's clanker PR": openPR(51, "someone", "NONE", "Fixes #12", "author/clanker"),
+ "a maintainer's clanker PR": openPR(52, "mallory2", "MEMBER", "Fixes #12", "author/clanker"),
+ "the hive's copy of this PR": openPR(53, "hive-app[bot]", "NONE", "Fixes #12\n\nSupersedes #7"),
+ "an unrelated person's PR": openPR(54, "andy", "OWNER", "Fixes #99"),
+ "a person's PR on another branch": withBase(openPR(55, "andy", "OWNER", "Fixes #12"), "v4"),
+ } {
+ t.Run(name, func(t *testing.T) {
+ h, done := newAdoptHarness(t, ContributorNudgeOutcome{Mode: "queued"}, adoptPolicy())
+ defer done()
+ start := h.clock.at
+ h.sink.presence = &ContributorPresence{Registered: true, Online: false}
+ h.observe(adoptPR(7, "aaa"), "conflicting")
+ labels := []string{"stage/072-returned-to-contributor", "role/contributor", "author/clanker"}
+ h.adopt.openPRs = []map[string]any{other}
+ h.api.reset()
+ h.clock.at = start.Add(31 * time.Minute)
+ h.observe(adoptPR(7, "aaa", labels...), "conflicting")
+ if len(h.adopt.pulls) != 1 {
+ t.Fatalf("adoption blocked by %s: pulls=%v comments=%v", name, h.adopt.pulls, h.api.comments)
+ }
+ if got := coveredComments(h); len(got) != 0 {
+ t.Fatalf("covered note posted for %s: %v", name, got)
+ }
+ })
+ }
+}
+
+func withBase(pr map[string]any, ref string) map[string]any {
+ pr["base"] = map[string]any{"ref": ref}
+ return pr
+}
diff --git a/src/pkg/github/automerge/automerge_contributor_adopt.go b/src/pkg/github/automerge/automerge_contributor_adopt.go
index 84f84bb06f..cda67d358f 100644
--- a/src/pkg/github/automerge/automerge_contributor_adopt.go
+++ b/src/pkg/github/automerge/automerge_contributor_adopt.go
@@ -696,6 +696,11 @@ func (c *Engine) adoptContributorPR(ctx context.Context, store *stagelabels.Stor
c.info("stage labels: operator forced adoption; maintainer policy, admission and presence bypassed", "repo", obs.Display, "pr", obs.Number, "author", obs.Author, "by", forcedBy, "online", presence.Online, "policy", policy.maintainerPolicy())
} else if c.adoptionRefusedByAdmission(ctx, store, key, obs, requested, now) {
return 0, nil
+ } else if cover, covered := c.adoptionCoveringPR(ctx, obs, policy); covered {
+ // Another open PR, a person's or the hive's, covers the issue
+ // (hivecommons/hive#18900): close this one as a duplicate with credit
+ // instead of opening a copy beside it.
+ return c.closeCoveredContributorPR(ctx, store, key, obs, policy, cover, now)
} else if claim := c.adoptionHumanClaim(ctx, obs); claim != "" {
// An owner or maintainer claimed an issue this PR closes
// (hivecommons/hive#18899): the person's claim outranks the
diff --git a/src/pkg/github/automerge/automerge_contributor_adopt_test.go b/src/pkg/github/automerge/automerge_contributor_adopt_test.go
index 7c9683c878..4988c83350 100644
--- a/src/pkg/github/automerge/automerge_contributor_adopt_test.go
+++ b/src/pkg/github/automerge/automerge_contributor_adopt_test.go
@@ -21,10 +21,13 @@ import (
// adoptAPI layers the git-ref / pull-request routes the adoption needs on
// top of stageAPI and records what the hive did.
type adoptAPI struct {
- mu sync.Mutex
- refs map[string]string // refs/heads/x → sha
- refUpdates []string
- pulls []map[string]any
+ mu sync.Mutex
+ refs map[string]string // refs/heads/x → sha
+ refUpdates []string
+ pulls []map[string]any
+ // openPRs is what GET pulls (the open-PR listing the covering-PR check
+ // reads, hivecommons/hive#18900) serves; none by default.
+ openPRs []map[string]any
nextPR int
superseders map[int]map[string]any // number → GET payload
prEdits []string
@@ -105,6 +108,13 @@ func (a *adoptAPI) handle(w http.ResponseWriter, r *http.Request) bool {
defer a.mu.Unlock()
path := r.URL.Path
switch {
+ case r.Method == http.MethodGet && path == "/repos/acme/widget/pulls":
+ out := a.openPRs
+ if out == nil {
+ out = []map[string]any{}
+ }
+ _ = json.NewEncoder(w).Encode(out)
+ return true
case r.Method == http.MethodGet && strings.Contains(path, "/collaborators/") && strings.HasSuffix(path, "/permission"):
a.permissionReads++
if a.onPermission != nil {
diff --git a/src/pkg/github/issue_human_claim.go b/src/pkg/github/issue_human_claim.go
index a2a2a7ab2f..34fafc6fc7 100644
--- a/src/pkg/github/issue_human_claim.go
+++ b/src/pkg/github/issue_human_claim.go
@@ -117,11 +117,16 @@ const humanClaimCacheMax = 512
func (c *Client) readHumanClaim(ctx context.Context, repo string, number int, holder string) (string, error) {
owner, name := c.splitRepo(repo)
- // A person's claim the ledger already holds (dashboard, hivectl) counts
- // for the readers that do not consult the ledger themselves (adoption).
- if claim, ok := c.ledgerClaimFor(owner, name, number, time.Now()); ok && strings.EqualFold(claim.Kind, string(claims.KindHuman)) &&
- !strings.EqualFold(claim.Identity, strings.TrimSpace(holder)) {
- return claims.HumanClaimReason(humanClaimViaLedger, claim.Identity), nil
+ // A claim the ledger already holds by a person (dashboard, hivectl) or by
+ // one of the hive's own agents counts for the readers that do not consult
+ // the ledger themselves (adoption).
+ if claim, ok := c.ledgerClaimFor(owner, name, number, time.Now()); ok && !strings.EqualFold(claim.Identity, strings.TrimSpace(holder)) {
+ switch strings.ToLower(claim.Kind) {
+ case string(claims.KindHuman):
+ return claims.HumanClaimReason(humanClaimViaLedger, claim.Identity), nil
+ case string(claims.KindAgent):
+ return claims.ReasonHiveClaim + ": " + claim.Identity, nil
+ }
}
issue, _, err := c.client.Issues.Get(ctx, owner, name, number)
if err != nil {
diff --git a/src/pkg/github/issue_human_claim_test.go b/src/pkg/github/issue_human_claim_test.go
index d7d874714e..0546d15f9e 100644
--- a/src/pkg/github/issue_human_claim_test.go
+++ b/src/pkg/github/issue_human_claim_test.go
@@ -7,8 +7,10 @@ import (
"net/http/httptest"
"strings"
"testing"
+ "time"
"github.com/hivecommons/hive/pkg/claims"
+ "github.com/hivecommons/hive/pkg/issueclaim"
)
// humanClaimIssue describes the forge state behind IssueHumanClaimReason.
@@ -198,3 +200,36 @@ func TestIssueHumanClaim_VerdictIsCached(t *testing.T) {
t.Fatalf("forge reads = %d, want 1 (cached for %s)", reads, humanClaimCacheTTL)
}
}
+
+// A live ledger claim by a person or by one of the hive's own agents is read
+// without a forge round trip (hivecommons/hive#18900): adoption does not open
+// a copy beside work either already holds. A hive agent's claim is not a
+// human-claim reason, so it never triggers the contributor yank.
+func TestIssueHumanClaim_LedgerClaimsByPersonAndHiveAgent(t *testing.T) {
+ srv := humanClaimServer(t, humanClaimIssue{})
+ defer srv.Close()
+ for kind, want := range map[string]string{
+ "human": claims.HumanClaimReason("claimed in the ledger", "andy"),
+ "agent": claims.ReasonHiveClaim + ": scanner",
+ } {
+ t.Run(kind, func(t *testing.T) {
+ c := issueTestClient(t, srv.URL)
+ identity := "andy"
+ if kind == "agent" {
+ identity = "scanner"
+ }
+ c.SetIssueClaimLedger(func(repo string, number int) (issueclaim.Claim, bool) {
+ return issueclaim.Claim{Identity: identity, Kind: kind, ExpiresAt: time.Now().Add(time.Hour), Source: issueclaim.SourceLease}, true
+ })
+ got, err := c.IssueHumanClaimReason(context.Background(), "o/r", 42, "karibhou")
+ if err != nil || got != want {
+ t.Fatalf("reason = %q, %v; want %q", got, err, want)
+ }
+ if kind == "agent" {
+ if _, human := claims.ParseHumanClaimReason(got); human {
+ t.Fatalf("a hive agent's claim %q must not parse as a human claim", got)
+ }
+ }
+ })
+ }
+}
diff --git a/src/pkg/stagelabels/store.go b/src/pkg/stagelabels/store.go
index 5f1bbd958d..2cba9dc23b 100644
--- a/src/pkg/stagelabels/store.go
+++ b/src/pkg/stagelabels/store.go
@@ -1853,6 +1853,13 @@ const AdoptBlockedSelfAuthored = "self-authored"
// work.
const AdoptBlockedHumanClaim = "human-claim"
+// AdoptBlockedCoveredByOpenPR is the AdoptBlockedBy reason for a contributor
+// PR the hive did not adopt because another open PR (a person's or the
+// hive's) already covers an issue it closes (hivecommons/hive#18900). The
+// hive closes it as a duplicate with a thank-you note; if the close is
+// suppressed or fails the block still keeps the adoption off.
+const AdoptBlockedCoveredByOpenPR = "covered-by-open-pr"
+
// AdoptBlockedSupersedeConflict is the AdoptBlockedBy reason (and the 07x
// lane reason) for a supersession whose head could not be replayed onto a
// fresh base: the hive copy would open conflicting, so the attempt is