Skip to content

πŸ› Recognize preparation refreshes after destination advances - #15905

Merged
clubanderson merged 1 commit into
v5from
fix/preparation-review-restart
Oct 31, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/preparation-review-restart

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15903. Surgical runtime follow-up to #15886; no UI DTO, publisher or integration-layer change.

Confirmed mechanism

On the actually rolled source d9e14fdbaed95423ad8e41946fdda94c07ac89b6, preparation owner #15893 retained admitted/attempted head 37e0c945b92371a0a0df93bb65b757a6d80a21a6 and recorded base cccbf34a4e86e7f7cde03be0d610a84ac0201aae across restart. Hive's actual refresh f33135aced8c44c83bd1116d2c4034979bb305f6 has that attempted first parent but actual destination parent 3c7d442d4ee47de19ca19f6356a8648055c77d4b. GitHub attributes it to hivecommons-hive[bot]. Running/fresh observation source blobs are identical.

The old observation rejects the second-parent mismatch, and its subsequent stale-base comparison would also fail: before/after patches against the recorded base contain 3 versus 115 files. Against the actual destination base, the same three files have unchanged patches and identical resulting blobs. This is a real own-refresh exclusion, not merely the UI's intentionally conservative unverified badge.

Do not overinterpret telemetry: at 00:03Z all required checks passed but ARM64 still ran, so that pass was independently ineligible for preparation promotion. The parent later observed three owner reviews planned at 00:10:57 with ordinary merge-ready priority. Ordinary service can happen despite the proven preference exclusion. Watcher verdict recorded messages and empty GitHub reviews do not establish completed internal approval. No completed-approval claim or gate bypass is made here.

Minimal fix / preserved safety

Reuse the automerge engine's existing BaseRefreshChecker.HeadIsBaseRefreshOf, already used for App base-refresh verification: App-attributed merge lineage, actual merged base on the destination branch, unchanged files/blobs/diff. Do not equate the mutable/stale recorded base SHA with the merged destination parent. Keep a recorded attempt mandatory; unknown/non-App/content-changing/wrong-branch heads fail closed. No decision/verdict is carried or written by this call.

Existing live-head binding, hold/closed/retargeted/expiry checks and final ownership/attempt re-read remain. The observation remains read-only, cached per destination by the existing caller, with remote I/O outside preparation locks. Existing persisted state works on a cold engine without rewriting owner/head/attempt identities. No CI, current-base, current-head review, approval, trust, DCO or label gate changes. Pending CI still receives no preparation preference; confirmed-service fairness and reviewer capacity are untouched. No new engine/state/hash, timers, pool, memory/recycle, configuration/rules, native activation or deployment.

Regression / validation

Extend the existing durable reload/lifecycle table with advanced-base acceptance, an additional cold-engine restart, advanced-base amendment/wrong-destination rejection, non-App rejection, changed-blob rejection even with an unchanged patch, missing attempt, unavailable proof and concurrent release during proof. Existing held/closed/retargeted/expired/released and read-only tests remain; existing planner pending-CI/default-order/fairness tests continue unchanged.

gofmt and git diff --check completed; no local Go suites/build/vet/lint/docs guards per AGENTS. CI is the sole verdict; exact-head results will be recorded before owner-authorized --match-head-commit source merge. No extra review wait required by owner authorization.

Audit / rollout

Successful dispatch retains priority=base-preparation / base-preparation-fairness. Failed verification now records automerge base preparation observation skipped with reason=unverified-app-base-refresh. Source fix requires a newly published binary and owner rollout; none performed by this task.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 31, 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 clubanderson 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 Oct 31, 2026
@github-actions

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.

No conflicting open PRs or same-file overlaps were found.

@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 base_preparation_observation.go at d00628d against pr_decision_base_refresh.go on v5. The swap to BaseRefreshChecker.HeadIsBaseRefreshOf is correct for the stated mechanism: mergeIsBaseRefreshOf checks the non-attempt parent against CompareCommits(base...newHead).merge_base_commit (pr_decision_base_refresh.go:143-146), so a destination tip newer than Attempt.Base is accepted while a parent off the destination branch still fails, and sameChangedFiles compares resulting blob SHAs, so the new blob-changed-same-patch case is genuinely covered. The advanced-base test case fails on the old code (it required Parents[1] == Attempt.Base), so the regression test is real.

One behaviour change I think is unintended:

Transient lookup failures are now sticky for the life of the process (medium). HeadIsBaseRefreshOf returns false on any GetCommit/CompareCommits error and memoises that result unconditionally (pr_decision_base_refresh.go:65-72: ok := headIsBaseRefreshChainOf(...); b.cache[...] = ok), keyed on (repo, pr, Attempt.Head, head). The removed code returned err on a GetCommit failure (old base_preparation_observation.go:63-66), so the next planning pass retried. After this change, a single 403/5xx/rate-limit on the proof read excludes that owner from base-preparation priority until the engine restarts or the memo rolls over at 4096 entries, and every subsequent pass logs reason=unverified-app-base-refresh as if the proof had actually failed β€” the same "owner silently loses preference" symptom #15903 is fixing, from a new cause. The proof-unavailable test case calls the observation once, so it doesn't see the stickiness.

Smallest fix I can see: have the checker not memoise results that came from a lookup error (e.g. headIsBaseRefreshChainOf returns (ok, lookupFailed) and the cache store is skipped when lookupFailed), which also benefits the decision-carry caller at pr_decision_base_refresh.go:291. If the sticky-negative is acceptable here, a sentence in hive-merge.md saying a failed proof read is not retried until restart would at least make the log line honest.

Info only: the shared checker walks up to baseRefreshMaxHops=5 consecutive App refreshes (pr_decision_base_refresh.go:97-118), whereas the removed code accepted exactly one merge. That matches what the decision carry already trusts, so I don't think it's a problem, but it is a widening the PR body doesn't mention.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Why:

  • the review swarm requested changes

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

@clubanderson
clubanderson merged commit bc6cbce into v5 Oct 31, 2026
77 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/preparation-review-restart branch October 31, 2026 00:38
@github-actions

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

@clubanderson

Copy link
Copy Markdown
Member Author

Final exact-head CI and authorized source-merge receipt

  • Tested immutable head: d00628d51b2849c945824a47688e4df6cf20dfcf.
  • Immediate premerge reread: all required checks SUCCESS; all applicable CI terminal, 62 success / 15 scope-skipped / 0 failures / 0 running. Latest destination remained 3c7d442d4ee47de19ca19f6356a8648055c77d4b, the tested parent; MERGEABLE. No head/base integration or CI repair was necessary.
  • Three superseded DCO/changelog automation runs were canceled automatically, with newer same-head successful replacements (DCO 41149084136, changelog 41149084145). The old canceled DCO check remains visible historically; it is not an ignored test failure. No manual retry/cancellation or gate manipulation performed.
  • Only remaining status wait was Tide's explicit Needs approved, lgtm labels; owner explicitly authorized source merge without an additional review wait. No approval/LGTM labels were added.
  • Executed owner-authorized gh pr merge --admin --squash --match-head-commit d00628d51b2849c945824a47688e4df6cf20dfcf after fresh full-CI and required-check validation.
  • Actually merged 2026-10-31T00:38:35Z by clubanderson, squash bc6cbce54784226511f0d159aab01f6e35c28e92. Verified squash includes Signed-off-by: Andy Anderson <andy@clubanderson.com>.

CI sources:

Source-only boundary: reuses the established App/base-ancestry/content verifier for priority observation. No approval carry, gate weakening, owner/store rewrite, fairness/capacity change, new UI DTO, policy/config change, publication claim, deployment or native activation. Runtime adoption requires a newly published binary and owner rollout. The raw UI may correctly retain its conservative admitted-head/unverified badge; that badge alone does not determine validated planner priority. Verify settled CI plus an owed current-head verdict, then actual service logs priority=base-preparation / base-preparation-fairness; failed refresh proof now has reason=unverified-app-base-refresh.

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.

πŸ› Recognize own base-preparation refreshes when the base advances

1 participant