Skip to content

πŸ› fix: expose deferred PR fixer queue positions - #16553

Merged
hivecommons-hive[bot] merged 3 commits into
v5from
hive/adopt-16546
Nov 4, 2026
Merged

hivecommons-hive[bot] merged 3 commits into
v5from
hive/adopt-16546

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersedes #16546 (adopted in place, re-homed because a hive commit on the contributor branch cannot carry a squash-safe sign-off; original commits by @thatguywob preserved).

Fixes #16537

This branch is #16546's head b824717aef61 as pushed by @thatguywob (fork thatguywob/hive), unchanged. Last lane reason on the original: required-check-failing:coverage.

Hive fix agent: rebase this branch on v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

Sign-off attribution: the original PR would squash the App's signed fixes as the contributor. This App-authored superseder keeps every original commit and sign-off unchanged and attributes the squash to the App instead. DCO and all merge gates still apply here.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 4, 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 hanthor 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 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
#16513 ✨ feat(dashboard): feed published checkpoint diff regions to Code activity same files src/pkg/dashboard/static/index.html
#16492 ✨ feat(dashboard): changed-paragraph reader kiosk view (part 1/3) same files src/pkg/dashboard/static/index.html
#16514 ✨ feat(dashboard): replace Matrix presentation with Code activity same files src/pkg/dashboard/static/index.html
#16500 ✨ feat(dashboard): replace Matrix presentation with Code activity same files src/pkg/dashboard/static/index.html

@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 Nov 4, 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.

Correctness review (head b824717aef61)

Partial GitHub enumeration evicts queued fixer entries as if their PRs closed β€” src/cmd/hive/fixer_queue.go:33-50 (reconcileDeferredFixQueue) and :55-64 (reconcilePlannedFixQueue) only guard actionable == nil. But EnumerateActionable returns err == nil with a repo's PRs simply absent whenever that repo's forgestate/issues/PR fetch fails and no last-good snapshot exists (src/pkg/github/client.go:1696-1727; the PR-only branch keeps issues and drops PRs; only the all-repos-failed case errors, :1792). In overlay-mode an all-repos failure also yields a non-nil empty, stale-marked result (src/cmd/hive/main_eval_cycle.go:431-438). In each case ReconcileFixerQueue (src/pkg/governor/fixer_queue.go:62-75) drops every entry for the affected repo(s); the planner (src/cmd/hive/main_sweeps.go:2393) also sees no candidates, so the second reconcile does the same. Next cycle the kick is deferred again and re-added with a fresh firstDeferredAt, so the PR loses its position and jumps to the back of the queue β€” the "position drops as earlier kicks are delivered" criterion in #16537 is violated during transient GitHub errors. The author's own comment (fixer_queue.go:35) states the right rule; the nil check just doesn't implement it for partial failures.

Suggested fix: scope eviction to repos actually enumerated this pass β€” keep any entry whose repo is absent from actionable.TotalByRepo or present in actionable.StaleRepos (client.go:1671 populates TotalByRepo only via appendRepo), and apply the same repo filter in reconcilePlannedFixQueue. Add a test with a two-repo result where one repo is missing/stale.

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

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 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 Nov 4, 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 against v5 merge-base 10b34594 plus the callers it hooks into; this looks correct to me.

What I checked, in case it saves a maintainer the trace:

  • Keying is consistent end to end. RecordFixKickDeferred lowercases PRRef (src/pkg/governor/fixer_queue.go:24), PRRef is repo#number (src/pkg/review/dispatch.go:1608), github.ReviewQueueKey lowercases the same shape (src/pkg/github/review_queue.go:323-325), and the dashboard looks entries up with that key (src/pkg/dashboard/api_review_queue.go:141). No case/format mismatch that would silently drop entries.
  • reconcilePlannedFixQueue does not wipe a still-waiting deferral. The concern would be that dispatchFix appends to State.Fixes at plan time (dispatch.go:1609), so a deferred-but-undelivered fix would be excluded as Pending next cycle and vanish from FixKicks. It doesn't: the end-of-pass ConfirmDelivered removes undelivered fixes from state.Fixes (dispatch.go:1720-1729), so the PR is re-planned, stays in FixKicks, and the queue entry survives until delivery or close.
  • reviewQueueItem embeds ReviewQueueEntry + FixerQueueStatus; neither has a custom MarshalJSON, so the two optional fields are promoted additively and existing consumers are unaffected (matches #16537's acceptance criteria). deps.Governor is *governor.Governor and FixerQueue is nil-receiver safe.

One note, not a defect: #16537 says it is blocked by #16536 (fallback routing), but this change hooks the deferral point that already exists at merge-base (eval_cycle_seams.go:612), so it stands on its own. The in-memory queue loses firstDeferredAt across a restart β€” the code comment at fixer_queue.go:80 already says so.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor Author

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

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

Looks correct to me. I read the three write paths and the two read paths against the v5 tree, not just the diff:

  • Key agreement. RecordFixKickDeferred lowercases its ref (src/pkg/governor/fixer_queue.go:24); every other key β€” reconcile, planned set, and the dashboard lookup β€” goes through github.ReviewQueueKey, which also lowercases (src/pkg/github/review_queue.go:323-325). fixerQueueKey (src/cmd/hive/fixer_queue.go:41-56) qualifies a bare repo with cfg.Project.Org, matching what reconcileDeferredFixQueue does at lines 70-73. No mismatch that would silently evict entries.
  • The eviction-by-plan step does not defeat the feature. My worry was reconcilePlannedFixQueue (called at main_eval_cycle.go:1007 before dispatch) dropping a still-deferred PR because the planner stopped emitting its fix kick. It doesn't: an undelivered fix is stripped from persisted state by ConfirmDelivered (src/pkg/review/dispatch.go:1687ff, the undelivered set), so dispatchFix re-plans it next cycle. And with the default FixerFallbackAfterUndeliverable == 0, reviewFixerAvailability returns nil (main_sweeps.go:275-280), so a busy primary still gets the kick attempt that reaches onDeferred. With fallback opted in, a fully undeliverable fixer becomes a Human hold and the entry is dropped β€” that is the right outcome.
  • Locking. g.mu is a sync.RWMutex (governor.go:251); FixerQueue takes RLock and copies into a fresh map, so the dashboard never aliases governor state. Indexing the nil map returned when the queue is empty is fine in api_review_queue.go:139-142.
  • go build ./cmd/hive ./pkg/governor ./pkg/dashboard passes on the PR head; static/index.html is updated alongside static-src/js/review-queue.js.

One low-severity fidelity note, not a blocker: FixerQueue orders by firstDeferredAt across all fixer lanes (fixer_queue.go:77-78). A PR waiting on fixer A will show PRs waiting on fixer B as "ahead" even though they do not block it, and real dispatch order is per-cycle plan order, not first-deferral time. The UI text "fixer queued, N ahead" is therefore an approximation when more than one fixer lane is configured. Worth a word in the operator docs or a per-agent grouping later if that becomes misleading.

Body says "Fixes #16537" and the diff does deliver what the changelog fragment claims. The previous lane reason was a coverage failure; all three new source files ship with tests in their own packages, so the per-package floors should hold once CI reruns (checks are currently cancelled/skipped on this head).

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

hive/awaiting-ci: rebased onto v5 and resolved conflicts (src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js β€” kept v5's identical display:contents fix; the PR's duplicate commit became empty/dropped); CI pending β€” sweep will merge when green. mobile-shots remains deferred to #16551.


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

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

Evidence bundle `#16553c6fa651` sha256:756b7b8bff2308cbb286097fe1f9df3e314956cabcbc5c805166d6d0a482e38c β€” download from the dashboard or `hivectl review evidence #16553`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Scanner triage at 8ac9094: the only red check, mobile-shots (continue-on-error, not required), fails tracker-header-geometry "row 15 caption and icons are horizontally centred" at every viewport ≀ 1100px β€” identical on #16541 and #16554, none of which touch the probe. Shared incident #16551 (reopened); probe fix is in #16554 @ b4cd0ca. Deferring this check here; no PR-local repair needed.


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

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

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 4, 2026
@hivecommons-hive hivecommons-hive Bot removed the stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it label Nov 4, 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/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 labels Nov 4, 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.

intent-alignment β€” delta re-review at 27756aa (previous head 8ac9094)

Prior findings:

  • Fixed β€” key mismatch (fixer_queue.go:45 / main_eval_cycle.go:577): fixerQueueKey (src/cmd/hive/fixer_queue.go:38-57) now normalises every writer/reader to github.ReviewQueueKey(org/repo, N); Deferred/Delivered (:24,30) and reconcilePlannedFixQueue (:87) use it, matching reconcileDeferredFixQueue (:69-73) and the /api/review/queue lookup. TestFixerQueueBareRepoKicksSurviveReconcileAndMatchDashboardKey (fixer_queue_test.go:136-184) drives a bare Repo: "Repo" kick through three reconcile cycles and asserts the position survives and clears on delivery β€” exactly the gap the previous review named. #16537's acceptance criteria are now met as wired.

Advisory (non-blocking): commit 88403327 changes src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js:274-280 (display:contents wrapper flattening for the chevron-centring probe). .ham-active-ico-wrap lives in tracker-row-strip.js, which this PR doesn't touch, so this is a pre-existing mobile-shots fixture fix unrelated to #16537, bundled to unblock the check that failed at 8ac9094. Acceptable under the PR body's "fix the failing checks" mandate, but worth noting in the squash message so the fixture change is traceable.

β€” hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 4, 2026
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 2026
thatguywob and others added 3 commits November 4, 2026 02:35
Remember the first deferral of each review fix kick in the governor and
remove it on delivery or when enumeration no longer sees the PR open.
Expose optional queue status through the governor and review queue APIs,
and show the number ahead beside the PR's dashboard stage metadata.

Hive-Run: #16537
Hive-Plan: issue-16526/deferred-fixer-queue
Hive-Spec: issue-16537#acceptance-criteria
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
…tries whose PR no longer plans a fix kick

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

Dispatch plans carry pr.Repo as configured (often the bare repo name), so
RecordFixKickDeferred stored "repo#N" while reconcileDeferredFixQueue kept
only ReviewQueueKey("org/repo", N). Each cycle evicted the entry, losing the
first-deferral timestamp, and /api/review/queue's full-key lookup never
matched, so fixer_queue_position was never emitted.

Route Deferred, Delivered and reconcilePlannedFixQueue through one
fixerQueueKey helper that qualifies bare repos with the project org, and
pass cfg.Project.Org from the eval cycle. Adds a regression test that drives
a bare-repo kick through several busy reconcile cycles and checks it stays
queued under the dashboard's key until delivery.

Refs #16537

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@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 Nov 4, 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.

Looks correct to me. Read the diff at c6fa651 plus the callers it depends on:

  • Key agreement β€” the bug #16537 describes (bare repo#N vs org/repo#N) is closed: fixerQueueKey (src/cmd/hive/fixer_queue.go:38-53) qualifies the repo and routes through github.ReviewQueueKey, which lowercases (src/pkg/github/review_queue.go:323-325); the governor lowercases on write (fixer_queue.go:23,45) and the dashboard looks up with the same ReviewQueueKey(entry.Repo, entry.Number) (api_review_queue.go:141). All three writers/readers agree.
  • Planned-reconcile does not self-evict β€” reconcilePlannedFixQueue keeps only PRs the current plan still kicks. That is safe because a deferred kick is never confirmed into dispatch state: persistReviewDispatchState* only confirm deliveredReviewKicks (main_sweeps.go:3044-3059), and onDeferred fires before onReviewDelivered can (eval_cycle_seams.go:612-618). So the planner re-emits the fix kick next cycle and the entry survives, which TestFixerQueueBareRepoKicksSurviveReconcileAndMatchDashboardKey exercises.
  • The empty plan returned when !cfg.Review.RequireApproval || !cfg.Review.FanOut only reaches ReconcileFixerQueue with an empty keep set in configs where no fix kick can exist, so it clears nothing real.
  • Locking is consistent with the rest of Governor (mu sync.RWMutex, governor.go:251); FixerQueue() returns a fresh map, so the dashboard never aliases governor state.

Per #16537 the decision was "expose it additively as optional fields … on the existing governor endpoint"; the PR does that (fixer_queue on /api/governor/pr-models) and additionally flattens the two fields onto /api/review/queue items, which is what the hint needs. Both omitempty, so existing consumers are unaffected as the issue requires. Blocker #16536 is closed.

One docs gap, not a blocker: src/docs/api-reference/agents-and-controls.md:26 enumerates the per-entry fields of /api/review/queue (pending_since, redispatch_count, stage{…}), and the same table describes /api/governor/pr-models. Neither row mentions fixer_queue_position / fixer_queue_ahead / fixer_queue. Worth a line in each so operators reading the reference know the hint's source.

Checks: everything green except tide (pending, expected); the two CANCELLED rows are superseded runs from the earlier head.

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

@hivecommons-hive
hivecommons-hive Bot merged commit 2cfe645 into v5 Nov 4, 2026
87 of 90 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the hive/adopt-16546 branch November 4, 2026 07:53
@github-actions

github-actions Bot commented Nov 4, 2026

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

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 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/XL Denotes a PR that changes 500-999 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.

[scanner] Governor: per-PR deferred fix-kick queue position + dashboard 'fixer queued, N ahead'

1 participant