Skip to content

πŸ› fix(relay): accept standby assignments from any hub that acknowledged standby - #16462

Merged
hivecommons-hive[bot] merged 1 commit into
v6from
scanner/fix-16422
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v6from
scanner/fix-16422

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The task_assign active-polling-slot guard was written for work the relay requested via ready. A standby assignment (standby_lane) is instead pushed by the hub that acknowledged this relay's standby, and in a multi-hub relay that hub is never the active polling slot (standby doesn't poll), so the relay wrongly failed the task. Now the relay records per-hub standby acks (accepted > 0) and accepts standby_lane assignments from such hubs; non-standby assignments are still rejected. Test added.

Closes #16422

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

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: onkar717 <144542684+onkar717@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 3, 2026
@kubestellar-prow kubestellar-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label 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 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

@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

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

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

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

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

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

Read the relay at d49f1c9 plus the hub side. This looks correct to me.

What I verified

  • The hub really does mark standby pushes: TaskAssign.StandbyLane (src/pkg/dashboard/contribute_ws.go:610, :844) is set in both dispatch paths (contribute_standby_dispatch.go:296, :361) and is omitempty, so ordinary assignments never carry it. The new guard at bin/contributor-relay.js:9734 keys on a real field, and non-standby work from a non-active hub still hits the existing rejection at :9735-9738.
  • declareStandby (:9503) runs from auth_ok (:9602), so each (re)connection re-sends standby_declare and the hub's standby_ack re-derives hub.standbyAcked (:9710) β€” a hub that rejects every lane (accepted === 0) drops back to false.
  • Ran the new test locally: passes at this head; with standbyPush forced to false it fails (pass 0 / fail 1), so it exercises the change.

One open question (low, not blocking): hub.standbyAcked is not cleared in the disconnect/profile-switch reset at :2701-2703 alongside authenticated/readyOutstanding. If a hub reconnects without standby_v1 in server_capabilities, declareStandby returns early (:9505) and the stale true survives, so a standby_lane assign from that hub would still be accepted. In practice such a hub would not be dispatching standby work, so I'd treat this as a tidy-up (reset it at :2702) rather than a defect.

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

Read the relay at d49f1c9 plus the hub side; this looks correct to me.

What I verified

  • The hub does tag donated assignments: src/pkg/dashboard/contribute_ws.go:844 (StandbyLane string \json:"standby_lane,omitempty"`), so msg.standby_lane` is a real signal, not a relay-only convention.
  • The new bypass is narrow. refuseOutOfScopeAssignment (bin/contributor-relay.js:9724) and hub.disabled still run before it, and the currentTask / isGivenUp rejections still run after it β€” only the active-polling-slot check (:9735) is relaxed, and only when standby_lane is set and this hub returned accepted > 0 in standby_ack (:9710).
  • Stale standbyAcked across a reconnect is harmless: auth_ok re-runs declareStandby(hub) (:9602), so the next standby_ack overwrites the flag, and a hub cannot push standby_lane work to a relay it has no standby registration for anyway.
  • After acceptance activeHubIndex = hubs.indexOf(hub) (:9837) β€” in standby mode requestWork is suppressed (:2325-2329), so this does not start the standby hub polling.

Test: ran bin/contributor-relay.test.js against base v6 β†’ 789/790 passed, the new #16422 test the only failure; at this head β†’ 790/790 passed. The test also asserts a non-standby assignment from the same hub is still rejected.

No changes requested.

Evidence bundle `#16462d49f1c9` sha256:c4e6a83639d29cc430d3ca7d6e179dc484d474e2afe9e0ac7d2931ba3010eb8c β€” download from the dashboard or `hivectl review evidence #16462`.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16378 🌱 Top up v6 with the latest v5 snapshot same files bin/contributor-relay.js
bin/contributor-relay.test.js

@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 stage/050-review-pending Review swarm requested; awaiting a verdict for the current head role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) labels Nov 3, 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.

Security perspective (read head d49f1c9, bin/contributor-relay.js and the new test).

The bypass is gated correctly: refuseOutOfScopeAssignment(hub, msg) (bin/contributor-relay.js:9727) still runs before the new standbyPush check (:9734), so repository scope is enforced on standby pushes, and standbyAcked is only set from a standby_ack frame (:9710). No trust-boundary regression.

Advisory (low): hub.standbyAcked is never cleared where the other per-connection flags are. The close handler (:10178-10179) and the profile-switch teardown (:2701-2702) reset authenticated/readyOutstanding but leave standbyAcked true. declareStandby on the reconnect's auth_ok (:9602) returns early without re-declaring if the hub no longer advertises standby_v1 (:9505-9508), so a hub that acked standby in a previous session keeps the ability to push standby_lane work past the active-slot guard after reconnecting. Suggest hub.standbyAcked = false alongside the authenticated = false resets at :2701 and :10179.

β€” hive: agent=adjudicator-2 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) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 8dcf9f8 into v6 Nov 3, 2026
84 of 93 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16422 branch November 3, 2026 20:21
@github-actions

github-actions Bot commented Nov 3, 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v6] πŸ› multi-hub standby relay rejects donated work: hub is not the active polling slot

0 participants