Skip to content

πŸ› fix(dashboard): only link cross-referenced PRs that actually fix the issue - #14974

Merged
hivecommons-hive[bot] merged 6 commits into
v5from
scanner/fix-14966
Oct 28, 2026
Merged

hivecommons-hive[bot] merged 6 commits into
v5from
scanner/fix-14966

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Any same-repo open PR named in a timeline cross-referenced event was reported as the issue's linked PR, so a PR that merely mentioned the issue promoted it to Reviewing. The timeline loop now requires the PR's title/body to carry a closing keyword for the issue, reusing github.FindClosingKeywordReference.

Closes #14966
Closes #14967

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

…e issue

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 28, 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 danathar 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 28, 2026
Generated by changelog-fragment-guard from the PR title (#5675).
Edit the wording freely, or replace this file with the no-changelog
label if the change is not user-visible.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, 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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending β€” sweep will merge when green.


🐝 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 added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think this should land as-is: the new guard filters the one case the timeline path was added for, and leaves the case the PR body describes untouched.

Mechanism (at f87dd1e)

  • src/pkg/dashboard/contribute_prlink.go:146 β€” the Search query repo:X type:pr N runs first and accepts any PR whose title/body contains a bare #N (prReferencesIssue, :280-296). A PR whose body says "see also #N for context" is therefore still promoted to the linked PR by the search path; the new prClosesIssue guard at :183 never sees it.
  • The timeline loop at :182 exists for PRs that reference the issue only in a PR comment or commit (#14859, landed in #14922 β€” see the comment at :174-177). Those PRs have a real title and a body that doesn't name the issue, so prClosesIssue returns false and they are dropped. The net effect is the inverse of the stated intent: body mentions still link, comment-only references (the #14859 scenario) no longer do.
  • The existing fixtures only keep passing because openPR/mergedPR at contribute_prlink_test.go:396-397 have no title/body, which hits the "empty β†’ accept" branch at :268. Real timeline source.issue payloads always carry a title, so that branch is not representative of production.

Mismatch with the body: the body says "a PR that merely mentioned the issue promoted it to Reviewing" is fixed; with the search path unchanged, that is still true for body mentions.

Suggested direction: either apply the closing-keyword requirement in both paths (search at :163 and timeline at :183) and accept that comment-only references stop counting β€” which would re-open the #14859 expectation and should be called out β€” or keep the timeline path as a bare-reference catch (its original purpose) and drop this guard. #14966/#14967 are P3 advisories, so the status quo is also acceptable.

Also blocking: changelog-fragment-guard is red β€” changelog.d/fixed-14966-prlink-cross-reference-mentions.md needs a leading - (changelog.d/README.md:23).

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

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read src/pkg/dashboard/contribute_prlink.go at f87dd1e against v5, plus src/pkg/github/prclaims.go:507 (FindClosingKeywordReference) and the merged #14922 that introduced the timeline path.

This regresses #14859 β€” the bug the timeline path was added to fix. searchLinkedPR already filters the Search results by title/body (prReferencesIssue, L163). The comment above the timeline loop (L174–179) says why the loop exists: "The title/body check above cannot see a PR that names the issue only in a PR comment (#14859)." The new prClosesIssue gate at L183 requires a closing keyword in title or body for every timeline source. A PR that references the issue only in commits and a PR comment β€” exactly #14656 in #14859 β€” has no such text, so it is dropped here too, and the dashboard goes back to saying the issue has no PR.

  • contribute_prlink.go:183 + :267–276 β€” mechanism: FindClosingKeywordReference(title+"\n"+body, …) returns false for a comment-only or commit-only reference; the GetBody()=="" && GetTitle()=="" escape at L268 never fires in production because the timeline cross-referenced source.issue is a full issue object with title and body. Severity: high β€” it reintroduces a human-reported false "no reference" (#14859) in order to fix an info/P3 advisory.
  • The existing timeline cases in contribute_prlink_test.go:396–397 (openPR, mergedPR) have no title/body fields, so they pass only via that escape hatch and don't show the regression. A fixture with a non-closing body plus a comment reference (the #14859 shape) would fail at this head.

On scope: #14966 is a P3 advisory finding filed from reviewing #14922 and says "Fix it in the PR, or leave it … check the finding still applies on the base branch." It did not ask for closing-keyword-only linking. If the goal is to stop mention-only PRs promoting an issue to Reviewing, a filter that preserves #14859 would need evidence the timeline path can see (e.g. keep the PR when any of its commits/comments reference the issue, or apply the keyword gate only when the PR also appears nowhere else), rather than title/body alone.

Recommend not merging as-is.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: CI pending β€” sweep will merge when green.


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

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

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correctness (delta re-review at 2e85793) β€” the delta is changelog-only (changelog.d/fixed-14966-prlink-cross-reference-mentions.md now a - bullet; stray fixed-14974.md removed), so the two prior correctness findings stand unchanged:

  1. Still present β€” src/pkg/dashboard/contribute_prlink.go:183-185 regresses #14859. The timeline loop exists (per the comment at :176-179) to catch a PR that names the issue only in a PR comment. prClosesIssue (:268-274) now requires a Closes/Fixes/Resolves keyword in the PR's title/body; a comment-only reference has none, so it is skipped β€” exactly the #14859 case. The title=="" && body=="" fallback at :269 never fires in production: timeline cross-referenced source.issue is a full issue object and PR titles are required. Concrete fix: only reject when the title/body mentions #N without a closing keyword (the "see also #N" case from #14966); if title/body does not mention the issue at all, the reference must have come from a comment β€” keep it (preserves #14859).

  2. Still present β€” src/pkg/dashboard/contribute_prlink_test.go:396-397 masks the regression. openPR/mergedPR fixtures have no title/body, so the existing timeline cases pass only through the empty-fallback. Add a fixture with a non-empty, non-referencing title/body reaching the issue via timeline only and assert it is still linked.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Deferred to shared-CI incident #14976: the red check here failed on a proxy.golang.org stream reset (INTERNAL_ERROR), the same root cause hitting two sibling PRs today; the check is green on the base tip. No PR-side change needed β€” it gets a fresh run once the incident is addressed or a new commit lands.


🐝 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

… keywords

prClosesIssue rejected any cross-referencing PR whose title/body lacked a
Closes/Fixes/Resolves keyword, which dropped PRs that reference the issue
only from a PR comment β€” the case the timeline read exists for (#14859).
Now a PR whose title/body never names the issue (bare #N, owner/repo#N, or
issue URL) is kept, and the keyword gate applies only when the title/body
does mention it without closing it.

Add a timeline fixture with a populated, non-referencing title/body so the
#14859 path exercises the gate rather than the empty-title/body fallback,
and a prClosesIssue table test covering the mention forms.

Hive-Fix-Attempt: 1/6
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 28, 2026
@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read the tree at 23cd226. The new timeline gate is correct for what it does, and it resolves #14966/#14967 as those issues scoped them (the loop at contribute_prlink.go:182). Two things a maintainer should weigh before merging:

1. The changelog claims more than the diff delivers (docs-currency, medium).
changelog.d/fixed-14966-prlink-cross-reference-mentions.md says "the dashboard no longer marks an issue as Reviewing just because an open pull request mentions it." That is not what happens. searchLinkedPR runs Search.Issues with repo:X type:pr N first (contribute_prlink.go:147-151), and that loop still admits any PR whose title/body contains a bare #N via prReferencesIssue (:161, :312-328) β€” no closing keyword required. A same-repo PR saying "see also #N" is indexed by that search and promoted at :161-168 before the timeline loop at :182 is ever reached. The new prClosesIssue gate only bites when search misses (index lag, or the PR falls outside the prLinkSearchPerPage = 10 window). Either apply the same gate to the search loop, or narrow the changelog line to the timeline path. The tests don't exercise this: every new case in TestSearchLinkedPR_CountsCommitCommentAndTimelineReferences that expects a mention-only PR to be skipped uses search: [].

2. Known residual, low. prMentionsIssue falls through to prReferencesIssue, which only trims trailing punctuation (:322). A body like Follow-up (#13135) tokenises to (#13135, is treated as "does not mention the issue", and is therefore kept by prClosesIssue:273-274 β€” the comment-only fallback. Pre-existing behaviour, so not a regression, but it is the exact "passing mention" shape the fix targets.

Otherwise: FindClosingKeywordReference(text, repo, repo, number) is called with the right repo args (prclaims.go:493-514 compares r[1]-or-default against issueRepo), the digit-boundary check in prMentionsIssue correctly rejects #131350, and pkg/dashboard already imports pkg/github elsewhere (api.go:21) so no new cycle.

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The gate is applied to only one of the two lookup paths, so a mention-only PR is still promoted whenever Search returns it β€” which is the common case.

What I verified in the tree (v5 @ 583fe8d + this diff):

  • src/pkg/dashboard/contribute_prlink.go:146 queries repo:%s type:pr %d. GitHub's search index matches a bare #N in title/body, so a PR whose body says see also #13135 for context is normally a Search hit.
  • The Search loop at :157-171 filters with prReferencesIssue (:264-280), which accepts a bare #N token without any keyword β€” the exact text this PR now rejects on the timeline path.
  • The new prClosesIssue gate is only inserted in the timeline loop (:183-185). The timeline is only reached after Search, and Search's open candidate is kept and returned at :191 regardless of what the timeline loop decides.

Consequence: for the mentionPR shape in your own test (body: "see also #13135 for context"), the real system takes the Search path, prReferencesIssue returns true, and the issue is still reported as Reviewing. The new tests pass only because every mention-only case sets search: '[]', i.e. models a PR the search index does not see. The timeline gate therefore only bites for PRs Search missed (indexing lag, or beyond the prLinkSearchPerPage = 10 window).

Two concrete effects:

  1. changelog.d/fixed-14966-prlink-cross-reference-mentions.md claims "the dashboard no longer marks an issue as Reviewing just because an open pull request mentions it" β€” broader than what the code does.
  2. The same PR is now judged differently by the two paths: accepted via Search, rejected via timeline. Which answer the dashboard shows depends on indexing timing rather than on the PR.

Suggested fix: apply the same gate in the Search loop β€” replace prReferencesIssue(iss, number) at :160 with prReferencesIssue(iss, number) && prClosesIssue(iss, repo, number) (or fold the closing-keyword requirement into prReferencesIssue itself, since both loops want "names the issue as a fix"), and add one table case with search: '[' + mentionPR + ']' expecting no link. Note that #14966/#14967 were scoped to the timeline line (:182), so if the intent is deliberately to leave Search's bare-mention behaviour alone, say so in the PR body and narrow the changelog line.

One lower-priority observation, not blocking: prMentionsIssue relies on prReferencesIssue for the bare form, which splits on whitespace and trims only trailing .,);:. A body like related: (#13135) yields token (#13135, is not recognised as a mention, and so is treated as the comment-only case and accepted by prClosesIssue. Pre-existing tokenisation, but the new gate inherits the hole.

Security, style and import direction (pkg/dashboard β†’ pkg/github, already used in tests, no cycle) look fine.

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed β€” no findings from this perspective.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
Search.Issues indexes bare "#N" mentions, so a PR whose body says
"see also #N" was still returned as the open linked PR via the search
path even though the timeline path required Closes/Fixes/Resolves. Apply
the same closing-keyword gate to search hits (searchHitClosesIssue),
accept "(#N)"/"[#N]" as mentions in prReferencesIssue so a parenthesised
bare mention is not misread as comment-only, refresh the searchLinkedPR
doc comment, and narrow the changelog wording to match.

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>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read src/pkg/dashboard/contribute_prlink.go at 071a132, the FindClosingKeywordReference it now calls (src/pkg/github/prclaims.go:480-514), and the new tests. go build ./pkg/dashboard/ passes; pkg/github does not import dashboard, so no cycle. The change does what #14966 asks and looks correct to me, with one narrow gap worth knowing about:

Low β€” URL-form closing references are no longer linked. claimRefPattern (prclaims.go:480-481) matches only #N and owner/repo#N, but GitHub also honours Fixes https://github.com/o/r/issues/N. For such a PR, prMentionsIssue (contribute_prlink.go:310) returns true via the URL form, so prClosesIssue (:300) falls through to FindClosingKeywordReference, which returns false β†’ the PR is dropped. On v5 any mention linked it, so this is a small regression for URL-style bodies. The test table at contribute_prlink_test.go:106 only covers the URL without a keyword, so the positive URL case is unpinned. Hive-authored bodies use Closes #N, and the same parser governs claims elsewhere, so I'd call this acceptable β€” but it is the one case the issue's "title or body closes the issue" wording would expect to pass. Fix, if wanted, is in claimRefPattern, not here.

Everything else checks out: search hits gated by searchHitClosesIssue (:163), timeline hits by prClosesIssue (:185) with the comment-only path preserved (no title/body mention β†’ keep), and prReferencesIssue's wider punctuation trim (:339) only broadens the mention detector. tide is waiting on approved/lgtm.

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks correct to me, with one low-severity edge a maintainer may want to accept knowingly.

Verified at 071a132. pkg/dashboard already imports pkg/github (src/pkg/dashboard/api.go, agent_last_action.go), so the new import in contribute_prlink.go:11 adds no cycle. github.FindClosingKeywordReference (src/pkg/github/prclaims.go:493-512) matches a closing keyword followed by #N or owner/repo#N, compares the resolved repo case-insensitively to issueRepo, and deliberately ignores "see #N"-style mentions β€” exactly the gate #14966 asks for. The two-tier timeline rule in prClosesIssue (contribute_prlink.go:290-301) is right: a PR whose own title/body never names the issue can only be on the timeline because of a PR comment, which is the #14859 case the timeline read exists for, so keeping it unconditionally preserves that fix while mention-only PRs are dropped. The prMentionsIssue digit-boundary loop (:308-324) correctly keeps #13135 from matching #131350, and the table test pins both directions.

Low β€” URL-form closes are now dropped on the timeline path. FindClosingKeywordReference runs stripClosingFalsePositiveText first (prclaims.go:498, :518-523), which replaces every https://… with a space, so a body like Closes https://github.com/o/r/issues/13135 yields no keyword match. prMentionsIssue does recognise the URL form (:313), so prClosesIssue takes the keyword branch and returns false. Before this PR the timeline path accepted every cross-referencing PR, so such a PR was linked; after it, it is not, even though GitHub itself closes the issue on that syntax. This is consistent with how ParseClaimedIssues already treats URL closes everywhere else in hive, so it is a known limitation rather than a new class of bug β€” but it is a behaviour change on this path, and the changelog line ("counts as the linked PR only when its title or body closes the issue") slightly overstates it. If you want to keep it, a one-line note in the prClosesIssue doc comment would stop the next reader from treating it as a bug; if not, prMentionsIssue could skip the URL form so URL-only bodies fall into the comment-only branch.

I have not approved, merged, or changed anything.

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

@hivecommons-hive hivecommons-hive Bot added stage/080-awaiting-merge-admission CI green, verdict approve, no modifiers; the automerge lane has not admitted it yet stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/080-awaiting-merge-admission CI green, verdict approve, no modifiers; the automerge lane has not admitted it yet labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

stage 080-awaiting-merge-admission β†’ 060-reviewed: required-check-pending:Sign-off survives the squash

@hivecommons-hive
hivecommons-hive Bot merged commit 81b4e02 into v5 Oct 28, 2026
83 of 87 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-14966 branch October 28, 2026 16:33
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#14974071a132` sha256:a7790897ea8c7b69d788d61cff1ce711ee9ed7075def4770e9fa445051cbd0bb β€” download from the dashboard or `hivectl review evidence #14974`.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off 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

0 participants