Repository navigation
⚠️ auto-merge: require a current base before merging by default (opt-out per repo) - #15442
Conversation
…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>
|
[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 |
|
@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. |
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 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.goRequireCurrentBaseForis explicit-list → skip-list → default(nil=true), andTestRequireCurrentBaseForcovers each branch including "explicit list beats skip list". - Fallback path:
updateBranchAndSkip(automerge_sweep.go:2437) returnsfork-not-editablewith nil err for a fork 403/422-maintainer, and"update-branch", errfor a same-repo 403 (falls throughclassifyUpdateBranchErrorasupdateBranchOther).currentBaseUpdateUnavailablecatches both; conflict ("conflicting", nil err) andupdateBranchOtherwith non-403 err still stop. Matches the body's claim andTestCurrentBaseGateUpdateUnavailableFallback. !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 at1dd8b73.
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
There was a problem hiding this comment.
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—currentBaseUpdateUnavailabletreats any403from 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-limitedPUT …/update-branchtherefore 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
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
|
merged by Hive trusted-author auto-merge: author @clubanderson holds role owner and GitHub permission admin on repo; CI green at 3d1ab7a. |
…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>
…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>
…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>
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(defaulttrue): 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.maintainer_can_modify, branch protection / 403, missingcontents: 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
v5for 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