Repository navigation
π [v6] relay: a fix for your own PR is taken from any hive you subscribe to, and a polling-slot refusal no longer counts as a failed attempt - #17405
Conversation
β¦fusal is not a failed attempt On projectbluefin/utah-packages#972 (2026-11-09) the projectbluefin hive sent Karibhou's relay a fix-pr preempt at 14:42:58Z. The relay accepted it and deferred it behind its headless primary, then refused it with "Hub is not the active polling slot" at 14:45:39Z, the moment the primary ended, because its polling slot was on another hive. The hub booked attempts=1 and a five-minute retry. - Relay: the task_assign polling-slot gate lets a fix-pr through from any subscribed hub (as it already does for an acknowledged standby push). The ordinary path then makes that hub active and the busy_elsewhere_v1 report tells the other hives. - Hub: a fix-pr task_failed with that reason is requeued with the same backoff but no attempt counted (new fixqueue.Scheduler.Return), so refusals from older relays never hand the PR to adoption. 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>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Evidence bundle `#17405a1a126a` sha256:550adc76474fd86b9b584ef0b5dd173889fbeb1816dbb22ed12f3239e5bb87ca β download from the dashboard or `hivectl review evidence #17405`.Review findings from Read the diff against the v6 tree and the callers it lands in. Looks correct to me. Relay ( Hub ( Overlap with #17403: confirmed a trial One open question, not a defect: there is no TTL on a queued fix ( |
There was a problem hiding this comment.
Style/maintainability pass at head a1a126a. No blocker; two advisory notes, worst first.
1. The hub now routes on a free-text reason string that the relay owns, with no marker on the relay side β src/pkg/dashboard/contribute_fixqueue.go:577 (relayRefusedNotActiveSlot) / :584 (strings.EqualFold(strings.TrimSpace(msg.Reason), β¦)) vs bin/contributor-relay.js:10009, where the same sentence is an inline literal. The protocol already has a typed discriminator for exactly this (contribute_protocol.go:518-531, whose comment names "routing on a value the client controls" as the hazard), and the relay already sends failure_kind on its other refusals (contributor-relay.js:9984, :9992). The hub-side constant documents the coupling; the relay side does not, so a wording tweak at :10009 (punctuation, "hive" for "hub") silently reinstates the attempt-counting the PR fixes. The string match has to stay for older relays, but the relay literal should be a named constant with the cross-reference, so the next editor sees the contract:
const fixPush = msg.kind === FIX_PR_KIND;
if (!currentTask && !standbyPush && !fixPush && hub !== hubs[activeHubIndex]) {
console.log(`Rejecting task ${taskDisplay(msg)} from ${hub.url} β hub is not the active polling slot`);
// Matched verbatim by the hub (src/pkg/dashboard/contribute_fixqueue.go,
// relayRefusedNotActiveSlot) to requeue a fix-pr without counting an
// attempt; change both sides together.
sendTo(hub, { type: 'task_failed', seq: nextSeq(), task_id: msg.task_id, reason: NOT_ACTIVE_SLOT_REASON });
break;
}
with const NOT_ACTIVE_SLOT_REASON = 'Hub is not the active polling slot'; next to FIX_PR_KIND at bin/contributor-relay.js:1363.
2. failFixTask duplicates its tail in the new branch β contribute_fixqueue.go:542-553 repeats the len(...) == 0 "fix-pr task failed" log (:547-549 vs :555-557) and h.pulseFixFailed (:551 vs :569). The only real differences are which scheduler method runs and whether the max-attempts check applies. One shape keeps them in step:
- if relayDidNotTakeFix(msg) {
- // ...
- returned := sched.Return(user, msg.TaskID, fixTaskRetryBackoff)
- for _, it := range returned { h.logger.Info(...) }
- if len(returned) == 0 { h.logger.Info("[contribute-ws] fix-pr task failed", ...) }
- h.pulseFixFailed(msg.TaskID, reason)
- return true
- }
- requeued := sched.Requeue(user, msg.TaskID, fixTaskRetryBackoff)
+ // A polling-slot refusal means the relay never started the fix: it goes
+ // back without an attempt and can never reach fixTaskMaxAttempts.
+ notTaken := relayDidNotTakeFix(msg)
+ requeue := sched.Requeue
+ if notTaken {
+ requeue = sched.Return
+ }
+ requeued := requeue(user, msg.TaskID, fixTaskRetryBackoff)
if len(requeued) == 0 {
h.logger.Info("[contribute-ws] fix-pr task failed", ...)
}
for _, it := range requeued {
- if it.Attempts >= fixTaskMaxAttempts {
+ if !notTaken && it.Attempts >= fixTaskMaxAttempts {Also worth a clause in the failFixTask doc comment (:517-522), which still says every failure counts toward fixTaskMaxAttempts.
Scope note: I did not run the Go or relay tests; they read as covering the stated cases.
β hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Summary
A relay subscribed to several hives refused a
fix-prtask for its contributor's own PR because it happened to be polling another hive, and the hub counted that refusal as a failed fix attempt. On projectbluefin/utah-packages#972 the relay had already accepted the fix and deferred it behind a headless task; when that task ended it refused the fix withHub is not the active polling slot. With this PR the relay takes afix-prfrom any subscribed hive (making that hive active and telling the others it is busy elsewhere), and the hub puts a fix refused for the polling slot back in its queue without booking an attempt. Ordinary work from a hive the relay is not polling is still refused.What went wrong
From the projectbluefin hive's log (build 467557e; nothing in these files changed between it and the v6 tip apart from #17402), checked against the PR on GitHub:
Karibhou/utah-packages.fix-karibhou-1to the relay,mode=preempt priority=interrupt. The relay was running a task, so the fix was handled as an interrupt. With a headless primary the relay defers it and sendstask_accepted.pr-review-1794235343201task ended (the hub logged itstask_completeas an unassigned task). In the same second the hub loggedfix-pr task failed; requeued ... attempts=1 retry_after=14:50:39Z reason "Hub is not the active polling slot".That is
startDeferredFixre-entering thetask_assignhandler for the hub that owns the fix. With no task running, the handler refuses any assignment from a hub that is nothubs[activeHubIndex], and the relay's polling slot was on another hive. So a fix the relay had already accepted was thrown away at the moment it should have started. The same gate refuses a fix-pr interrupt pushed to an idle relay that is polling another hive.On the hub,
failFixTasktreats everytask_failedfor a fix as a failed attempt. Three of them remove the PR from the fix queue and hand it to the stage engine's re-nudge and adoption path, although the relay never tried the fix.What changes
task_assignhandler lets afix-prthrough from any subscribed hub, the same way it already lets an acknowledged standby push through (π fix(relay): accept standby assignments from any hub that acknowledged standbyΒ #16462). The ordinary assignment path that follows sets that hub as the active one, and since the task's_hubis that hub, thebusy_elsewhere_v1report (π [v6] contributor-first: a relay busy for another hive does not cover this hive's laneΒ #17402) tells every other hive the relay is busy. That covers both a deferred fix starting after a headless task and a fix pushed to an idle relay.task_failedwhose reason isHub is not the active polling slotgoes back in the queue with the same backoff, and its attempt count is left unchanged (newfixqueue.Scheduler.Return). Older relays still send that reason, so their refusals never move the PR toward adoption. Every other failure is counted as before.Out of scope: Canary itself and merge policy.
Files
bin/contributor-relay.js: thefix-prexemption in the polling-slot gatesrc/pkg/fixqueue/fixqueue.go:Return(a requeue that keepsAttempts)src/pkg/dashboard/contribute_fixqueue.go:failFixTaskusesReturnfor a polling-slot refusalsrc/docs/contributor-relay.md(multi-hive section),changelog.d/fixed-fix-pr-any-hub.mdbin/contributor-relay.test.js,src/pkg/fixqueue/fixqueue_test.go,src/pkg/dashboard/contribute_fixqueue_test.goTests
No tests were run locally (repo policy); CI is the check. Why each fails on the v6 tip:
#972 a fix-pr pushed by a non-active hub to an idle relay is taken, and the other hive hears busy_elsewhere: two hubs, the slot on hive A, a fix-pr from hive B. On the tip hive B getstask_failed: Hub is not the active polling slotand the relay stays idle. Now the fix becomes the current task owned by hive B, hive A gets onebusy_elsewherebusyframe, and finishing the fix clears it.#972 a fix-pr deferred behind a headless primary runs when the primary ends, even with the polling slot on another hive: the live sequence. The fix is accepted and deferred behind a localpr-reviewtask, thenrequestWork(hive A)starts it. On the tip that start is refused with the polling-slot reason.#972 the polling-slot refusal still applies to ordinary work from a non-active hub: an issue task from hive B is still refused (passes on the tip too; it guards the narrow scope).TestReturnKeepsAttempts(fixqueue):Returnrequeues with the backoff andAttempts0, and a later real failure counts 1.Returndoes not exist on the tip.TestFixQueuePollingSlotRefusalIsNotAnAttempt(dashboard): four polling-slot refusals in a row leave the PR queued with 0 attempts, and a real failure afterwards counts 1. On the tip the first refusal booksAttempts=1, and the third removes the PR from the queue.This PR and the open #17403 touch nearby lines in
contributor-relay.jsandcontribute_fixqueue.go; a trial merge of the two heads is clean.Refs projectbluefin/utah-packages#972
π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1