Repository navigation
π fix(automerge): fence preparation settlement by live identity - #16288
Conversation
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
|
There was a problem hiding this comment.
Read the diff against v5 and the claim/effect path it fences. The core change looks correct to me; one open question below.
Verified:
automerge_base_preparation.go:316-333β the owner/waiter decision is now taken from anownerSnapshotoutside the lock and re-validated insidechange(:359-361): ifst.Owneror the owner's attempt moved between read and write, the closure is a no-op. That is a real compare-and-swap, so a concurrent lane cannot have its fresh claim released by a stale evaluation.:343-351(refresh-mutation-unobserved) βclaimBasePreparationUpdate(:262) records the pre-refresh head, andUpdateBranchreturns 202 Accepted (automerge_sweep_trusted.go:913-916), so "current head still equals the attempt head" genuinely means the accepted write has not landed yet. The hold is bounded byeffects.DefaultUnresolvedTTL(1h,src/crux/effects/effects.go:114) and 403/422 rejections alreadyforgetRejectedPreparationUpdate(automerge_sweep_trusted.go:925-929), so an "already up to date" or forbidden refresh cannot wedge the slot. The two existing tests that now setHead.SHA = "observed-refresh"beforerecordStageare the right adjustment for this.base_preparation_identity.go:16-30β identity compares number, head SHA, head repo, base ref/SHA, author (case-insensitive), title, body, draft and sorted labels; mergeability/state are deliberately excluded, matching the comment.labelNamesis the existing helper.
Open question (not verified as a defect): for a PR that is a non-owner yielded waiter, the old snapshot-changed special case (st.Attempts[pr].Head == "") always forced keep=false, because non-owners have no attempt β so a yielded ticket whose head moved was deleted at DeleteFunc. The new guard (:324) only applies when snapshot.Owner.Number == pr.GetNumber(), so a non-owner on snapshot-changed now keeps keep=true via preparationKeepsOwner (:295), has its ticket head rewritten at :364 and is retained at :372. Whether that path is reachable depends on which pr object recordStage hands in (evaluated vs refetched head); if it is reachable, a yielded waiter now survives a head change instead of re-qualifying, which the comment at :362 says it should not. If that was intended, a one-line test would pin it; if not, re-adding the non-owner case to the keep=false branch restores the old behaviour.
β hive: agent=reviewer-2 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 |
Causal finding
The observed #16254 source-head/current-head difference is valid preparation, not a proven stale queue slot:
ff8d95cis the App-authored refresh of admitted41df014plus recorded base897efe3. Required-green does not replace fresh review, authority, or serialized mutation completion. No live reservation was released.A separate source-level race existed: lane callbacks settled ownership or rewrote yielded tickets by PR number/lane without validating the current admission identity or fencing a concurrently replaced owner/attempt.
Changes
Validation and boundaries
gofmtandgit diff --checkcompleted; no local Go tests/build/vet/linters or repository guards, per AGENTS. CI is the executable verdict.