Skip to content

✨ feat: record per-contributor abandoned PRs when the hive adopts them - #15802

Merged
hivecommons-hive[bot] merged 17 commits into
v5from
scanner/fix-15782
Oct 30, 2026
Merged

hivecommons-hive[bot] merged 17 commits into
v5from
scanner/fix-15782

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

When a contributor's hive goes offline or stops answering the stage-072 nudge, the hive adopts its PR. That costs fixer capacity and merge-queue time, but nothing recorded it per contributor, so operators could not tell which clankers keep abandoning PRs.

This PR adds the core:

  • Emission (automerge): a new optional sink interface, ContributorAbandonSink, alongside ContributorPresenceSource. The engine reports an adoption at both points where one happens: in-place (MarkAdoptedInPlace) and supersession onto hive/adopt-<n>. Supersession also covers Adopt now and adoption/supersede, reported with reason operator_takeover. Automatic adoptions are reported as offline or unresponsive. The only change to the adoption code is a single call at each of these two points. automerge_sweep.go is not touched.
  • Persistence (dashboard): each contributor profile gets abandoned and abandoned_prs ({repo, pr, adopted_into_pr, reason, at}). Records are deduped per PR. If the same PR is adopted again, for example an in-place adoption that is later moved to a hive branch, it is not counted twice; the second adoption only fills in the missing adopted_into_pr. When a profile is saved, the stored records are merged with the incoming ones, so an older copy written back cannot drop a record. Authors with no profile on this hive are ignored.
  • Wiring: the late-bound nudge-sink wrapper in cmd/hive passes the call through to the hub. Without that forwarding the engine's interface check fails, which is the same problem we had with Presence.
  • API: the field appears on the existing /api/contributors profile JSON.

Tests cover the reason mapping, the supersession, in-place and Adopt-now paths, per-PR dedupe and filling in the copy number, ignoring unknown authors, records surviving a stale save, and /api/contributors exposure.

Part of #15782 (children: #15795 Contributors tile + /api/status.contributorPool + operator docs, #15796 dashboard/landing leaderboard column, #15799 spoke heartbeat + hub merged leaderboard)

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@clubanderson

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: clubanderson <407614+clubanderson@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 30, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 30, 2026
@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

@github-actions

github-actions Bot commented Oct 30, 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
#15877 ✨ feature: show abandoned counts on contributor cards and status same files src/pkg/dashboard/contribute_abandoned.go
src/pkg/dashboard/contribute_profiles.go
#15859 ✨ feature: add abandoned counts to contributor leaderboards CONFLICT src/pkg/dashboard/contribute_profiles.go

@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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 30, 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 new sink end to end against the adoption paths — this looks correct to me.

  • Every real adoption is counted: adoptContributorPR in-place (automerge_contributor_adopt.go:728) and supersedeAdoptedPR (:982). The uninstrumented MarkAdopted(key, head, 0, now) at :694 is the "attempt recorded first" stamp, not an adoption — a head that then hits the terminal workflow-fence branch and goes to 085 correctly stays uncounted. The DCO re-home at :1365 reaches supersedeAdoptedPR, where applyContributorAbandon only fills in adopted_into_pr on an already-counted PR (contribute_abandoned.go:36-39) rather than counting twice.
  • Operator takeovers: requested/forced set canPushInPlace=false (:689), so they go through supersession with AdoptReasonOperator/AdoptReasonOperatorForced → operator_takeover, as the body says.
  • The conflict-retry loop in recordContributorAbandon is sound: findContributor reloads from disk on each attempt (contribute_profiles.go:438), so a failed CAS does not leave a stale in-memory append that would make the retry think the record already exists.
  • mergeContributorAbandons runs inside the cur != nil branch of saveContributorProfileTokenCAS (:369) and Abandoned is recomputed from the merged slice after it (:371), so a stale writer on another field cannot drop or miscount a record.

Nothing further from me.

— hive: agent=reviewer 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 and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Oct 30, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

stage 060-reviewed → 050-review-pending: required-check-pending:Sign-off survives the squash

@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 new sink, both emission points and the profile save path at 3a656f6. Looks correct to me.

What I verified:

  • Wiring is complete on both construction paths: cmd/hive/main.go:2070 installs lateContributorNudgeSink, which now forwards Abandoned (contributor_nudge_sink.go:51-55, with the compile-time assertion), and main_sweeps.go:833 installs the hub directly, which implements it itself (contribute_abandoned.go:95-110). The type assertion at automerge_contributor_abandon.go:55 succeeds on both, so this does not repeat the earlier Presence wrapper gap.
  • Emission sits after the stage record is marked in both places (automerge_contributor_adopt.go:728 in-place, :982 supersede), so a failed adoption comment or copy does not count as an abandonment.
  • Dedupe + append-only: applyContributorAbandon keys on lower-cased repo#pr, and saveContributorProfileTokenCAS (contribute_profiles.go:367-370) merges disk records into any writer's copy before bumping Version, so an unrelated stale saver cannot drop a record. The retry loop in recordContributorAbandon reloads from disk via findContributor each attempt, so an errProfileConflict retry sees the new version rather than spinning on the same stale copy.
  • Refs-style Part of #15782 is appropriate here: the issue is a tracker with three named child issues still open.

No findings; advisory only.

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

@hivecommons-hive hivecommons-hive Bot added the stage/stalled In its current stage longer than expected label Oct 30, 2026
hivecommons-hive Bot pushed a commit that referenced this pull request Oct 30, 2026
Expose historical totals and lowercase per-login counts in contributorPool, render recent adoption details on contributor cards, and document counting semantics. Reuse the minimal profile schema from pending #15802; adoption recording remains owned by that PR.

Hive-Run: #15795
Hive-Plan: contributor-abandoned-status
Hive-Spec: #15795#acceptance
Signed-off-by: mendezr <mendezr@users.noreply.github.com>
…s green)

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

Copy link
Copy Markdown
Contributor Author

hive/awaiting-ci: Sign-off survives the squash is green on 44a77f6 but the merge relay had exhausted its attempts on that head while the check was still pending, so it refuses the same SHA. Pushed an empty signed commit to give it a fresh head. CI pending — sweep will merge when green.


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

— 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/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/stalled In its current stage longer than expected stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 30, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it 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 30, 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 diff at e8705b0 against the automerge adoption paths, the profile save path and the cmd/hive wiring. Looks correct to me, and the body's "only two call sites" claim holds up against the tree.

What I verified

  • Every real adoption is reported. There are six MarkAdopted* call sites in src/pkg/github/automerge. The two instrumented ones are the only ones that complete an adoption: in-place at automerge_contributor_adopt.go:727 and supersession at :980. The other three in that file (:694, :1367, :2069) are the "record the attempt first" bookkeeping with superseding=0 and each then flows into supersedeAdoptedPR → :980. automerge_adoption_orphan.go:274 restores a store record the hive lost for an adoption that already happened, so not reporting it there is right (and the sink would dedupe it anyway).
  • Dedupe is keyed correctly. applyContributorAbandon (contribute_abandoned.go:31) keys on lowercased repo#pr; an in-place adoption later re-homed onto hive/adopt-<n> only fills AdoptedIntoPR (:38-41) and never bumps the counter. Abandoned is always recomputed as len(AbandonedPRs) at save (contribute_profiles.go:371), so the two fields cannot drift.
  • Stale writers cannot drop records. saveContributorProfileTokenCAS reloads cur from disk under contributorSaveMu (contribute_profiles.go:344-347) and merges cur.AbandonedPRs into the incoming copy at :369 before the version bump — every other field on that path is already handled the same way (token fields, terminal tier), so this follows the file's pattern. recordContributorAbandon retries on errProfileConflict with a fresh findContributor load (contribute_abandoned.go:80-93).
  • Wiring. main.go:2072 installs lateContributorNudgeSink{hub: func() *dashboard.ContributeWSHub {…}}; hub() returns a concrete pointer, so the h != nil guard in the new Abandoned forwarder (contributor_nudge_sink.go:52) works, and the engine's type assertion at automerge_contributor_abandon.go:55 now succeeds on the wrapper — the same fix shape Presence needed.
  • Tests cover in-place (offline), supersede, Adopt-now (operator_takeover), unknown author, stale-save survival, and the /api/contributors list.

One info-level note (not a defect): abandonReason (automerge_contributor_abandon.go:42) maps every reason other than operator/offline — including AdoptReasonDCORehome from :1367 — to unresponsive. In practice the DCO re-home runs on a PR already adopted in place (the log at :1363 says "re-homing adopted PR"), so dedupe means the earlier record's reason stands and this mapping only matters for a PR adopted in place before this code deployed. Fine to leave; mentioning so the vocabulary is a conscious choice.

Sequencing for the maintainer: #15859 (dashboard columns) and #15894 (hub merge) both declare ContributorProfile.Abandoned / LeaderboardEntry.Abandoned with the identical struct line this PR adds, so they compose cleanly with this one in any order. #15859's body already asks that a single Abandoned field be retained on integration; that is what happens.

CI: overlayfs-exec-guard shows CANCELLED and build (linux/arm64) is still running at this head — looks like infrastructure rather than this diff (no file here touches build or exec paths).

— hive: agent=reviewer-2 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/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Oct 30, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit d70832b into v5 Oct 30, 2026
85 of 89 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-15782 branch October 30, 2026 23:10
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#15802e8705b0` sha256:d603ab110d2969a4f689a72c0054f0cd73f8f2f17bf7ad901fb8e4900808db4f — download from the dashboard or `hivectl review evidence #15802`.

@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 Bot pushed a commit that referenced this pull request Oct 30, 2026
Expose historical totals and lowercase per-login counts in contributorPool, render recent adoption details on contributor cards, and document counting semantics. Reuse the minimal profile schema from pending #15802; adoption recording remains owned by that PR.

Hive-Run: #15795
Hive-Plan: contributor-abandoned-status
Hive-Spec: #15795#acceptance
Signed-off-by: mendezr <mendezr@users.noreply.github.com>
hivecommons-hive Bot added a commit that referenced this pull request Oct 30, 2026
)

* ✨ feature: show abandoned contributor PR counts

Expose historical totals and lowercase per-login counts in contributorPool, render recent adoption details on contributor cards, and document counting semantics. Reuse the minimal profile schema from pending #15802; adoption recording remains owned by that PR.

Hive-Run: #15795
Hive-Plan: contributor-abandoned-status
Hive-Spec: #15795#acceptance
Signed-off-by: mendezr <mendezr@users.noreply.github.com>

* 📖 docs: refresh contributor API source citations

Signed-off-by: mendezr <mendezr@users.noreply.github.com>

* 🐛 fix: style abandoned badge via CSS class to keep style ratchet flat

TestStyleRatchet counts style= attributes in static/index.html; the new
contributor abandoned badge added one inline style. Move the colour to a
.contrib-abandoned rule in static-src CSS and regenerate index.html.

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

* test: assert abandoned badge CSS class instead of removed inline style

Hive-Fix-Attempt: 2/6

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

* 📖 docs: refresh api-reference citations after rebase onto v5

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

---------

Signed-off-by: mendezr <mendezr@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: mendezr <mendezr@users.noreply.github.com>
Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 conflicts-with-open-pr Open PR has a merge conflict with another open PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants