Skip to content

⚠️ auto-merge: require a current base before merging by default (opt-out per repo) - #15442

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
feat/require-current-base-default
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
feat/require-current-base-default

Conversation

@clubanderson

@clubanderson clubanderson commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Note: merged by the hive at 17:56Z as default-on. The owner then decided the fleet default must stay off; #15455 reverts the default to off and adds the Features switch + per-repo override. Nothing default-on reaches a release.

What

Flips the auto-merge current-base gate (#13634) to on for every repository by default, with a per-repo opt-out.

  • auto_merge.require_current_base_default (default true): the App self-merge, trusted-author and contributor lanes only merge a head that contains the current base tip. A green head tested on an older base gets GitHub update-branch and merges once CI is green on the new head. Cost: one compare call per merge candidate.
  • auto_merge.skip_current_base: [owner/repo]: opt a repo out.
  • auto_merge.require_current_base: [owner/repo] keeps working as the explicit (now strict) allow list.
  • Guard: when update-branch is unavailable (fork without maintainer_can_modify, branch protection / 403, missing contents: write), a repo gated only by the default merges the head as tested with one WARN per PR (not per sweep); strict repos still park.

Evidence (#15335)

A stale-green merge (#15236) broke v5 for every open PR for ~20 minutes: the head was green on an older base and nothing re-ran CI on the merged result. The gate catches exactly that.

Tests / docs

Default / opt-out resolution table, strict resolution, update-unavailable fallback (WARN-once), operator-reference rows, settings-parity allowlist, changelog.

Refs #15335

…out per repo)

The current-base gate (auto_merge.require_current_base, #13634) only ran
for listed repos, so the hive that merges hivecommons/hive merged #15236
green-but-stale and broke v5 for every open PR for 20 minutes (#15335).

- Gate is now on for every repo by default
  (auto_merge.require_current_base_default, nil = true).
- auto_merge.skip_current_base: [owner/repo] opts a repo out.
- An explicit require_current_base entry stays strict; a repo gated only
  by the default merges a behind head the App cannot update (fork without
  maintainer edits, branch protection / 403) as tested, with one WARN per
  PR, so the default does not park every fork PR fleet-wide.

Refs #15335

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 Oct 29, 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@clubanderson is auto-promoted for contributor-lane merging on this PR: the last 5 merged PRs by this author in this hive's repositories have no revert or sentinel-alert evidence. CI, reviewer verdict, diff fences, soak, holds and branch protection still apply.

@github-actions

github-actions Bot commented Oct 29, 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
#15308 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files src/pkg/github/automerge/automerge_sweep.go
#15405 🐛 fix: require verified signature for email-only hive commit identity match same files src/docs/operator-reference.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 gate at src/pkg/github/automerge/automerge_current_base.go and all three callers (automerge_sweep.go:1912, :2334, automerge_contributor_lane.go:1400) at this head. Looks correct to me.

Verified

  • Resolution order in config.go RequireCurrentBaseFor is explicit-list → skip-list → default(nil=true), and TestRequireCurrentBaseFor covers each branch including "explicit list beats skip list".
  • Fallback path: updateBranchAndSkip (automerge_sweep.go:2437) returns fork-not-editable with nil err for a fork 403/422-maintainer, and "update-branch", err for a same-repo 403 (falls through classifyUpdateBranchError as updateBranchOther). currentBaseUpdateUnavailable catches both; conflict ("conflicting", nil err) and updateBranchOther with non-403 err still stop. Matches the body's claim and TestCurrentBaseGateUpdateUnavailableFallback.
  • !branchUpdateAllowed (contributor relay / behind-budget exhausted) still parks regardless of strictness — the fallback only applies after an actual update attempt. Good: no new merge path opens for the budget-exhausted case.
  • go build ./pkg/config/ ./pkg/github/automerge/ passes at 1dd8b73.

One open question (low) — automerge_current_base.go:51-53: a same-repo 403 from a GitHub secondary rate limit is also a *gh.ErrorResponse with status 403, so it would trip the "merging as tested" fallback rather than stop. This is the same ambiguity the existing TODO at automerge_sweep.go:2475 (hive#14589) already notes, and the outcome is only the pre-#15335 behaviour, so I don't consider it a defect here — but the WARN text will say "cannot be updated" when the real cause was rate limiting. If you want it tight, gating on isResourceNotAccessible-style message matching would close it.

Issue link — body says Refs #15335, and #15335 sits in stage/045-needs-decision. This PR plus the already-applied config appear to resolve it entirely; if so, Closes #15335 would keep it from lingering open after merge. Your call as owner.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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 gate and its three callers at 1dd8b73 (automerge_sweep.go:1912, :2334, automerge_contributor_lane.go:1400), the resolution order in config.go:8515, and updateBranchAndSkip / classifyUpdateBranchError. The default-on plumbing is correct: an explicit require_current_base entry wins, skip_current_base turns it off, otherwise require_current_base_default (nil → on); the strict/fallback split only engages after CompareCommits says the head is behind and update-branch has actually been tried, and conflicts / unknown errors still park. The new table test exercises each branch across two ticks and pins the once-per-PR WARN. Looks correct to me.

One low-severity observation, not a blocker:

  • automerge_current_base.go:53 — currentBaseUpdateUnavailable treats any 403 from update-branch as "the App may not write the head". classifyUpdateBranchError (automerge_sweep.go:2481-2484) already notes that a same-repo 403 can also be a rate-limit. On a default-gated repo a rate-limited PUT …/update-branch therefore falls through to merging the behind head as tested — the exact outcome #15335 is closing — instead of retrying next tick as the pre-fallback path did. Consequence is bounded (the follow-on merge call is likely to hit the same limit, and the WARN names the PR), and the strict list still parks, so I'd leave it as a known edge until #14589 teaches the classifier to tell the two 403s apart — maybe worth a one-line mention in that TODO.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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.

Reviewed — no findings from this perspective.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit 3feba13 into v5 Oct 29, 2026
71 of 72 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the feat/require-current-base-default branch October 29, 2026 17:56
@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

@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#154423d1ab7a` sha256:cc332bb8e8bacec50ceb5bb5d1c3b130d83cc5791d56648cb7243f4007e32c5b — download from the dashboard or `hivectl review evidence #15442`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 3d1ab7a.

@clubanderson clubanderson changed the title ⚠️ auto-merge: require a current base before merging by default (opt-out per repo) ✨ auto-merge: 'merge only on current base' switch in Features + per-repo override Oct 29, 2026
@clubanderson clubanderson changed the title ✨ auto-merge: 'merge only on current base' switch in Features + per-repo override ⚠️ auto-merge: require a current base before merging by default (opt-out per repo) Oct 29, 2026
clubanderson added a commit that referenced this pull request Oct 29, 2026
…epo override

Expose the current-base merge gate (#13634) as an operator switch rather
than the fleet-wide default #15442 shipped. Settings → Features →
Auto-merge gains "Merge only on current base"
(auto_merge.require_current_base_default, now OFF by default); each
Repos-tab row gets an inherit / on / off override written to
auto_merge.require_current_base / auto_merge.skip_current_base, and the
repo card shows a current-base chip when the effective value is on
(requireCurrentBase on /api/status repos).

Resolution: explicit on beats explicit skip beats the default. Explicitly
listed repos are strict; a repo gated only by the default merges a head
the App cannot update (fork without maintainer edits, branch protection)
as tested, with one WARN per PR, so fork-heavy repos are not parked
wholesale.

The default stays off: the merge train already update-branches
overlapping siblings, and the gate soaks on hive's own hive first
(auto_merge.require_current_base: [hivecommons/hive] is live there).

Refs #15335, #15442

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
hivecommons-hive Bot pushed a commit that referenced this pull request Oct 29, 2026
…epo override

Expose the current-base merge gate (#13634) as an operator switch rather
than the fleet-wide default #15442 shipped. Settings → Features →
Auto-merge gains "Merge only on current base"
(auto_merge.require_current_base_default, now OFF by default); each
Repos-tab row gets an inherit / on / off override written to
auto_merge.require_current_base / auto_merge.skip_current_base, and the
repo card shows a current-base chip when the effective value is on
(requireCurrentBase on /api/status repos).

Resolution: explicit on beats explicit skip beats the default. Explicitly
listed repos are strict; a repo gated only by the default merges a head
the App cannot update (fork without maintainer edits, branch protection)
as tested, with one WARN per PR, so fork-heavy repos are not parked
wholesale.

The default stays off: the merge train already update-branches
overlapping siblings, and the gate soaks on hive's own hive first
(auto_merge.require_current_base: [hivecommons/hive] is live there).

Refs #15335, #15442

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
hivecommons-hive Bot pushed a commit that referenced this pull request Oct 29, 2026
…epo override (#15455)

Expose the current-base merge gate (#13634) as an operator switch rather
than the fleet-wide default #15442 shipped. Settings → Features →
Auto-merge gains "Merge only on current base"
(auto_merge.require_current_base_default, now OFF by default); each
Repos-tab row gets an inherit / on / off override written to
auto_merge.require_current_base / auto_merge.skip_current_base, and the
repo card shows a current-base chip when the effective value is on
(requireCurrentBase on /api/status repos).

Resolution: explicit on beats explicit skip beats the default. Explicitly
listed repos are strict; a repo gated only by the default merges a head
the App cannot update (fork without maintainer edits, branch protection)
as tested, with one WARN per PR, so fork-heavy repos are not parked
wholesale.

The default stays off: the merge train already update-branches
overlapping siblings, and the gate soaks on hive's own hive first
(auto_merge.require_current_base: [hivecommons/hive] is live there).

Refs #15335, #15442

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
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