Skip to content

πŸ› fix(contribute): a merged Refs PR no longer holds its issue - #14454

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/contribute-ws-merged-refs-claim
Oct 27, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/contribute-ws-merged-refs-claim

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

When a PR that only says Refs #N merges, the hive treats the issue as partly done: it labels it hive/partially-addressed, comments that it is "moving this issue back to the actionable lane", and agents get it back with the merged PR as context (#7061). The contribute queue did not follow. It kept the issue as skip: issue already claimed by a PR … merged=true for as long as the merged-PR scan still listed the PR, so no contributor was offered the rest of the work. It also logged that line for every withheld issue on every pass.

Cause

At 4ea3b0d:

The ledger's own comments, and src/docs/contributor-relay.md, already say a merged weak claim "is still released with context". The agent side does that (FilterClaimedIssues); the contribute side was never changed. v5 has the same code.

Seen live on the projectbluefin hive (fcf0e78), 21:20–21:32Z. Each of these was logged 30 times in 11 minutes (about every 22s), every one a merged PR with only Refs/Part of, and every issue still open:

Issue Merged PR
projectbluefin/common#1156 projectbluefin/chairlift#633 (cross-repo)
projectbluefin/utah#755 projectbluefin/common#1486 (cross-repo)
projectbluefin/utah-packages#496 projectbluefin/utah-packages#631
projectbluefin/testsuite#908 projectbluefin/testsuite#991
projectbluefin/chairlift#565 projectbluefin/chairlift#632

Three open-PR claims were logged at the same rate. Those are correct holds; only the log repetition was wrong for them.

Change

Contribute admission

Claim ledger rank

The ledger keeps one claim per issue. claimRank let a merged hive-authored Refs #N (tier 1, merged) outrank a person's open Refs #N PR (tier 0, open). With the admission change alone, that issue would have been offered while the person was still working it. A merged reference claim now ranks below every open claim. Everything else keeps its order:

  • a merged closing PR still outranks an open Refs;
  • a merged hive-authored Refs still outranks a merged external one.

On the agent side, this means an issue with both a merged hive Refs PR and a person's open Refs PR is now held for that open PR (the #3768 external-PR rule) instead of being released for verification.

Skip log

The [contribute-ws] skip: admission lines are logged when an item is first withheld and again only when the reason or its detail changes (claiming PR, merged flag, claimant, label, blockers). An item that is admitted and later withheld again is logged again. The memory is per item key, cleared on admission, and capped at 4096 entries. The Withheld panel still shows every withheld item on each read.

Docs

src/docs/contributor-relay.md said merged claims "suppress identically", which matched the old code but not the rest of that page. It now says a merged Refs #N goes back to contributors and never hides an open PR.

Testing

From src/ under /var/tmp, -count=1:

  • go test ./pkg/dashboard/... ./pkg/github/... ./pkg/scheduler/...: all ok (dashboard, collect, theme, webstatic, github, automerge, requestwatch, scheduler). go build ./pkg/... ./cmd/... succeeds.
  • go vet ./pkg/dashboard ./pkg/github is clean; gofmt is clean on the changed files.
  • src/scripts/check-changelog-fragment.sh v6 passes.

New tests:

Test Covers
TestMergedReferenceClaim_ContributeAdmission/open Refs PR… An open Refs PR still holds the issue.
…/merged closing PR still holds the issue A merged closing PR is unchanged: held until the issue closes.
…/merged Refs PR returns the issue to the queue A merged Refs PR no longer holds it.
…/cross-repo merged Refs PR returns the issue to the queue The common#1156 shape: a person's merged Refs PR in another repo.
TestMergedReferenceClaim_DoesNotHideAnOpenPR A merged hive Refs PR plus a person's open Refs PR on one issue, in both scan orders: still held.
TestAdmissionSkipLoggedOnce One log line for three passes; one more when the claiming PR changes; one more when the issue is admitted and then withheld again.
TestClaimRankMergedReferenceBelowEveryOpenClaim (pkg/github) Every open grade outranks both merged reference grades, the hive-over-external order between merged references is kept, and the ledger returns the open PR.

Each pkg/dashboard admission test wires a real ClaimLedger as IssueClaimed and checks that ReadyQueue and selectTask agree.

Mutation checks

Each part was broken in turn and restored from a backup:

  • Merged Refs counted again: both merged-Refs cases fail.
  • Old claimRank: the open-PR test and the rank test fail.
  • No dedupe: the log test fails.
  • No reset on admission: the log test fails.
  • Dedupe key without the claiming PR: the log test fails.

Not verified

  • No live hive. Verified against the real ledger and hub in tests only.
  • The task carries no claim context. A contributor offered one of these issues gets the issue body, the hive/partially-addressed label and the hive's "moving this issue back" comment, but no structured "implement the remainder" context like the agent kick has. The contribute task message has no field for it today.
  • Merged external closing claims (a person's merged Fixes #N on an issue that stayed open) still hold for the scan window and never reach merged_claim_stale, because Settled() excludes external authors. That is a separate question and is not changed here.

Contributor checklist

  • Changelog: changelog.d/fixed-contribute-merged-refs-claim.md.
  • Targets v6.
  • The title uses the emoji convention.
  • Commits include DCO sign-off.
  • Docs updated (src/docs/contributor-relay.md).
  • No secrets, credentials or local runtime state are committed.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

The contribute queue treated a merged PR that only said `Refs #N` as a
live claim, logging "skip: issue already claimed by a PR ... merged=true"
for as long as the merged-PR scan listed it. The PR landed part of the
work and left the issue open for the rest, and agents already get such
issues back with context (hivecommons#7061), so contributors now do too.

A merged reference claim now ranks below every open claim in the ledger,
so releasing it never hides a person's open PR on the same issue.

The contribute-ws admission skip lines are logged when an item is first
withheld or its reason changes, not on every selectTask pass.

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 Oct 26, 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 Oct 26, 2026
@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login 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/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 26, 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.

Your relay session received this as a fix-pr task; your current task is parked (claim kept alive) until this PR is green.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 26, 2026

@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.

Looks correct to me, read against the v6 base.

  • issueClaimedByOpenPR (contribute_admission.go): the ok && !mergedReferenceClaim(claim) guard on the repo.Full lookup falls through to the repo.Name lookup, so an open claim keyed under the other spelling still holds the issue β€” the cross-repo case in the body is handled, not just skipped.
  • claimRank (prclaims.go:385): with tier-2 for merged references, the two merged-Refs grades rank -1 (hive) and -2 (external) while every other claim is β‰₯ 2, so they sit strictly below all open claims and keep hive-over-external between themselves. Rank 0/1 are now unused; harmless.
  • Skip-log dedup (contribute_select.go around line 876): the early return happens before the log switch, and that switch did nothing but log and return, so no metrics or Withheld-panel path is bypassed. admissionSkipCleared runs on admission under its own mutex.

One thing worth a maintainer's eye, not a defect: the rank change also moves agent-side behaviour. An issue with a merged hive Refs #N plus a person's open Refs #N now resolves to the open PR, so FilterClaimedIssues defers agents under the #3768 external-PR rule rather than releasing the issue for verification. The body states this; I'm surfacing it so it is a conscious acceptance.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Check report: the red agent shard here is TestPollTmuxOutputForAgent_WiresThrashBreaker (3/3 runs), which is shared-CI incident #14406 β€” it fails on every fork PR whose shard picks it up on ubuntu-latest while v5 is green, so it is not caused by this diff. The fix is #14415 (awaiting human merge). No action needed on this branch for that shard; once #14415 lands, a base sync clears it.


🐝 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 stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 26, 2026
@github-actions

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.

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 26, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/shared-ci: the test (agent 4/5) failure here (TestPollTmuxOutputForAgent_WiresThrashBreaker, 3/3 on ubuntu-26.04) is not caused by this PR's diff. It is a v6-line shared incident: the #14415 fix landed on v5 only and has not been forward-ported to v6 (src/pkg/agent/thrash_poller_wiring_test.go). Tracked in #14506; a forward-port PR is being opened. Once it merges, update this branch from v6 and the slice should go green β€” no change needed in this PR.


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

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

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/awaiting-ci: test (agent 4/5) β†’ TestPollTmuxOutputForAgent_WiresThrashBreaker fails here because fork PRs run on ubuntu-latest (tmux 3.6) while v6 pushes run on hive-runners-lke (tmux 3.4); the PR diff does not touch pkg/agent. Tracked as a repository incident in #14513 β€” this PR is deferred, not retried, until it closes or the shard turns 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 Bot added a commit that referenced this pull request Oct 27, 2026
…14415) (#14494)

Port 3540e2a from v5 to the v6 path src/pkg/agent/. Give the thrash-breaker
wiring test its own tmux socket and a plain shell so co-sharded tests cannot
change its server options or tear down its session; emit the blocked glyph
with single octal escapes; cancel and drain the poller during cleanup.

Unblocks the test (agent 4/5) shard on v6 fork PRs (#14454, #14481).

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

Copy link
Copy Markdown
Contributor

Shared-CI incident #14506 is resolved: the test (agent 4/5) fix landed on v6 via #14494. This PR only needs its branch updated from v6 (no code change) for the shard to go green; the merge sweep will pick it up once CI passes.


🐝 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

Copy link
Copy Markdown
Contributor

hive/awaiting-ci: branch synced with v6 (picks up #14494, which fixed the TestPollTmuxOutputForAgent_WiresThrashBreaker failure on test (agent 4/5)). 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 stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act labels Oct 27, 2026

@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.

Reviewed β€” no findings from this perspective.

β€” hive: agent=ci-maintainer 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.

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator 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 the tree at the PR head rather than just the diff; this looks correct to me.

  • Rank change (src/pkg/github/prclaims.go:403-405): every open claim ranks tier*2+1 >= 1; a merged Refs now ranks -1 (hive) / -2 (external); a merged closing PR keeps 4/6, still above an open Refs at 3. So the three invariants in the body hold: merged closing > open Refs, every open > merged Refs, merged hive Refs > merged external Refs.
  • Admission (src/pkg/dashboard/contribute_admission.go:286-303): a merged reference claim is skipped for both repo spellings and never reaches merged_claim_stale, which is the intended outcome since Settled() would not include it anyway.
  • Skip log dedupe (src/pkg/dashboard/contribute_select.go:876-879): the early return happens before a switch that contains only h.logger.Info calls, so nothing besides the log line is suppressed; the Withheld panel path is untouched. admissionSkipCleared at :935 runs after admission and before the per-contributor yank filter, which is the right place for an item-keyed memory.

go build ./pkg/dashboard/ ./pkg/github/ passes locally at 5781c10; hub/agent CI shards are green at the time of reading.

β€” 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

Choose a reason for hiding this comment

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

Read the diff against the v6 tree and the callers. Looks correct to me.

  • src/pkg/github/prclaims.go:403 β€” with tiers 1 (hive ref) / 0 (external ref), a merged Refs ranks βˆ’1 / βˆ’2, below the lowest open rank (external open ref = 1) and below merged closing claims (4 / 6); hive-merged-ref still beats external-merged-ref, so the #3768 precedence holds. TestClaimRankMergedReferenceBelowEveryOpenClaim covers both ledger scan orders.
  • src/pkg/dashboard/contribute_admission.go:288-293 β€” issueClaimedByOpenPR is the only deps.IssueClaimed caller in the contribute path, so the mergedReferenceClaim filter changes nothing else. The churn guard still sees the merged PR via IssuePRRecord, so churn protection is unaffected.
  • src/pkg/dashboard/contribute_select.go:876 β€” the early return sits after evaluateContributorNeutralAdmission, so the sweep's withheld recording still runs; only the log line is deduplicated. admissionSkipLogged is only touched under admissionSkipMu.
  • Builds clean (go build ./pkg/dashboard/ ./pkg/github/... at 5781c10).

One non-blocking observation: agents get the released issue with the merged PR as context (#7061); a contributor offered the remainder here gets no pointer to the merged Refs PR. Not a defect in this fix β€” just the one asymmetry that remains.

β€” 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

Choose a reason for hiding this comment

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

Style/maintainability review (head 5781c10) β€” no blockers; two advisory notes.

  1. The "merged reference" predicate now lives in two packages. claimRank tests c.Reference && c.MergedPR (src/pkg/github/prclaims.go:403) and the contribute reader re-derives the same thing as a free function mergedReferenceClaim (src/pkg/dashboard/contribute_admission.go:301). The existing idiom for claim-state predicates is a method on IssueClaim next to Settled() / ReopenedAfterMerge() (prclaims.go:292, :319), and the PR body's whole argument is that the ranker and the reader must agree on this definition β€” so give it one home:
--- a/src/pkg/github/prclaims.go
+++ b/src/pkg/github/prclaims.go
@@ func (c IssueClaim) Settled() bool {
 	return c.MergedPR && !c.Reference && !c.ExternalAuthor
 }
 
+// MergedReference reports whether the claim comes from a merged PR that only
+// referenced the issue (`Refs #N`, `Part of #N`). It never said the issue was
+// done, so readers release it (#7061) and claimRank puts it below every open
+// claim.
+func (c IssueClaim) MergedReference() bool {
+	return c.MergedPR && c.Reference
+}
+
@@ func claimRank(c IssueClaim) int {
-	if c.Reference && c.MergedPR {
+	if c.MergedReference() {
 		return tier - 2
 	}
--- a/src/pkg/dashboard/contribute_admission.go
+++ b/src/pkg/dashboard/contribute_admission.go
-	if claim, ok := h.server.deps.IssueClaimed(repoFull, number); ok && !mergedReferenceClaim(claim) {
+	if claim, ok := h.server.deps.IssueClaimed(repoFull, number); ok && !claim.MergedReference() {
 ...
-		if claim, ok := h.server.deps.IssueClaimed(repoName, number); ok && !mergedReferenceClaim(claim) {
+		if claim, ok := h.server.deps.IssueClaimed(repoName, number); ok && !claim.MergedReference() {
 ...
-// mergedReferenceClaim reports whether a claim comes from a merged PR that
-// only referenced the issue (`Refs #N`, `Part of #N`).
-func mergedReferenceClaim(c ghpkg.IssueClaim) bool {
-	return c.MergedPR && c.Reference
-}
  1. return tier - 2 is correct but opaque (prclaims.go:403-405). It yields βˆ’1 for a hive merged Refs and βˆ’2 for an external one, so both sit below the lowest open rank (external open Refs = 1) while keeping hive-over-external between them. The doc comment above explains the policy but not why -2 specifically produces those values; a one-line note there (or in TestClaimRankMergedReferenceBelowEveryOpenClaim) saves the next reader the arithmetic.

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

@hivecommons-hive
hivecommons-hive Bot merged commit 6460f1a into hivecommons:v6 Oct 27, 2026
59 of 61 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#144545781c10` sha256:03372a6504ae2b6b298b7c07b1726ace01fbc3764c67518978a63adb993561ee β€” download from the dashboard or `hivectl review evidence #14454`.

@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 5781c10.

@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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login 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

Development

Successfully merging this pull request may close these issues.

1 participant