Repository navigation
π [v6] army: stop attributing adopted PRs to a remote agent's rework queue and show why a fix is not dispatched - #17857
Conversation
β¦ and show why a fix is not dispatched (#17853) The contribute fleet card listed every stage-store record by author in 072 or 074 as the relay's pending rework, so merged/closed PRs still carrying stage/074-adopted-by-hive (the store prunes them only after 14 days) and PRs the hive had taken over piled up as '33 PRs awaiting rework'. Only open, not-adopted, not-dispatched PRs count now: the forge cache decides open vs merged/closed when it knows the PR, otherwise a record the stage lane has not re-observed for an hour is treated as gone. A queued fix whose PR is gone leaves the fix queue instead of being handed to the relay. The idle-with-queue stall: a fix dispatched to a socket that dropped stays booked in flight with nobody holding it, so capacity 1 is busy forever and the relay gets neither the fix nor new work (task_unavailable fix_pr_in_flight, which the card hid behind 'idle Β· N awaiting rework'). The relay's next ready now releases such orphans (no attempt counted) and a task_complete for the dispatch on a reconnected socket settles it. The card prints the dispatcher's actual reason (pending_rework_blocked) instead of 'not yet dispatched', and links at most three PRs inline with the rest behind a show-N-more disclosure. Signed-off-by: Andrew Anderson <andy@clubanderson.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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
There was a problem hiding this comment.
Read the diff against v6 at 7f27bba plus the callers (contribute_select.go:487-498, contribute_ws.go:2255-2276, contribute_ws.go:4474, contribute_fleet.go:250-380). The change does what the body says, and the two lock-ordering questions it raises check out. Looks correct to me; two low-severity open questions for the author, neither blocking.
Verified
releaseOrphanedFixesβheldFixTaskIDstakesh.mu.RLockand everyc.mu(contribute_fixqueue.go:707-734). BothselectTaskcallers reach it withh.mureleased (contribute_ws.go:2267-2276unlocks before the call) and noc.muheld (repoScopeGateReasonatcontribute_select.go:489locksc.muitself first, so a heldc.muwould already deadlock there). No self-deadlock.FleetSnapshotgathersheldFixin its own pass before any row'sc.muis taken (contribute_fleet.go:264-280), sofleetReworkFornever holds two connection locks at once.forgetFixOwner/fixQueueMuis a leaf lock (contribute_fixqueue.go:404-410).completeFixTaskfallback (contribute_fixqueue.go:665-690) settles a dispatch the current socket never saw by matchingsched.InFlight(user)ontaskIDβ the 1006-flap case in the body.fixqueue.Release(fixqueue.go:379-387) sharesunwindwithRequeue/Returnand leavesAttempts/NotBeforeuntouched, as documented;TestReleaseReturnsDispatchWithoutAttemptcovers it.- Signed-off, changelog fragment present,
contributor-relay.md/stage-labels.mdupdated forpending_rework_blocked.
Open questions (low)
fleetReworkFornow mutates on a read path:sched.Remove+forgetFixOwnerfrom the dashboard snapshot (contribute_fleet_rework.go:316-322) wheneverreworkCandidateOpensays the PR is gone. Where neither the open-PR index vouches nor the forge cache knows the PR, that decision falls toowedRework's unseen bound (contribute_fleet_rework.go:160-172), so a PR the stage lane merely stopped observing for an hour is dropped from the fix queue, not just from the card. The body says the re-nudge path re-queues it, so the consequence is a delayed fix rather than a lost one β worth confirming that is intended for the queue and not only the display.- Narrow race:
dispatchFixesHeldbookssched.Dispatch(contribute_fixqueue.go:~461-463) before it writesc.fixTasks[d.ID](:588-591). A secondreadyfrom another live socket of the same user in that window sees the dispatch in flight but unheld andReleases it, so the same PR could be served twice. Requires two concurrentreadys for one user; probably acceptable for a max-parallel-1 relay, noting it so the reasoning is on record.
I have not approved or changed anything; a maintainer should sign off.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the diff against the Body claims a UI change this diff does not contain. The body's "UI: at most 3 links inline, the rest behind Verified on the Go side
One side-effect note, not a defect: |
Mutation testingHead β±οΈ The 900s mutation budget ran out, so 1 package(s) were not fully mutated and the results below do not cover them:
β gremlins did not produce a report for 1 package(s), so no verdict can be derived from this run (see the job log):
Verdict: |
Bug
The dashboard "Your army" card showed a remote agent (
Karibhou, omp, max parallel 1, preempt) asidle Β· 33 PRs awaiting rework (not yet dispatched) Β· fix queue 1: hive#17739, β¦β a red wall of ~33 links, ~27 annotated adopted by hive, many for PRs that are long closed or merged (hive#15029 and #15086 are CLOSED since 2026-10-28, #17739 MERGED, hivecommons.github.io#373 CLOSED).Root causes
fleetReworkForbuilt the list from every stage-store record by author in072-returned-to-contributorand074-adopted-by-hive, with no open-state check. Stage-store records for merged/closed PRs are neverForget-ed when a PR leaves the open listing (only on terminal verdicts) and age out solely viaPrune(14d), so closed PRs still carryingstage/074were listed and counted for two weeks, and PRs the hive had taken over were still attributed to the relay.fixqueue.Scheduler, but the connection that holds them (c.fixTasks) is per socket. When the socket drops (1006 flaps), the dispatch stays "in flight" with no holder:Dispatch/DispatchAtBoundaryrefuse (capacity 1 busy), andselectFixTaskanswerstask_unavailable fix_pr_in_flightβ the relay gets neither the fix nor new work, forever. The card hid the idle reason behindidle Β· N PRs awaiting rework.Fix (per Andy's clarified spec)
ForgeState().PR(...).Open()); when the cache does not know the PR, a stage record the lane has not re-observed for an hour is treated as gone. Adopted (074) PRs are dropped β they are the hive's. A queued fix whose PR is merged/closed is removed from the fix queue.pending_rework_blockednames the dispatcher's actual reason (offline, nofix_pr_interrupt_v1, scope not acknowledged, not queued, orphaned in-flight dispatch, backoff, focus window, slots busy, awaitingready), with the relay's last idle reason appended.fixqueue.Release) at the relay's nextready; atask_completefor such a dispatch arriving on a reconnected socket settles it.<details class="clanker-rework-more">show N more</details>(open state persisted inccOpenPanes); tokens only, no new deps.Tests
Go: adopted/merged/closed/unobserved excluded and removed from the queue; authored+open+072 included; blocked-reason strings (offline, orphan β released at ready); completion on a reconnected socket;
fixqueue.Release. JS harness: block-reason render, 5 pending β 3 inline + "show 2 more", open-state persistence, β€3 no disclosure. Docs (contributor-relay.md,stage-labels.md) and changelog fragment updated.Top-up of #17853 (v5 β v6). On v6 the existing open-PR index from #14715/#17412 stays the primary open-state source; the forge cache and the
pendingReworkUnseenBoundfallback decide where the index cannot vouch for a repo. Adopted (074) PRs are dropped per Andy's clarified spec; the v6 tests that expected them listed were updated accordingly.fixqueue.Releasesits beside v6'sReturnon the sharedunwind.