Skip to content

πŸ› [v6] contribute: a fleet card never lists a closed or merged PR as awaiting rework, even right after a restart - #17412

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/v6-fleet-rework-closed-after-restart
Nov 9, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/v6-fleet-rework-closed-after-restart

Conversation

@Danathar

@Danathar Danathar commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Right after a hub restart, the Operations card for a contributor listed long-finished PRs as "N PRs awaiting rework (not yet dispatched)". On projectbluefin, 22 of the 25 listed PRs had been closed or merged by a maintainer 9 to 13 days earlier. The card now leaves out a stage record that no stage pass has seen for a day, and any record the store marks superseded, whenever a repo's open-PR listing cannot vouch for it yet. A genuinely open, freshly returned PR still shows straight after a restart. When the listing is complete, it still decides, exactly as it has since #14715. This only affects the display: nothing was dispatched (fix_queue_depth was 0, and #17403 already guards dispatch).

What went wrong

The hub was upgraded and restarted on 2026-11-09 at 16:46Z (467557e β†’ 6b17f8c). GET /api/contribute/fleet at 16:53Z showed:

The card cleared by itself about 15 to 25 minutes later.

The cause is that the stage pass sees only open PRs. When a person closes or merges one, the pass never observes it closing, so the PR's stage record simply stops being updated, and Prune keeps it for 14 days. #14715 (Refs #14708) drops those records using the status snapshot's open-PR list, but only for a repo whose list is complete. Right after a restart no repo's list is complete yet, so every leftover 072/074 record counted as owed rework.

What changes

  • No complete listing yet: while a repo's listing cannot vouch for it, a 072/074 record counts only if a stage pass saw the PR within the last 24 hours. That is stage 072's own stalled dwell. The stage pass re-observes every open PR on each sweep and writes LastSeen to disk at least every 10 minutes. An open PR's record is therefore minutes old even after a restart, while a PR closed days ago falls out.
  • Superseded records: a record the store marks superseded never counts. That covers a hive copy that merged and an original closed in favour of its copy. The stage tracker already drops these rows. A reopen for a failed copy clears the mark, so a reopened PR shows again.
  • Complete listing: unchanged. The listing decides, whatever the record's age.
  • What is left alone: the stage store, Prune and the stage pass. Close-first supersession and adoption reopen read records of closed originals, so dropping those records earlier would break them.

Files

  • src/pkg/dashboard/contribute_fleet_rework.go: adds owedRework, pendingReworkUnseenBound and openPRIndex.vouches, and uses them for both the 072 and the 074 loop.
  • src/pkg/dashboard/contribute_fleet_rework_restart_test.go: new tests.
  • src/docs/contributor-relay.md: the pending_rework description.
  • changelog.d/fixed-fleet-rework-closed-after-restart.md

Tests

These were not run locally. CI is the verdict.

  • TestFleetReworkAfterRestartDropsLongUnseenRecords saves and reloads a store holding records last seen 9 to 13 days ago, plus one seen 5 minutes ago. It checks the result with no status, with an incomplete listing and with a repo that was never enumerated, and only the fresh PR shows. It fails on the tip because there closed() returns false for an unvouched repo, so all four PRs are listed.
  • TestFleetReworkAfterRestartKeepsFreshlyReturnedPR checks that a 072 PR seen a minute before the restart, and a 074 PR seen 23 hours ago, both still show while the listing is stale.
  • TestFleetReworkVouchedListingDecidesOverRecordAge checks that a complete listing still decides: an old record that is listed open shows, and a fresh record that is not listed does not.
  • TestFleetReworkSkipsRecordsTheStoreMarksFinished covers four cases: a superseded record, a close-first record and a forgotten record are all gone, while a reopened record shows. It fails on the tip because the tip lists the superseded and close-first records.
  • TestOwedReworkBound covers the bound's edges and ties the bound to 072's dwell.
  • The existing πŸ› contribute: drop merged and closed PRs from the rework cardΒ #14715 tests still hold: their records are fresh, and the listing logic is unchanged.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…ing rework, even right after a restart

Stage records outlive their PR by up to 14 days (Prune) when a person
closes or merges it, because the stage pass only lists open PRs and
never sees the close. hivecommons#14708 dropped such records only where the status
snapshot's open-PR listing is complete; right after a hub restart no
repo's listing is, so every leftover 072/074 record read as owed rework
(projectbluefin, 2026-11-09: 22 of 25 listed PRs were closed or merged).

While the listing cannot vouch for a repo, a 072/074 record now counts
only if a stage pass saw its PR within 072's stalled dwell (24h). A
record the store marks superseded never counts, matching the stage
tracker. A complete listing still decides as before.

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 Nov 9, 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 Nov 9, 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 diff against the v6 tree and the stagelabels code it leans on; the mechanism checks out and this looks correct to me.

What I verified:

  • src/pkg/stagelabels/stagelabels.go:284 β€” 072's table dwell is 24 * time.Hour, so pendingReworkUnseenBound = stagelabels.ReturnedToContributor.Dwell() is the 24h the body describes, and the new TestOwedReworkBound pins it above LastSeenPersistEvery (10m, store.go:891).
  • src/pkg/stagelabels/store.go:833 β€” ObserveProgressHead sets next.LastSeen = now on every observation. The dampener early-return above it (store.go:815) only fires when prev.Stage != stage, so a PR that sits in 072 across sweeps still has its LastSeen refreshed; the "an open PR's record is minutes old even after a restart" premise holds.
  • src/pkg/stagelabels/store.go:2719 β€” Prune drops on LastSeen.Before(cutoff) with the 14-day maxAge, which is why the closed records survived until now.
  • src/pkg/stagelabels/store.go:2438 β€” Superseded() is SupersededBy > 0; using it in owedRework matches how the stage tracker already drops those rows.
  • owedRework keeps the vouched path identical to before (open.vouches β†’ !open.closed), so repos with a complete listing behave exactly as since #14708. TestFleetReworkVouchedListingDecidesOverRecordAge covers that.
  • The LastSeen.IsZero() β†’ keep branch is the conservative choice for a record the loader has not stamped yet; NoteUnblocked (store.go:944) also backfills zero LastSeen, so this should be rare in practice.

One note, not a defect: the fix-queue loop (contribute_fleet_rework.go, the for _, it := range queued loop) still uses open.closed alone. Those items are not stage records and carry no LastSeen, so there is nothing to bound them by β€” and the body says fix_queue_depth was 0 in the incident β€” so leaving it as is seems right.

Changelog fragment and contributor-relay.md are updated consistently with the code. CI is the verdict on the tests; I did not run them.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

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

Intent alignment: the diff matches the stated contract β€” owedRework (src/pkg/dashboard/contribute_fleet_rework.go:217-226) keeps the #14715 listing rule when vouches() is true, falls back to a 24h LastSeen bound otherwise, and drops Superseded() records; both the 072 and 074 loops use it (:328, :345). The fix-queue loop (:307) still uses open.closed only, which is correct since queue items are not stage records. Store, Prune and the stage pass are untouched as claimed.

One in-scope caveat worth a wording fix, not a blocker:

Paused repos are a persistent, not transient, "cannot vouch" case. ownershipRowsComplete returns false for repo.Paused (src/pkg/dashboard/ownership_transitions.go:181-183), and the stage lanes iterate activeRepos(), which filters repoPaused out (src/pkg/github/client.go:5615-5627, used from automerge_contributor_lane.go:412,991). So for a paused repo no pass moves LastSeen, the index never vouches, and with this PR every open 072/074 PR there leaves the contributor card 24h into the pause and stays off until the repo resumes. Before this PR those PRs were listed. That is a defensible trade (nothing is dispatched for a paused repo anyway), but the PR body and the doc text ("The stage pass sees every open PR on each sweep, so a freshly returned PR still shows") promise that only closed PRs disappear. Suggest naming the exception in src/docs/contributor-relay.md:1780:

`kind: rework` means the item repairs one of the contributor's own PRs: any `fix-pr` task, or a task whose target the stage store has in a repair stage (`070-fixing`, `071-needs-author`, `072-returned-to-contributor`, `074-adopted-by-hive`). Everything else is `new`. `pending_rework` is derived without a GitHub call: the stage-label store (which remembers each PR's author) βˆͺ the fix queue, minus the fix tasks in flight on any of the contributor's connections, minus any PR the status snapshot shows as merged or closed. A stage record can outlive its PR when the stage sweep never saw it close, so a PR is dropped when its repo's open-PR list is complete (enumerated, not paused, not incomplete, stale or carrying unlisted PRs) and does not include it. Until that listing is complete (for example in the first minutes after a hub restart) a stage record counts only if a stage pass saw its PR within the last 24 hours (the `072` stalled dwell). The stage pass sees every open PR of an active repo on each sweep, so a freshly returned PR still shows, while a PR a person closed or merged days ago does not. A paused repo is neither swept nor vouched for, so its 072/074 PRs leave the card 24 hours into the pause and return once the repo is resumed. A record the store marks superseded (the hive's copy merged, or the original was closed in favour of its copy) never counts. A non-zero `pending_rework` on an idle row is the signal to look at β€” typically a relay that did not advertise `fix_pr_interrupt_v1`, a preempt-mode relay inside its `contribute.min_focus_window`, or a contributor who is offline.

Reviewed at head f12331b. Tests not run locally (author states the same).

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

Read the change against the v6 tree at f12331b; the premises it rests on hold, and it looks correct to me.

What I verified, not inferred:

  • LastSeen moves on every observation (src/pkg/stagelabels/store.go:833) and a seen-only move is persisted once the saved value is LastSeenPersistEvery (10 min) old (store.go:877, :891). So an open PR's record is at most ~10 min stale on disk across a restart, as the PR body claims.
  • The only paths in the stage pass that continue before ObserveHead (src/pkg/github/automerge/automerge_stage_labels.go:1046-1066) are rank-none, "weak opinion deferred", and stageOwnerHolds. The last is bounded by stageOwnerAbsenceGrace = 2 * selfAuthoredSweepMaxInterval = 30 min (automerge_stage_labels.go:292, automerge_sweep.go:784), far under the 24h bound β€” so an open 072/074 PR cannot be silently aged out by that skip.
  • ReturnedToContributor.Dwell() is 24h (stagelabels.go:284), Superseded() is SupersededBy > 0 (store.go:2438), and the bound only applies when vouches() is false; a complete listing still decides as before (πŸ› [v6] contribute: contributor card counts merged and closed PRs as awaiting reworkΒ #14708 behaviour preserved).
  • The fix-queue loop deliberately keeps open.closed alone, which is right: queued items are live, not stage leftovers.
  • rec.LastSeen.IsZero() counts as owed β€” the conservative side, and Load back-fills zero LastSeen with now anyway (store.go:944).

The four new tests cover the three "cannot vouch" shapes, the fresh-after-restart keep, listing-overrides-age, and superseded/reopened. The one residual edge is an outage longer than 24h followed by a restart, where a genuinely open 072 PR would drop off the card until the repo listing completes (~15-25 min per the body) β€” the comment on pendingReworkUnseenBound already names that trade-off, and it is display-only, so I would not hold the PR for it.

Nothing to change from my side; this is a maintainer's call to merge.

Evidence bundle `#17412f12331b` sha256:c3bedf6343f56345adf1407fe5f1361e0b500578d3a848e45e6a2b6a47e3f0be β€” download from the dashboard or `hivectl review evidence #17412`.

@hivecommons-hive
hivecommons-hive Bot merged commit 95650ba into hivecommons:v6 Nov 9, 2026
67 of 70 checks passed
@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 f12331b.

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

Labels

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