Repository navigation
π fix(mergelane): keep a sweep PR whose writes are contained off the front - #16059
hivecommons-hive[bot] merged 2 commits into
Conversation
β¦front Writeback containment (3876bf8) gates the lane's branch update and merge for unsolicited paths: at L6 an auto-promoted contributor PR without hive-review is refused both. The sweep still put such PRs at the front, where every round held on "merge call failed ... unsolicited write suppressed" (or "branch update failed: ...") until the 60m front timeout, one PR after another, while owner-queued PRs waited. Before Acquire, an unsolicited path now asks the same containment (RESTGitHub.PathCanWrite, via the optional PathWriteChecker capability). A refused PR takes no lane place and is not recorded, so repeated sweeps cause no front churn; one already in the lane is released once (a front promotes the next waiter). Admitted waiters are not re-checked until they reach the front. Queue, relay and dashboard paths are not asked. 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 |
|
@Danathar this PR is back in your court ( Failing checks:
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 (2 waiting): fixes are handed out before new work as soon as you have capacity. |
|
hive/shared-ci: the only red check here, π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read pkg/mergelane/gate.go and lane.go at this head, and the v6 tree it sits on. This looks correct to me.
Mechanism verified, not inferred. round.update (src/pkg/mergelane/lane.go:777-783) turns any UpdateBranch error other than ErrHeadMoved into r.hold(...), and RESTGitHub.allowWriteback (gate.go:394-409) refuses unsolicited writes with writeback.ErrSuppressed under contributor_adopt. So before this change a suppressed PR did take the front and sat there until the front timeout, exactly as the body describes.
The fix is placed correctly. pathWriteSuppressed runs before Acquire (gate.go:63-66) and only when !method.solicited, so the lgtm/relay/dashboard paths are untouched and FrontOnly requests return earlier at gate.go:51. PathCanWrite (gate.go:415-421) calls the same allowWriteback with the same laneWriteKind constant that UpdateBranch (gate.go:342) and Merge (gate.go:432) use, so the pre-check and the enforcement cannot drift. The waiter short-circuit at gate.go:102 means admitted waiters cost no extra read; refuseSuppressedPath only calls Release for a PR actually in the lane, and Release (lane.go:280-300) ends a front and promotes the oldest waiter, so the audited-once claim holds.
Only the unsolicited-path case is new; the solicited path and the round's hold-on-error behaviour are unchanged.
One cost note for whoever merges, already stated in the body: a suppressed PR that is new to the lane now costs one WritebackItemForNumber read per sweep instead of taking the front. That is the right trade.
The owner-policy question the body raises (should the /hive merge relay be able to merge an unqueued auto-promoted contributor PR at L6?) is outside this diff and is not changed by it; it is worth a separate issue rather than a blocker here.
I have not approved or merged anything; this is a comment only.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Security perspective (read at head a1643f0). The pre-check is sound as a containment check: One trust-boundary regression (in-scope, medium): Suggested fix (in A test mirroring Review findings from Correctness review (head a1643f0) β approve, one advisory edge case. Operator pause now evicts sweep-path PRs from the lane (low, advisory). Either way, a test pinning the paused-repo behaviour would be worth adding. Info: "nothing is written" holds for GitHub, but |
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.
Security re-review at ef8ce56 (delta from a1643f0 is only Merge branch 'v6'; the PR's own change is unchanged).
Still present β an unsolicited sweep call can evict a front that a solicited path admitted.
Lane.Merge runs pathWriteSuppressed for every unsolicited caller (src/pkg/mergelane/gate.go:66-70). The check only exempts waiters (gate.go:108); when rec.Front.PR == pr it asks PathCanWrite regardless of which path put that PR at the front. refuseSuppressedPath then releases the front (gate.go:131-134). The record does know the admitting path (store.go:41 Front.Path), but it is never consulted.
Consequence: an owner-queued PR (admitted via PRAuditPathQueue, which allowWriteback deliberately lets through, gate.go:429-437) is at the front; a sweep lane that also accepts the PR calls Merge with PRAuditPathSweep; containment refuses the sweep path (e.g. no hive-review label under contributor_adopt), and the solicited front is released and re-queued behind every other waiter on the queue path's next call. The unsolicited path thereby overrides a solicited admission β the opposite of the containment boundary the PR is trying to respect. suppressed_path_test.go has no case where a queue-admitted front receives a sweep call (TestSolicitedFrontStillUpdatesAndMerges only drives the solicited path itself).
Proposed fix β only check a front that an unsolicited path admitted:
if rec.Front != nil && rec.Front.PR == pr {
if p := rec.Front.Path; p == ghub.PRAuditPathQueue || p == ghub.PRAuditPathRelay || p == ghub.PRAuditPathDashboard {
return ""
}
} else if rec.waiterIndex(pr) >= 0 {
return ""
}
(at gate.go:108-110; consider lifting the three-path predicate at gate.go:64 into a solicitedPath(string) bool helper so both sites share it), plus a test: queue-admitted front, checker refusing everything, sweep call β Deferred/Waiting, front unchanged.
The other two prior (correctness) notes β pause-driven eviction at the old gate.go:109 and per-sweep suppression records at PathCanWrite β are also unchanged by this delta; they are the correctness perspective's to re-state.
β hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@Danathar this PR is back in your court ( Review asks:
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 (3 waiting): fixes are handed out before new work as soon as you have capacity. |
Summary
A PR that only an automerge sweep lane would merge, and whose branch update and merge are both refused by writeback containment, no longer takes the serialized-lane front. A typical case is an auto-promoted contributor PR without
hive-reviewat L6./hive mergerelay and dashboard paths are not asked, and behave exactly as before.The bug
Seen live on hive-wild-mole (build ba77df2), on Danathar/hive-lane-sandbox at L6 with
hive-serialized:contributor-lane admitted β¦ contributor-lane:auto-promoted), and none was queued.merge call failed; no merge assumed this round: writeback: unsolicited write suppressed: #N carries none of hive-review; contributor_adopt needs the label at L6.branch update failed: writeback: unsolicited write suppressed β¦.front timeout after 1h0m0sexits between 2026-10-30T19:14Z and 2026-10-31T14:22Z, and no merges.pkg/mergelanehas no changes between ba77df2 and v6 6f6a5ca. Why, at 6f6a5ca:Lane.Merge(gate.go:39) callsAcquire(gate.go:59) for any path. It marks only queue, relay and dashboard as solicited (gate.go:65).RESTGitHub.allowWriteback(gate.go:328) refuses bothUpdateBranchandMergewithwriteback.ErrSuppressedundercontributor_adopt(min L6, label required). This containment is deliberate: 3876bf8, "preserve v6 flows under merged writeback rules".lane.go:783for the branch update,lane.go:821for the merge). The PR has the front, but its path can never write, so it holds until the timeout.automerge_contributor_lane.gohas no writeback check, which is why this only shows up onhive-serializedrepos.The alternating "no merge-path authorization was supplied"
This is a different cause, made visible by the same front. The rounds come from a different sweep lane:
not-app-authored(the logs showautomerge skip β¦ not-app-authoredright before those rounds).rejectBeforeLanethen hands its front to the lane front-only (π bug(v6): serialized lane keeps a red front PR for the full 60-min timeout β sweep skips it as not-mergeable and never releases itΒ #11023), and that round runs without an authorizer by design (advanceRejectedFrontpasses nil).finalCheck, which holds onr.authorize == nil(lane.go:728).With this fix such a PR never holds the front, and a front-only hand-off for a PR that isn't the front is a no-op with no GitHub calls. So those rounds stop as well. I left the front-only design alone. A path that rejects a PR only for routing (
not-app-authored) still re-reads the current front every sweep. That's harmless, but worth knowing.The fix
Before
Acquire, an unsolicited path asks the same containment that its writes would meet.RESTGitHub.PathCanWriterunsallowWritebackwith the lane's write kind, without writing anything.laneWriteKind, shared byUpdateBranch,MergeandPathCanWrite, so the check and the enforcement can't drift apart.PathWriteCheckercapability.Then:
errors.Is(err, writeback.ErrSuppressed)) βrefused, with the reasonthe sweep merge path cannot update or merge this pull request, so it takes no lane place: <containment detail>.FrontOnlyrequests never reach the check.Cost: one
Issues.Getper unsolicited call for a PR that is new to the lane, at the front, or refused. That is the same read the lane's merge call already made each round.Why not leave the front on
ErrSuppressedinstead. That was the brief's other option, and it gives exactly the churn the brief warned about. The PR leaves, its sweep lane re-admits it on the next pass, it reaches the front again, and it leaves again. A solicited path's write can also be suppressed by an operator pause, and leaving there would make queued PRs churn during a freeze. Refusing before the PR takes a place keeps it out for as long as containment refuses it, and leaves the round's hold-on-error behaviour unchanged.Owner policy question, noted and not changed: at L6 the
/hive mergerelay is solicited, so the scanner's merge-request watcher merged the unqueued auto-promoted contributor PR #26 while the sweep could not. Whether the relay should be able to merge an unqueued, auto-promoted contributor PR at L6 is the owner's call.Tests
pkg/mergelane/suppressed_path_test.go:TestSuppressedSweepPRTakesNoLanePlace(the live case). Two suppressed sweep PRs are refused over three sweeps:TestFrontWhosePathLosesWriteLeavesOnce: an admitted sweep front whose writes become refused leaves on its next call:TestAdmittedWaiterIsCheckedAgainAtTheFront: a waiter costs no extra call or check. Once promoted, it is refused and leaves without a merge.TestSolicitedFrontStillUpdatesAndMerges(queue, relay, dashboard): with the checker refusing everything, a behind front still updates its branch and merges, and it is never checked.TestUnknownWriteCheckDoesNotRefuse: an unknown answer lets the PR enter as before.TestRESTPathCanWriteMatchesTheLaneWrites, against the real writeback gate at L6:hive-review;Results:
go test ./pkg/mergelane/... ./pkg/github/... ./pkg/writeback/... ./cmd/hive/...passes;go vetis clean.Docs and changelog
src/docs/operator-reference.md: added a paragraph on lane writes under containment.changelog.d/fixed-merge-lane-suppressed-sweep-front.md.This merges cleanly with #16056, the other open lane fix.
Related: #12955, #11023, #14936, #14949 (same family: a front held until the timeout for a reason the lane can know).
π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1