Skip to content

πŸ› issue stage labels: take has-open-pr off once no open PR links the issue - #18833

Merged
hivecommons-hive[bot] merged 5 commits into
hivecommons:v6from
Danathar:fix/has-open-pr-clear-when-unlinked
Nov 17, 2026
Merged

hivecommons-hive[bot] merged 5 commits into
hivecommons:v6from
Danathar:fix/has-open-pr-clear-when-unlinked

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

has-open-pr now comes off an issue once no open PR links it.

The open-PR dispatch guard adds the label when it refuses to dispatch an issue because an open PR already links it with Fixes/Closes/Resolves. Nothing ever removed it. After the linking PR merged or closed, the issue kept a label whose description says "An open PR already links this issue … the hive will not dispatch it again". That is false, and it misleads people and the tracker.

The issue stage-label sweep now checks the guard's own open-PR listing for each open issue that wears the label. When the listing succeeds and no open PR links the issue, the sweep removes the label in the same write as the stage, with no comment.

What happened

Two projectbluefin issues, times Eastern:

This isn't specific to those repos. Every hive with the guard on (scanner.skip_issues_with_open_pr, default true) gets a permanent label on every issue the guard ever refused.

Cause

What changed

  • Sweep (issue_stage_labels.go, new settleOpenPRLabelClear):
    • It runs only for an open issue that wears has-open-pr, with the guard on, at a real stage.
    • It calls Client.OpenPRLinkingIssue: the guard's listing, cached per repo per minute, with the same closing-keyword grammar.
    • The label comes off only when that listing succeeds and no open PR links the issue.
    • A failed listing keeps the label (fail closed). With the guard off, the sweep makes no listing and leaves the label alone.
  • Engine (stageengine):
    • The verdict travels as IssueFacts.StaleOpenPRLabel.
    • DeriveIssue adds the label to Decision.Clear, next to the stale needs-triage and approved-direction clears, so it comes off in the stage write.
    • Only the sweep sets the fact, because only the sweep has the listing. Out-of-cycle facts leave the label as they found it.
  • Once per linking PR (stagelabels.Store, the reconciler), modeled on needs-triage (πŸ› [v5] bug: the hive and a repo's own triage tool keep removing and re-adding needs-triage on covered issuesΒ #18387):
    • The reconciler records the removal (OpenPRLabelClearedAt).
    • If the label is back while still no PR links the issue, another writer owns it. The hive yields (OpenPRLabelClearYielded), logs that once, and leaves the label.
    • One difference from πŸ› [v5] bug: the hive and a repo's own triage tool keep removing and re-adding needs-triage on covered issuesΒ #18387: the yield is not permanent. The guard itself legitimately re-adds the label when a new PR links the issue. So when the sweep sees the label beside a live linking PR, it resets both fields (ResetOpenPRLabelClear), and the label can come off once more after that PR goes. That allows at most one removal per linking-PR lifecycle, so it can't loop.
  • Docs:
    • operator-reference/sweeps-and-operations.md and running-at-level-6.md now say when the label comes off.
    • The constant's comment no longer reads as "never removed".
    • A changelog fragment.

Not in this PR

  • When the guard adds the label, and the guard's refusal itself, are unchanged.
  • The label's name, colour and description are unchanged.
  • good first issue / help wanted on the same issues (a separate bug).
  • The webhook PR-claims handler doesn't clear the label when a PR closes. The next stage-label pass handles it, and adding a second writer would need its own once-only bookkeeping.
  • labels-and-control-signals has no has-open-pr row (it only mentions the label in passing), so there was nothing to update there.

Tests

  • issue_stage_labels_open_pr_clear_test.go, through SyncIssueStageLabels with the fake GitHub server, which now answers the open-PR listing:
    • no linking PR: the label is removed once, with no comment and nothing else touched, and the removal is recorded;
    • a Fixes #82 PR still open: kept;
    • the listing fails (502): kept;
    • SetSkipIssuesWithOpenPR(false): kept, with no listing at all;
    • re-added with still no PR: removed once over three passes, yielded, logged once. A linking PR seen again resets the state, and the label comes off once more after that PR closes.
    • TestOpenPRLabelClearAllowed covers the once-only rule on its own.
  • stageengine/derive_issue_open_pr_clear_test.go: the label is in Clear only when marked stale, alongside a stale needs-triage, and never on a closed issue.
  • stagelabels/open_pr_label_clear_test.go: the removal and yield survive a save and reload, and the reset clears both.

Only gofmt -l was run locally (AGENTS.md bans local go test/go build/go vet). CI runs the tests.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…issue

The open-PR guard added has-open-pr when it refused a dispatch and
nothing removed it, so after the linking PR merged or closed the issue
kept claiming an open PR links it (projectbluefin/bluefin-bling#82,
projectbluefin/common#1656). The issue stage-label sweep now asks the
guard's own listing (OpenPRLinkingIssue) for issues wearing the label
and clears it through Decision.Clear in the stage write, only on a
successful listing with no linking PR. Once per linking PR: a re-add
with still no PR is yielded, and a linking PR seen again resets it.

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

github-actions Bot commented Nov 17, 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.

PR Title Relation Files
#18839 πŸ› claim ledger: key claims by the configured repo spelling same files src/pkg/github/open_pr_links.go

@hivecommons-hive
hivecommons-hive Bot merged commit 7ba58ea into hivecommons:v6 Nov 17, 2026
71 of 72 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 `#188336e6d3d5` sha256:98247f8a04927ecaa37a55b694ff3b5322272102f6b1dd0dedcc9cfb71eb6469 β€” download from the dashboard or `hivectl review evidence #18833`.

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