Skip to content

πŸ› fix(github): the overlap duplicate guard defers only to hive agents' PRs and tells the blocked issue - #17001

Merged
hivecommons-hive[bot] merged 4 commits into
hivecommons:v6from
Danathar:fix/overlap-guard-skip-dep-bots
Nov 7, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
hivecommons:v6from
Danathar:fix/overlap-guard-skip-dep-bots

Conversation

@Danathar

@Danathar Danathar commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The create-PR duplicate guard treated any [bot] PR as "another agent's PR". On projectbluefin/server a one-line Renovate digest bump (authored by the custom-named mergeraptor[bot] App, editing only Justfile) was contained in an architect refactor's file set, so the hive refused to open the refactor and pointed it at the bump. The overlapping-files check now counts only PRs this hive's agents opened (its App bot plus github.additional_bot_logins). When the guard does refuse a request on overlapping files, the issue the work was for now hears about it, instead of only the blocking PR.

What went wrong

The guard came from #11577, which asked to "list open PRs by the App bot". The [bot] suffix check was wider than that.

What changes

  • Overlap check counts only hive-agent PRs. findOverlappingBotPR keeps a candidate only when its author is one of hiveBotLogins() (case-insensitive), not any login ending in [bot]. A client with no hive bot login (PAT auth, nothing configured) skips this check. Before, such a client only ever matched third-party bots here anyway. The closes-issue and merged-fix checks are unchanged.
  • Why this and not a hunk-overlap rule: an allow-list of "our own agents" is predictable and needs no diff parsing. A dependency-bot deny-list would have missed this exact case, because the bot is mergeraptor[bot], not renovate[bot]. Hunk overlap would still collide whenever a refactor touches the bumped line.
  • The blocked issue is told. On an overlapping-files refusal, the watcher no longer stages the request's issues under the blocking PR (it shares files with them, not issues). It leaves a note on each issue naming the agent, the branch (still on the remote) and the blocking PR. The note goes through the write-back gate (duplicate_fix_notice), becomes a status-card section under the attention pilot, and is never stacked on a retry. A WARN log line records the agent, head, blocking PR and issues.
  • The redirect note on the blocking PR stays. It now only ever lands on another hive agent's PR.

Files

  • src/pkg/github/pr_duplicate_guard.go: author filter; noteDuplicateGuardOnIssues and its note text.
  • src/pkg/github/pr_request_watcher.go: overlapping-files refusals note the issue instead of staging it.
  • src/pkg/github/notification_write_sites.go, src/docs/notifications.md: inventory row for the new write site.
  • src/pkg/writeback/kinds.go: duplicate_fix_notice doc covers the new note.
  • changelog.d/fixed-overlap-guard-hive-agent-prs.md

Tests

  • TestCreatePR_DuplicateGuardOnlyCountsHiveAgentPRs: the fix: restore dashboard overrides and fix agent shellΒ #637 shape with mergeraptor[bot], renovate[bot] and dependabot[bot] opens the PR. The hive's own App, a case variant of it, and a configured additional bot still refuse it. No known hive login opens it.
  • TestPRRequestWatcher_OverlapRefusalNotesTheBlockedIssue: an overlap refusal posts one note on the issue and one redirect on the PR, and stages nothing. A retry stacks nothing. A closes-issue refusal still stages the issue under the closing PR.
  • TestDuplicateGuardIssueNote: note text.
  • The existing guard tests now set the App bot login their hive[bot] candidates stand for.
  • The new tests fail on v6 tip (8325a54) and pass with this change. go test ./pkg/github/ ./pkg/writeback/ and go vet pass, and so do the docs citation and link checks.

Out of scope: the dupsweep "superseded regeneration series" comment on #637, and how the guard behaves when it cannot list PRs.

Refs #11577

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

The create-PR overlapping-files check kept any open PR whose author
ended in [bot]. On projectbluefin/server a one-line Renovate digest bump
by mergeraptor[bot] (Justfile only) was contained in an architect
refactor's file set, so the refactor was refused and pointed at the
bump (server#637, Refs server#638).

The check now counts only PRs authored by hiveBotLogins(): the App bot
plus github.additional_bot_logins. A client with no hive bot login
skips it.

On an overlapping-files refusal the watcher no longer stages the
request's issues under the blocking PR, which shares files with them,
not issues. It leaves a gated note on each issue naming the agent,
branch and blocking PR (a status-card section under the attention
pilot, never stacked on a retry), and logs the refusal at WARN.

Refs hivecommons#11577

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 7, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 7, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Danathar this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • check-failure

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 (4 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

native-queue-policy red here (TypeError: isCosmeticLabelFlip is not a function) is a shared incident affecting every PR based on v6, not this diff: #17003. The step added by #16952 on v5 requires a symbol v6's .github/scripts/native-queue-policy.cjs does not export yet; the forward-merge #16997 brings it over. No action needed on this branch β€” the check will pass on re-run once #17003 closes.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read against the v6 tree and the watcher that consumes the result. Looks correct to me.

What I verified

  • pr_duplicate_guard.go:167 β€” the filter is now isHiveBotLogin(c.hiveBotLogins(), login); client.go:658-673 shows that is the App bot login plus additionalBotLogins, compared case-insensitively. Dependency bots (renovate[bot], dependabot[bot], mergeraptor[bot]) fall out of the candidate set exactly as the body says, and the "closes-issue" and "merged-fix" paths are untouched β€” only the file-overlap heuristic narrows.
  • pr_request_watcher.go:712-726 β€” the split is on DuplicateReasonOverlappingFiles only. That is the right line: a closes-issue duplicate genuinely covers the request's issues, so staging them under it at 040 remains correct; an overlap-only PR does not, and clearInProgressForPR/addressInProgressForPR are skipped for it. Nothing else in handleOnePRRequest keyed off those two calls.
  • noteDuplicateGuardOnIssues goes through WritebackItemForNumber β†’ WritebackAllowed β†’ PostIssueNote with a marker+head idempotence check, so a retried request does not stack notes; the site is registered in notification_write_sites.go and notifications.md. Reusing KindDuplicateFixNotice for the issue-side note is documented in writeback/kinds.go.
  • go build ./pkg/github/ ./pkg/writeback/ passes on the head; the three new tests cover the filter, the watcher's issue note, and the note text.

One behavioural edge, not a defect: a client with no App bot login configured (PAT auth) now skips the overlap check entirely rather than matching any [bot]. The doc comment at :159-163 says so explicitly, and on PAT auth the hive's own PRs would not be [bot]-authored anyway, so the old check was not protecting anything there either.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

…p-bots

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor

The hive's GitHub App lacks actions: write, so it cannot rerun shared ci for head 24ec52b0892f. A repository maintainer with Actions write can re-run failed jobs at https://github.com/hivecommons/hive/actions/runs/42385919876 . Alternatively, the App owner can request Actions read and write for this recovery installation and its owner must accept the update. This is a CI recovery permission block, not a source-code failure or merge approval. Hive retries after its bounded permission cooldown; no alternate credential is selected. Hive will resume automatically once the step is done; this label and note clear themselves.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

hivecommons-hive Bot pushed a commit that referenced this pull request Nov 7, 2026
… CI incident is withdrawn (#17007)

The 072 nudge goes out the moment a contributor PR goes red ("the hive
will not merge it until the head changes"). The scanner's [shared-ci]
incident marker can land minutes later. The stage pass then moved the
PR to 050, but the nudge stayed as posted and the head's nudge count
stayed at 1. Seen on hivecommons/hive #16993, #16995, #17000 and
#17001: nudged for native-queue-policy about ten minutes before they
were deferred to incident #17003.

- When the pass reads a nudged head's red as shared-ci-incident:<n> or
  base-branch-red:<checks>, edit the hive's own nudge comments for that
  head in place to say it was withdrawn, and forget the nudge
  (Store.WithdrawNudge), so a genuine return to 072 is nudged afresh.
- After an incident closes as completed, keep a PR deferred to it until
  the rerun sweep stamps hive-shared-ci-rerun-<n> (at most 30 minutes),
  so the head is not handed back in the gap before the re-run.
- Name the head's red checks in the nudge when the CI gate's reason is
  a bare token such as check-failure (a base with no required checks).

Refs #17003, #12606, #12253


Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: looks correct to me. Verified against the tree, not the body.

  • pkg/github/client.go:609-624 (main) β€” hiveBotLogins returns the App login plus additionalBotLogins, empty for PAT auth; isHiveBotLogin is EqualFold. So the new filter in findOverlappingBotPR does exactly what the seven table cases assert, including the case-insensitive and "no login known β†’ guard never fires" rows. Under PAT auth the old HasSuffix("[bot]") filter could only ever match third-party bots (PAT-authored agent PRs have no [bot] suffix), so the narrowing removes false positives without losing any true positive.
  • pr_request_watcher.go:712-726 β€” the overlap branch now skips clearInProgressForPR/addressInProgressForPR. That is right: the blocking PR shares files, not issues, so staging the issue under it was the bug on projectbluefin/server#638. The issue's in-progress claim is left to its TTL, which is the correct fallback given no PR exists. The closes-issue refusal still takes the old path (the test's second subtest pins this).
  • noteDuplicateGuardOnIssues β€” consults WritebackAllowed before PostIssueNote, dedups on duplicateGuardMarker + `head` so a retried request does not stack comments, and skips n == blocking. prstatus.KeyDuplicateGuard (prstatus.go:150) and the marker (pr_duplicate_guard.go:33) already exist, and the write site is registered in notification_write_sites.go and docs/notifications.md.

One pre-existing thing, not introduced here: the refusal path still records AuditActionAgentPRCreated (pr_request_watcher.go just below the hunk) even though no PR was created β€” it did that for the redirect case before this PR too. Worth a separate look if the audit trail is used to count opened PRs.

No security or scope concerns. I have not approved or changed anything.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit c046394 into hivecommons:v6 Nov 7, 2026
67 of 68 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#17001fc2a33a` sha256:a895d9a4ba46bc61df16c235db82ac9a6422ec29ebffd3c38df10e891b25c375 β€” download from the dashboard or `hivectl review evidence #17001`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at fc2a33a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant