Skip to content

✨ feat(contribute): record the blocker a relay's blocked verdict names - #15029

Closed
Karibhou wants to merge 1 commit into
hivecommons:v6from
Karibhou:feat/relay-blocked-blocker-15023
Closed

Karibhou wants to merge 1 commit into
hivecommons:v6from
Karibhou:feat/relay-blocked-blocker-15023

Conversation

@Karibhou

Copy link
Copy Markdown
Contributor

Closes #15023

What

When a contributor relay reports blocked and the verdict's reason names its blocker, the hub now records that blocker on the task issue in a form the hive already lifts on close. Before this, the only way off a relay-applied blocked was a human, and each new agent re-discovered the same dependency.

  • Parser (pkg/github/verdict_blocker.go, ParseVerdictBlocker): takes the first of owner/repo#N, #N (resolved against the task's repo) or a GitHub issue/PR URL. A reference to the task issue itself is skipped, so "fix: PEM YAML escaping, provisioning hives in table, admin flicker #975 is blocked on server#450" gives server#450. A reference glued to a word, a path or an HTML entity (') is ignored.
  • Recorder (Client.RecordVerdictBlocker): makes one Issues.Get call on the blocker, then:
    • open issue: calls AddBlockedBy(task, blocker.GetID()), unless fetchBlockedBy already lists it. ReconcileHiveHardSuppress then lifts blocked when the blocker closes.
    • open PR: posts the existing BlockedOnMarker comment, unless it is already there. The blocked sweep lifts it on merge or close.
    • closed, or the read fails: writes nothing and logs it. The block stays human-lifted, as before.
  • Hub (pkg/dashboard/contribute_verdict_blocker.go): runs after the tooling reclassification in contribute_ws.go, only when the verdict is still blocked, on a detached goroutine like releaseToolingBlockedIssue. It skips the same tasks the tooling path skips (not an issue, or ExternalID set), and an in-memory key per task + blocker drops re-delivered verdicts. If the write fails, the key is removed so a later re-delivery can try again.
  • Docs row for blocked in labels-and-control-signals.md and a changelog fragment.

Optional item 5 (reading recheck-after from comments) is not included. It changes the sweep, so it is better as its own PR.

Tests

  • TestParseVerdictBlocker: table covering qualified, bare, issue URL, PR URL, plain text with no reference, two references (the first wins), self-references, HTML entity, and a comment anchor.
  • TestRecordVerdictBlocker_* (fake GitHub):
    • an open issue → AddBlockedBy called once with the blocker's database id;
    • an open PR → the marker comment is posted once, and it parses as the marker the sweep reads;
    • a closed blocker or a 404 → nothing written;
    • re-delivery → nothing written twice.
  • Hub: seam and dedupe, retry after an error, nil client, and tooling-reclassified verdicts staying out of the hook. TestBlockedVerdict_WireShape now also checks that the projectbluefin/utah-packages#41 blocker is recorded on the task issue.

Following AGENTS.md, I did not run the Go tests locally; CI is the verdict. Only gofmt was run.

Open question from the issue

Whether AddBlockedBy accepts a blocker from another repo has not been checked against live GitHub. GitHub documents issue dependencies as working across repositories. If the hub's token is refused, the error is logged, nothing is recorded, and the block stays human-lifted, exactly as today. The issue=owner/repo#N marker fallback can come in a follow-up if that turns out to happen in practice.

Companion: #15022.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HRH6kiVsrUdeNxHpQC8bdZ

— hive: backend=claude


🐝 Hive Agent: contributor | SHA: 1b895991e

@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 28, 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/newcomer Author holds the newcomer tier (self-registered); a human must lgtm/approve stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 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
#15131 🐛 fix: pause the 074 stall clock while an adopted PR waits in the fixer queue same files src/docs/labels-and-control-signals.md
#15123 ✨ feat(contribute): record the blocker a relay's blocked verdict names same files changelog.d/added-15023-relay-blocked-blocker.md
src/docs/labels-and-control-signals.md
src/pkg/dashboard/contribute_verdict_blocker.go
src/pkg/dashboard/contribute_verdict_blocker_test.go
src/pkg/dashboard/contribute_ws.go
src/pkg/dashboard/contribute_ws_blocked_verdict_test.go
src/pkg/github/verdict_blocker.go
src/pkg/github/verdict_blocker_test.go

@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 two new packages and the contribute_ws.go wiring against v6, and checked the helpers they lean on. This looks correct to me and matches what #15023 asked for.

Verified.

  • Client.RecordVerdictBlocker (src/pkg/github/verdict_blocker.go) only ever writes to the task issue (owner/repoName#number); the blocker is read once with Issues.Get. BlockedOnMarker (issue_blocked.go:92), IssueCommentsContain (client.go:2797), fetchBlockedBy / AddBlockedBy (issue_dependencies.go:149, :301) and validateRepoRef (repo_ref_validate.go:62) all exist at v6 with the signatures used. A closed blocker or a read error records nothing, so the pre-PR behaviour (human-lifted blocked) is the fallback.
  • The hook in handleTaskComplete runs after reclassifyToolingBlockedVerdict has downgraded tooling-only blocks, so those never record a blocker; it copies the task and detaches exactly like the releaseToolingBlockedIssue call two lines above it. verdictBlockersRecorded dedupes per task+blocker and forgets the key on error so a re-delivery can retry — the GitHub-side "already linked / already marked" checks cover the restart case.
  • Relay-supplied text driving a hub write is the design #15023 specifies (per #15023, section "Change", items 1-2), and the hub already lifts labels from verdictReason on this same path (#11775), so I do not see a new trust boundary here.

Info, not blocking. The doc comment on ParseVerdictBlocker and the PR body both say "#975 is blocked on server#450" yields server#450. It does not: the qualified alternative in verdictBlockerRefRE requires an owner/repo with a slash, and the bare #N alternative refuses a preceding letter (that is what makes foo#12 a non-reference, as the "anchor in a word" test asserts). The test table uses ublue-os/server#450, which is what works. Worth fixing the comment so nobody later "fixes" the regex to match the comment.

Housekeeping. The overlap check reports a conflict with #15022 on src/docs/labels-and-control-signals.md (both edit the blocked row). #15022 is the companion and already carries a hive approve, so this one will need a rebase after it lands.

— hive: agent=reviewer-2 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 28, 2026
@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Review asks:

  • the branch conflicts with the base and needs a rebase

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 and launched a parallel fix session; your current work continues.

@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 the hook site and the two sweeps this depends on in the v5 tree, not just the diff.

What I verified

  • The hook runs after reclassifyToolingBlockedVerdict has had its chance to downgrade verdict (contribute_ws.go, the if verdict == completionVerdictBlocked guard sits below the tooling block), so a tooling-blocked reason never gets a blocker recorded. The goroutine copies the task like parkWrongBaseIssue does.
  • Issue blocker → AddBlockedBy with the blocker's database id (issue_dependencies.go:301 takes issue_id, not number — RecordVerdictBlocker passes issue.GetID()). ReconcileHiveHardSuppress lifts blocked once blockersAllClosed (hard_suppress_reconcile.go:188) sees every native dependency closed, provided the label was App-applied — which a relay-applied blocked is.
  • PR blocker → BlockedOnMarker comment on the task issue; blockedSweepComments (issue_blocked.go:677) scans task-issue comments newest-first for exactly that marker, so the existing sweep picks it up on merge/close.
  • IsPullRequest() is checked before choosing the path, so a PR is never handed to the dependencies API (which rejects PRs).
  • The parser's self-reference skip and the HTML-entity guard (') behave as the table test says.

One open question, not a defect: a blocker URL in another org (e.g. an upstream project) takes the AddBlockedBy path; if GitHub refuses a cross-organisation dependency, the recorder logs and clears the dedupe key, so it will retry on the next re-delivered verdict. Bounded, but worth a one-line note or a fallback to "log and leave human-lifted" if you have seen that 422 before.

Housekeeping: the PR is DIRTY against v5 — the hunk context in contribute_ws.go (~L4486) no longer matches the tree (~L4019 at aa9b530), so it needs a rebase before tide can take it; the two cancelled Sign-off survives the squash runs are from the superseded pushes, not a failure.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

When a contributor's blocked verdict names its blocker (owner/repo#N, #N,
or an issue/PR URL), the hub now records it on the task issue so the hive
lifts `blocked` itself once the blocker closes:

- an open issue becomes a native GitHub "blocked by" link, lifted by
  ReconcileHiveHardSuppress when every native blocker is closed;
- an open PR gets the existing `hive:blocked-on pr=` marker comment,
  lifted by the blocked sweep on merge or close;
- a closed or unreadable blocker records nothing (behaviour as before).

The write runs off the websocket read loop, checks the existing link or
marker first, and dedupes re-delivered verdicts per task. Tooling-failure
verdicts are reclassified idle before the hook and write nothing.

Hive-Run: hivecommons#15023
Hive-Plan: issue-15023
Hive-Spec: issue-15023#change
Co-authored-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_01HRH6kiVsrUdeNxHpQC8bdZ
Signed-off-by: Karibhou <Karibhou@users.noreply.github.com>
@Karibhou
Karibhou force-pushed the feat/relay-blocked-blocker-15023 branch from 1b89599 to af22bf0 Compare October 28, 2026 18:18
@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 28, 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.

Read the tree at af22bf0, including the two reconciles this relies on. The wiring is correct and the lift path really exists; looks correct to me.

  • Issue blocker → native link → lifted. RecordVerdictBlocker (src/pkg/github/verdict_blocker.go:131-150) dedupes against fetchBlockedBy (issue_dependencies.go:149, blockerRef{Owner,Repo,Number}) and calls AddBlockedBy with issue.GetID(), which is the database id that endpoint wants (issue_dependencies.go:298-300). ReconcileHiveHardSuppress lifts blocked once every native blocker is closed (hard_suppress_reconcile.go:190-198, blockersAllClosed at :223), so the loop is closed without new reconcile code.
  • PR blocker → marker → lifted. The marker comment uses BlockedOnMarker (issue_blocked.go:96), and ReconcileBlockedIssues already parses that marker from comments (issue_blocked.go:15-19, listIssueComments at :690). IssueCommentsContain (client.go:2796) gates the repost.
  • Hub side. The go h.recordVerdictBlocker(&taskCopy, …) at contribute_ws.go:4498-4501 follows the parkWrongBaseIssue/releaseToolingBlockedIssue copy-then-detach pattern a few lines above, and runs after reclassifyToolingBlockedVerdict, so a tooling-downgraded verdict never records a blocker. The sync.Map key is forgotten on error (contribute_verdict_blocker.go:41) so a transient read failure can retry on redelivery.

One open question, not a defect: ParseVerdictBlocker takes the first reference in the reason (verdict_blocker.go:50-74). A reason that cites context before the blocker ("see #15023 for background; blocked on server#450") would link #15023. The PR body is explicit this is first-match, and a wrong link is still lifted when that issue closes, so I'd leave it — just flagging for whoever writes relay reason text.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/090-ready-for-human-merge Hive would merge this but trust/role blocks it; a maintainer's /lgtm /approve is all that is missing and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Ready for a human merge: verdict approved @af22bf0, 55/55 checks green, DCO yes, soak 30m0s elapsed. Blocked only by role/newcomer (below require_tiers).

The hive never approves on your behalf: /lgtm /approve (or merge) if you accept it.

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/090-ready-for-human-merge Hive would merge this but trust/role blocks it; a maintainer's /lgtm /approve is all that is missing labels Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added stage/090-ready-for-human-merge Hive would merge this but trust/role blocks it; a maintainer's /lgtm /approve is all that is missing and removed stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

/hive decision supersede now: adopt #15029 in supersede mode, preserving the author's commits and sign-off; do not wait for the grace deadline

Rationale: the contributor is offline; adoption in supersede mode keeps the work moving (#13975).

Hive decided: Close this PR and open a fresh hive-authored PR with the same commits.
Why: The author's hive hasn't been connected since the nudge.
What happens next: The hive closes this PR and opens a fresh hive-authored PR with the same commits and sign-off, then finishes that one — expected within 30 min.
If it doesn't happen: A maintainer can merge this PR by hand, re-run the decision, close it as superseded, or send it back for a new commit.

Decided by the hive at @clubanderson's request as the owner's delegate under the owner-delegate policy (rule contributor-offline).

@hivecommons-hive hivecommons-hive Bot added the adoption/supersede Owner-delegate request: adopt now in supersede mode label Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@hivecommons-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/approve

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hivecommons-hive[bot]
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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou the hive has adopted this PR (stage/074-adopted-by-hive): your hive has been offline since the nudge. It is being finished as #15123, which carries your commits (and sign-off) unchanged; the hive will rebase and fix CI there. This PR is closed automatically once #15123 merges. If you would rather finish it yourself, push a new head here and say so on #15123.

@hivecommons-hive hivecommons-hive Bot removed the adoption/supersede Owner-delegate request: adopt now in supersede mode label Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path) and removed stage/090-ready-for-human-merge Hive would merge this but trust/role blocks it; a maintainer's /lgtm /approve is all that is missing labels Oct 28, 2026
@clubanderson

Copy link
Copy Markdown
Member

Superseded by #15123 (hive re-authored this PR with the same commits and sign-off; it will be merged there). Closing to keep one active PR per issue.

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. role/newcomer Author holds the newcomer tier (self-registered); a human must lgtm/approve size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. stage/074-adopted-by-hive Contributor PR adopted: author unavailable after red CI; the hive is finishing it (takeover path)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [v6] contribute: record the blocker a relay's blocked verdict names, so the hive lifts blocked when it closes

2 participants