Skip to content

🐛 [v6] contribute: contributor card counts merged and closed PRs as awaiting rework #14708

Closed

Description

@Danathar

Target: v6.

Target branch: v6 only. Open the PR with --base v6. hive-open-pr defaults to the repo's default branch (v5) when --base is omitted.
Citations: path:line against v6 @ dd406b3e9, paths relative to src/.

The contributor card counts merged and closed PRs as "awaiting rework".

What happened

Seen on a hosted hive on 2026-10-27. A contributor's card said "idle · 4 PRs awaiting rework (not yet dispatched)". The four PRs were chairlift#630, dakota-iso#269, dakota-iso#274 and dakota-iso#287. The first three had been merged on 2026-10-25 while still labelled stage/072-returned-to-contributor. Only #287 was still open.

That line tells the operator that rework is not reaching the contributor's agent. Phantom entries make it a false alarm.

Cause

fleetReworkFor (pkg/dashboard/contribute_fleet_rework.go:143) builds PendingReworkPRs from three sources:

  • the fix queue;
  • store.ByAuthor(user, stagelabels.ReturnedToContributor) (:228);
  • store.ByAuthor(user, stagelabels.AdoptedByHive) (:248).

Nothing checks whether the PR is still open. Store.ByAuthor (pkg/stagelabels/store.go:1382) returns every record with that author and stage.

Stage records are removed in only two ways:

  • store.Forget(key) runs when the PR stage sweep sees a terminal verdict, meaning the PR was closed or merged (pkg/github/automerge/automerge_stage_labels.go:888-889; Terminal is defined at pkg/stageengine/decision.go:21).
  • store.Prune(stageStorePruneAge) drops records not observed for 14 days (automerge_stage_labels.go:189, :1159; Store.Prune is at store.go:1303, keyed on Record.LastSeen at store.go:196).

The three merged PRs still had records two days after merging, and their 072 labels were never cleared. So the sweep never saw them close, and the terminal path did not run for them. Their records will stay until the 14-day prune.

Fix

  1. Required. Exclude merged and closed PRs from pending rework in fleetReworkFor. Use open-state data the dashboard already holds, such as the status snapshot's open-PR lists or the stage record's LastSeen against the last completed sweep. Avoid a new GitHub call per card render.
  2. Preferred, if the layer is clear. Make the PR stage sweep retire records for PRs that have left its open list, not only those it sees reach a terminal verdict. That way every other ByAuthor and stage consumer stops seeing stale 072 and 074 records too, and the stale stage label can be cleared at the same point. A PR missing from one partial or failed listing must not be forgotten, so this applies only after a complete listing.

The PR must say which layer owns the cleanup and why.

Acceptance criteria

  • A merged or closed PR never appears in pending_rework or pending_rework_prs.
  • An open PR at 072 or 074 still appears.
  • The in-flight exclusion (inFlightKeys) behaves as it does now.
  • If record cleanup is added, a merge or close removes the PR from ByAuthor results. A PR missing from an incomplete listing keeps its record.

Test plan

  • fleetReworkFor with a stage store holding three of one contributor's PRs: an open one at 072, a merged one at 072, and a closed one at 074. Expect only the open one in pending_rework_prs, with pending_rework = 1.
  • If cleanup is added, a sweep-level test where a PR present on one complete listing is absent on the next. Its record must be gone, and it must be kept after a failed or partial listing.
  • Run go test ./pkg/dashboard/... ./pkg/stagelabels/... ./pkg/github/automerge/....

Out of scope

  • Dispatch logic.
  • Fix-queue scheduling.

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Oct 27, 2026
  2. hivecommons-hive commented on Oct 27, 2026

    @hivecommons-hive
    Contributor

    🔒 Claimed by @Karibhou (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply /unclaim to release, or /claim to take it over if you outrank the holder.

  3. hivecommons-hive commented on Oct 27, 2026

    @hivecommons-hive
    Contributor

    🔓 Claim by @Karibhou released (lease revoked).

  4. hivecommons-hive commented on Oct 27, 2026

    @hivecommons-hive
    Contributor

    PR #14715 covers this issue: #14715

    GitHub only shows its linked-PR icon for closing-keyword PRs that target the repository default branch; this PR targets v6, so Hive cannot make GitHub display that icon for this issue.

  5. added 2 commits that reference this issue on Oct 28, 2026
    776df2f
    81c4c2c
  6. added
    hive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmation
    and removed on Oct 28, 2026
  7. hivecommons-hive commented on Oct 28, 2026

    @hivecommons-hive
    Contributor

    Verified resolved by #14715 (merged into v6): PR excludes merged and closed PRs from the rework card count by checking against the snapshot's open-PR index when the repo listing is complete. Closing.


    🐝 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

  8. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    @Danathar this issue was closed by @hivecommons-hive[bot] as completed.

    If this was closed by a merged PR, the fix only takes effect once it ships in a tagged release and your deployment updates to it — check your running version against the fix before concluding the fix failed.

    If you are still seeing the problem, comment /reopen and it will be reopened for you — you do not need write access. Please add what you are still observing (running version, logs, steps) so it is not closed the same way again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions