Skip to content

✨ Governor PRs by model: split closed-unmerged PRs into superseded, duplicate and other - #18782

Merged
hivecommons-hive[bot] merged 6 commits into
hivecommons:v5from
Danathar:feat/pr-models-close-reasons
Nov 18, 2026
Merged

hivecommons-hive[bot] merged 6 commits into
hivecommons:v5from
Danathar:feat/pr-models-close-reasons

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

The PRs by model card lumps every unmerged, closed PR into one "closed-unmerged" number. That mixes PRs the hive closed because another PR landed the same change, duplicates, and real failures. Only the last says anything about the model.

This splits the count by reason, using only labels and the Supersedes #N line the hive already records. Operators see the split when they hover a row. No new GitHub calls; existing fields, the bar, merge rate and rank are unchanged.

Refs #18719
Part of #18723

What this changes

  • Each bucket of GET /api/governor/pr-models gains closed_unmerged_reasons: {superseded, duplicate, other}. The three always add up to closed_unmerged.
  • The row tooltip reads 6 closed-unmerged (3 superseded · 1 duplicate · 2 other). Older servers without the field show the old line.
  • Closed attributed PR records now carry supersedes: N when the body says Supersedes #N, like open PRs already do.

Why

A model whose PRs keep getting replaced by a later PR, or closed as duplicates, was charged the same as one whose work was rejected. The card could not tell them apart.

How it works

  • superseded: the PR has the hive/superseded label, or another PR in the same repository (closed attributed or currently open) says Supersedes #N for it.
  • duplicate: the PR has a duplicate label (any case).
  • other: everything else. Telling "rejected" from "abandoned" would need the timeline API (a call per PR), so that stays out, as the issue says.
  • If both superseded and duplicate apply, superseded wins.

Example: opus has 5 closed-unmerged PRs. One carries hive/superseded, one is named by a merged PR's Supersedes #2, one has duplicate, two have neither. The tooltip shows 5 closed-unmerged (2 superseded · 1 duplicate · 2 other).

Files

  • src/pkg/github/client.go: pullRequestAttributionRecord copies Supersedes from the body it already has.
  • src/pkg/dashboard/api_governor_pr_models_close_reasons.go (new): governorPRModelsSupersededKeys, governorPRModelCloseReason, applyGovernorPRModelCloseReasons.
  • src/pkg/dashboard/api_governor_pr_models.go: the new bucket field, and one call in handleGovernorPRModels.
  • src/pkg/dashboard/static-src/js/governor-view.js and static/index.html: the tooltip split (identical edits; the concatenation matches).
  • src/docs/dashboard-sections/overview-and-metrics.md: documents the split under PRs by model.
  • changelog.d/added-18719-pr-models-close-reasons.md.

Tests

  • api_governor_pr_models_close_reasons_test.go: superseded by label, superseded by another PR, a duplicate, both labels, other, a Supersedes in a different repo that must not match, a PR outside the window. Asserts counts and the sum invariant for 7d and all. A handler test checks an open PR's Supersedes counts and that closed_unmerged is unchanged.
  • attributed_closed_pr_supersedes_test.go: the closed record copies Supersedes, and the closed scan still makes exactly one GitHub call per page.
  • pr_models_close_reasons.test.js: the tooltip renders the split, and no split for old servers or rows with nothing closed.

CI: this PR's own v2 Tests and v2 CI checks. Only gofmt -l was run locally, as AGENTS.md requires.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WcWm7qFmFJp26r9LPdmi3t

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

@github-actions

github-actions Bot commented Nov 17, 2026 •

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.

PR Title Relation Files
#18780 ✨ Governor PRs by model: what each model's PRs cost the hive to review CONFLICT src/pkg/dashboard/api_governor_pr_models.go (conflict)
src/pkg/dashboard/static-src/js/governor-view.js (conflict)
src/pkg/dashboard/static/index.html (conflict)

@hivecommons-hive

hivecommons-hive Bot commented Nov 17, 2026 •

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.

Review asks:

  • the review swarm requested changes

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

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026
Each /api/governor/pr-models bucket gains closed_unmerged_reasons
{superseded, duplicate, other}, summing to closed_unmerged. Superseded =
hive/superseded label, or another PR in the same repo (attributed or open
items) declares Supersedes #N for it; duplicate = a duplicate label;
other = everything else. Closed attributed PR records now copy
Supersedes from the body the scan already has, so no new GitHub calls.
The row tooltip shows the split after the closed-unmerged count.

Refs hivecommons#18719

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcWm7qFmFJp26r9LPdmi3t
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
@Danathar
Danathar force-pushed the feat/pr-models-close-reasons branch from d5f606c to 2be8530 Compare November 17, 2026 21:01
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026
@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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

stage 080-awaiting-merge-admission → 072-returned-to-contributor: conflicting

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Heads-up for the merger: this PR and #18780 each add the same package-level function, so the second one to merge breaks the build.

governorPRModelsCutoff(window string, now time.Time) time.Time is declared in package dashboard by both this PR (api_governor_pr_models_close_reasons.go:85) and #18780 (api_governor_pr_models.go:506), both against v5. They are different files, so git will not report a textual conflict, but whichever merges second fails to compile with governorPRModelsCutoff redeclared in this block. Verified by reading both diffs; the bodies are identical in behaviour (7d/30d/all cutoff).

Suggested fix: land one of the two first and have the other drop its copy and reuse it (this PR's copy is api_governor_pr_models_close_reasons.go:85). Everything else I read looked consistent with the surrounding code. These are not duplicates of each other: #18780 adds hive cost per model, #18782 splits closed-unmerged reasons.

Findings not on a changed line

  • src/pkg/dashboard/api_governor_pr_models_close_reasons.go:85: governorPRModelsCutoff(window string, now time.Time) time.Time is declared in package dashboard by both this PR (api_governor_pr_models_close_reasons.go:85) and ✨ Governor PRs by model: what each model's PRs cost the hive to review #18780 (api_governor_pr_models.go:506), both against v5. They are different files, so git will not report a textual conflict, but whichever merges second fails to compile with governorPRModelsCutoff redeclared in this block. Rebase on whichever lands first and drop one copy.
Evidence bundle `#18782d8bdd02` sha256:db37f4b8f58e67a268b801d514c366e329ccb88c34bbd2742ed0ef32fa044597 — download from the dashboard or `hivectl review evidence #18782`.

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

Keep both sides: the bucket gains ClosedUnmergedReasons beside v5's
Repos/Weeks, and the row tooltip keeps the close reasons beside v5's
slice detail. The close-reasons test harness lifts the helpers the
merged row renderer now calls, as pr_models_header_once.test.js does.

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

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

This PR conflicts with #18780: both add a package-level func governorPRModelsCutoff(window string, now time.Time) time.Time to src/pkg/dashboard. #18780 defines it in api_governor_pr_models.go and #18782 here in api_governor_pr_models_close_reasons.go, with the same body. Both extract the same window switch out of aggregateGovernorPRModels. Whichever lands second fails to compile with governorPRModelsCutoff redeclared in this block, and both also edit the same hunk of api_governor_pr_models.go, so it will conflict textually too.

Suggested fix: land one first, then drop the duplicate definition from the other and rebase. The two bodies are identical, so nothing else changes.

I read the rest of the close-reason split (governorPRModelCloseReason, applyGovernorPRModelCloseReasons) against the existing aggregateGovernorPRModels filter. The Other remainder keeps the sum equal to closed_unmerged, and I found no other defect.

— hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.326

Danathar and others added 3 commits November 17, 2026 17:22
Picks up the governor-pr-models-ui test fix so server-tests runs
against a base whose test file compiles.

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
@hivecommons-hive
hivecommons-hive Bot merged commit 362504f into hivecommons:v5 Nov 18, 2026
74 of 75 checks passed
Danathar added a commit to Danathar/hive that referenced this pull request Nov 18, 2026
v5 now has the close-reasons split (hivecommons#18782). Keep both sides:
- the bucket carries HiveCost and ClosedUnmergedReasons;
- the row tooltip keeps v5's close reasons and adds the hive review cost
  before the per-repo/per-week detail;
- governorPRModelsCutoff was defined on both sides with the same body;
  keep v5's copy in api_governor_pr_models_close_reasons.go;
- the close-reasons test harness lifts governorPRModelHiveCostTip and
  fmtUSD, which the merged row renderer now calls.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conflicts-with-open-pr Open PR has a merge conflict with another open PR 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