Skip to content

πŸ› fix: align standby qualification with dispatch queue - #16436

Closed
mrbobbytables wants to merge 2 commits into
hivecommons:v6from
mrbobbytables:fix/16420-standby-lane-split
Closed

mrbobbytables wants to merge 2 commits into
hivecommons:v6from
mrbobbytables:fix/16420-standby-lane-split

Conversation

@mrbobbytables

@mrbobbytables mrbobbytables commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make the standby tile qualify contributors against the same dispatchable admission queue standby dispatch reads, filtering to the exact lane and excluding held items. Add regression coverage and clarify the S7 design note.

Related issues

Fixes #16420

Testing

  • Not run locally: CI runs validation for agent-authored PRs (per AGENTS.md; local Go tests/build are prohibited in agent panes).
  • Other / manual verification: gofmt formatting check (passed); git diff --check (passed).

Contributor checklist

  • Changelog (required when src/ code changes, or CI fails): added changelog.d/fixed-16420-standby-lane-count.md containing one - bullet.
  • PR targets the correct release line (v6 for this dashboard-optional-operation issue).
  • Title uses the repo emoji convention: πŸ› fix: ....
  • Commits include DCO sign-off (git commit -s).
  • Docs, examples, and policies are updated when behavior changes: updated the S7 design description.
  • No secrets, credentials, or local runtime state are committed.

β€” hive: backend=copilot model=gpt-6-luna

mrbobbytables and others added 2 commits November 3, 2026 16:19
Use the dispatchable admission queue and exact lane assignment when computing standby qualification counts.

Hive-Run: hivecommons#16420

Hive-Plan: standby-contributors

Hive-Spec: standby-contributors#S7

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
Document that qualified standby counts use the dispatchable queue and exact lane assignment.

Hive-Run: hivecommons#16420

Hive-Plan: standby-contributors

Hive-Spec: standby-contributors#S7

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 3, 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

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

Intent alignment (read at head 7511fe1): the diff does what #16420 asked via the issue's own third option β€” standbyLaneItems now reads the dispatchable admission queue and applies the identical Held / EqualFold(TrimSpace(Lane)) filter that standbyDispatchItem uses (src/pkg/dashboard/contribute_ws.go:3147-3149 vs contribute_standby_dispatch.go:198-209), so "M qualify" can no longer name a contributor for an item the lane cannot dispatch. No lock hazard: UpdateStatusIfFresh holds no statusMu at the call (server.go:2426-2434) and admissionQueueSnapshot only RLocks it (contribute_sse.go:305-307). Two advisory notes, neither blocking:

  1. "N waiting" and "M qualify" now come from different splits. lane_queue_depths is untouched (status_builder.go buildLaneQueueDepths), so the issue's exact scenario now renders scanner: 1 waiting, 0 qualify β€” the item is still shown as waiting on a lane that can't dispatch it. The issue accepted this trade-off ("standby could use the admission queue's lane instead of reusing that depth") and the S7 doc edit (src/docs/design/standby-contributors.md:725-728) states it, so this is backlog, not a blocker.

  2. One-refresh lag. admissionQueueSnapshot reads h.server.status β€” the previously published snapshot β€” not the status being built (contribute_sse.go:305-311), so qualified_standbys reflects the prior refresh's repo list and is 0 on the very first publish. Dispatch reads the same source, so tile and dispatch still agree; just noting the source differs from the rest of the payload.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

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

Correctness review @ 7511fe1 β€” the diff is internally consistent (standbyLaneItems now applies the same Held / EqualFold(TrimSpace(Lane)) filter as standbyDispatchItem, contribute_standby_dispatch.go:197-210), but it does not fix the symptom #16420 reports in the default configuration.

1. M qualify is unchanged unless an item-tier list is in force (high, in-scope)

QualifiedStandbyCounts feeds the per-lane items through itemTiers.LaneQueue(...) (contribute_ws.go:3101). When hub.standby_item_tiers is empty β€” the shipped state, and nothing in #16420 says the reporter set one β€” LaneQueue returns exactly one empty match and does not look at the items at all (pkg/standby/item.go:166-172, InForce at item.go:114). QualifiedCountForQueue then counts every contributor who meets the lane floor (match.go:194-205). So on the reporter's hive the tile still reads scanner … 1 qualify while POST /api/contribute/standby/dispatch {"lane":"scanner"} still returns no dispatchable standby item in lane "scanner". The new item source only matters for owners who have opted into S7 item tiers; "Fixes #16420" is not met for everyone else.

Concrete fix β€” short-circuit the count when the lane has no dispatchable item, independent of item tiers (this is what the issue's "Expected" asks for):

--- a/src/pkg/dashboard/contribute_ws.go
+++ b/src/pkg/dashboard/contribute_ws.go
@@ func (h *ContributeWSHub) QualifiedStandbyCounts(
 		if standbyCfg == nil || !standbyCfg.IsStandbyEnabled() {
 			continue
 		}
+		// No dispatchable item routed to this lane: nobody can be offered
+		// anything, whatever their tier (#16420). laneItems is nil only when
+		// no queue has been projected yet; an empty slice means "none".
+		if laneItems != nil && len(laneItems[lane]) == 0 {
+			out[lane] = 0
+			continue
+		}
 		policy := standbypkg.LanePolicy{

and a regression test in standby_qualified_test.go that builds a hub with no StandbyItemTiers, one T2 standby on scanner, and a queue whose only item is Lane: "guide", asserting QualifiedStandbys["scanner"] == 0. The existing TestStandbyLaneItemsUsesDispatchableQueue only exercises the projection helper, not the count the tile shows.

2. N waiting still comes from the broader split (medium, in-scope)

The tile's N is lane_queue_depths from buildLaneQueueDepths (status_builder.go:1872-1891), which this PR leaves counting every issue for scanner and unrouted issues for every lane. The updated design note (standby-contributors.md:726-728) now documents that N and M are computed over different item sets, so scanner: 1 waiting, 0 qualify becomes the steady state for the reporter's case β€” an improvement, but the issue asks that both numbers count "only the items the lane can dispatch". Either derive the standby tile's N from the same standbyLaneItems lengths (e.g. a Governor.StandbyQueueDepths field) or state in the PR body that N is intentionally left as the triage-cadence depth.

3. Minor (low, in-scope, non-blocking)

admissionQueueSnapshot reads the previously published s.status.Repos (contribute_sse.go:305-312), while UpdateStatusIfFresh is building the next one (server.go:2429), so qualified_standbys lags lane_queue_depths by one build cycle. It also never returns a nil queue (contribute_sse.go:289), so the queue == nil branch in standbyLaneItems and its assertion at standby_qualified_test.go:156 cover an unreachable production path; with the fix in Β§1 the nil-vs-empty distinction becomes load-bearing and is worth a comment.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Superseded by hive: re-authored as #16450 with the same commits and sign-off because the author's clanker is offline. This PR is closed; if #16450 fails, hive reopens it.

@hivecommons-hive hivecommons-hive Bot added the hive/superseded Closed by Hive: a different merged PR already landed this change label Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot closed this Nov 3, 2026
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. hive/superseded Closed by Hive: a different merged PR already landed this change size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v6] πŸ› standby tile counts an item for a lane that dispatch then refuses (lane split mismatch)

1 participant