Skip to content

πŸ› fix(automerge): fence preparation settlement by live identity - #16288

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
fix/preparation-identity-lifecycle-20261102
Nov 2, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
fix/preparation-identity-lifecycle-20261102

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Causal finding

The observed #16254 source-head/current-head difference is valid preparation, not a proven stale queue slot: ff8d95c is the App-authored refresh of admitted 41df014 plus recorded base 897efe3. 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

  • Validate state-changing callbacks against current head/base, source repository, author, title/body, draft and policy-label identity, outside preparation locks. No-change callbacks perform no new network read.
  • Compare the exact persisted owner/attempt or waiting ticket before settlement; stale callbacks cannot erase a newly admitted owner, race an attempt replacement, or rewind a yielded head.
  • Retain an accepted but unobserved expected-head refresh through the existing mutation reconciliation window. Fresh observed-head failure may settle normally; CI-green/review-pending remains sticky.
  • Document admitted-source ticket semantics and add regressions for superseded identities, unavailable reads, mutation observation/TTL, fresh-review retention, and concurrent release/renewal races.

Validation and boundaries

  • Independent read-only peer review completed with no high-confidence findings. gofmt and git diff --check completed; no local Go tests/build/vet/linters or repository guards, per AGENTS. CI is the executable verdict.
  • No queue clearing, base refresh, rerun, forced lease release, labels, reconciliation, approval bypass, permission grant, deployment, restart, or capacity/budget change.
  • Existing CI-recovery/operator-handoff fix πŸ› fix(ci): surface and recover shared CI permission blocksΒ #16277 remains separate; this is not a duplicate or a claim that the current reservation caused the backlog.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 2, 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 nicholasjackson 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

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

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

PR Title Relation Files
#16293 πŸ› fix(github): attribute human-merge path holds and document pin-only rollout same files src/docs/hive-merge.md
#16300 ✨ feat(config): stage bounded human-merge pin-only policy and classifier same files src/docs/hive-merge.md

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 an ownerSnapshot outside the lock and re-validated inside change (:359-361): if st.Owner or 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, and UpdateBranch returns 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 by effects.DefaultUnresolvedTTL (1h, src/crux/effects/effects.go:114) and 403/422 rejections already forgetRejectedPreparationUpdate (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 set Head.SHA = "observed-refresh" before recordStage are 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. labelNames is 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

@hivecommons-hive
hivecommons-hive Bot merged commit 03291c8 into v5 Nov 2, 2026
82 of 86 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/preparation-identity-lifecycle-20261102 branch November 2, 2026 22:54
@github-actions

github-actions Bot commented Nov 2, 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Evidence bundle `#162889f03835` sha256:4bdcbcbdf5db0b329e7d3b5d2ac981ef7d6f0624a3bc7689792895a3d001fdaf β€” download from the dashboard or `hivectl review evidence #16288`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant