Skip to content

✨ auto-merge: breaking-titled or needs-owner-merge PRs wait for a human - #15485

Merged
clubanderson merged 5 commits into
v5from
breaking-human-merge
Oct 29, 2026
Merged

clubanderson merged 5 commits into
v5from
breaking-human-merge

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15483

What

PR #15442 (⚠️-titled = breaking change) was auto-merged by the trusted-author lane while the owner was still deciding whether to ship it. This adds one rule: breaking-titled or needs-owner-merge-labelled PRs never auto-merge.

How

  • One shared predicate — prstage.HumanMergeRule.RequiresHumanMerge(title, labels), surfaced as automerge.RequiresHumanMerge(pr) / (*Engine).RequiresHumanMerge(pr). True when the trimmed title starts with ⚠️/⚠ (U+26A0 ± VS16, configurable auto_merge.human_merge_title_prefixes) or any label matches auto_merge.human_merge_labels (default needs-owner-merge, case-insensitive). Empty list = that half is off.
  • Called exactly where eligibility is computed: prefilterSelfAuthoredPR, prefilterQueuedIssue, prefilterTrustedAuthorPR, prefilterContributorLanePR, plus the refetch paths trySweepSelfAuthoredPR / trySweepQueuedPR. planMergeTrains draws candidates from the same prefilters, so such PRs never front or ride a train.
  • Stage 090 variant: classifier (derive_pr_classify.go) returns an owned 090 human verdict; RouteHuman yields a ManualMerge route with reason breaking change — owner merges. Tracker: caption Ready for human merge (breaking change — owner merges), chip human merge (human_merge_reason: breaking-change), new.gates[] names the gate on 000 rows. Lead action is the existing gated Approve & merge as maintainer; Approve — let hive merge is greyed ("Hive never merges a breaking change"). No new direct GitHub write path.
  • Comment: postHumanEntry posts the once-only "hive waits for a human" entry via writebackAllowed (KindNeedsDecisionComment) for this reason.
  • Config fields + HumanMergeRule() accessor; wired in cmd/hive/main.go for all three automerge.Options sites.
  • Docs: operator-reference (both auto_merge tables), hive-merge.md, dashboard-sections.md, dashboard-copy-inventory.md; settings-parity allowlist; changelog fragment.

Tests

  • TestRequiresHumanMergeDefaults / TestRequiresHumanMergeConfiguredRule (VS16 ± , leading whitespace, label case, empty-list off)
  • TestHumanMergeRequiredSkipsEveryLanePrefilter, TestSweepTrustedAuthorSkipsBreakingTitle, TestPlanMergeTrainsExcludesHumanMergePR
  • classify rows in automerge_stage_labels_test.go; TestStageTrackerHumanMergeRequiredRow + caption/humanize rows; JS word assertions in the sentinel-lane harness
  • No time.Sleep; go generate ./pkg/dashboard/... run, static/index.html committed.

go build ./... && go test ./pkg/github/automerge/... ./pkg/dashboard/... ./pkg/writeback/... ./pkg/stageengine/... ./pkg/stagelabels/... ./pkg/config/... and go vet pass.

One shared predicate, automerge.RequiresHumanMerge(pr), runs where every
lane (self, queued, trusted-author, contributor) and the merge train compute
eligibility: a PR whose trimmed title starts with ⚠️/⚠ or that carries
needs-owner-merge is never merged by hive. The tracker parks it at 090
'Ready for human merge' with the 'human merge' chip and the reason
'breaking change — owner merges'; Approve & merge as maintainer is the lead
action and hive posts one writeback-gated comment saying it waits.
Configurable via auto_merge.human_merge_title_prefixes / human_merge_labels.

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

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 29, 2026
@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
#15425 🐛 fix: identify tracker claims from the local ledger same files src/docs/dashboard-sections.md
src/pkg/dashboard/static/index.html
#15478 🐛 fix(dashboard): share tracker row pill assembly; fix shrink-priority comment same files src/pkg/dashboard/static/index.html
#15308 ✨ feature: enqueue eligible PRs into GitHub native merge queues same files changelog.d/added-human-merge-breaking-title.md
src/cmd/hive/main.go
src/cmd/hive/main_helpers.go
src/docs/dashboard-copy-inventory.md
src/docs/dashboard-sections.md
src/docs/hive-merge.md
src/docs/operator-reference.md
src/pkg/config/automerge_human_merge_test.go
src/pkg/config/config.go
src/pkg/dashboard/settings_parity_allowlist.txt
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_decision.go
src/pkg/dashboard/stage_tracker_human_merge_test.go
src/pkg/dashboard/stage_tracker_new.go
src/pkg/dashboard/stage_tracker_sentinel_lane_test.go
src/pkg/dashboard/stage_tracker_test.go
src/pkg/dashboard/static-src/js/agent-now.js
src/pkg/dashboard/static-src/js/tracker-words.js
src/pkg/dashboard/static/index.html
src/pkg/github/automerge/automerge_contributor_lane.go
src/pkg/github/automerge/automerge_human_merge.go
src/pkg/github/automerge/automerge_human_merge_test.go
src/pkg/github/automerge/automerge_stage_human.go
src/pkg/github/automerge/automerge_stage_labels_test.go
src/pkg/github/automerge/automerge_sweep.go
src/pkg/github/automerge/automerge_sweep_trusted_author_test.go
src/pkg/stageengine/derive_pr_classify.go
src/pkg/stageengine/prstage/causes.go
src/pkg/stageengine/prstage/human_merge.go
src/pkg/stageengine/prstage/human_merge_test.go
src/pkg/stageengine/prstage/reasons.go
src/pkg/stagelabels/human.go
#15497 📖 docs: monitoring a hive with Prometheus and Grafana same files src/docs/operator-reference.md
#15471 🐛 fix(hotspot): stop proposing source splits for generated files whose source is already split same files src/docs/operator-reference.md
#15508 🐛 fix: scope tracker link memo to the excluded PR same files src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_test.go
#15405 🐛 fix: require verified signature for email-only hive commit identity match same files src/docs/operator-reference.md
#15468 🐛 tracker: reporter-trust hold reads 'Triage needed' same files src/docs/dashboard-copy-inventory.md
src/docs/dashboard-sections.md
src/docs/operator-reference.md
src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/stage_tracker_new.go
src/pkg/dashboard/static-src/js/tracker-words.js
src/pkg/dashboard/static/index.html
#15473 🐛 dashboard: Merged counter is an odometer at rest and the pill bee is 28 px same files src/pkg/dashboard/static/index.html
#15506 🐛 dispatch: never open a second PR for an issue that already has one same files src/docs/hive-merge.md
src/docs/operator-reference.md
src/pkg/stageengine/derive_pr_classify.go

Generated by changelog-fragment-guard from the PR title (#5675).
Edit the wording freely, or replace this file with the no-changelog
label if the change is not user-visible.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: clubanderson <407614+clubanderson@users.noreply.github.com>
@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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:Sign-off survives the squash

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Failing checks:

  • changelog-fragment-guard

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.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

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

Decision needed: @clubanderson should decide whether the agent merge-request relay (hive-merge) must also refuse a ⚠️-titled / needs-owner-merge PR from the App or a trusted author, as human_merge_paths already does, before this lands.

Read against the tree at pr15485 head. The predicate and the sweep wiring are sound; there is one path the new rule does not cover, and the docs promise that it does.

Gap: the merge-request relay still merges a ⚠️ PR from the App or a trusted author.

  • src/pkg/github/automerge/automerge_relay_gate.go:65-72 — the relay lane gate returns "" (admit) as soon as the author is hive-authored (sweepLaneForAuthor) or passes trustedAuthorDecision, before any prefilter runs. humanMergeRequiredReason is only reached for contributor-tier authors via prefilterContributorLanePR (automerge_contributor_lane.go:530).
  • src/pkg/github/merge_request_watcher.go:413-425 — the relay's own terminal refusals are mergeRequestHumanMergePathRefusal (paths) and then mergePolicyGate (the gate above). Neither evaluates HumanMergeRule.
  • Consequence: an agent running hive-merge <n> on a ⚠️-titled PR authored by the App or by a trusted author merges it. That is the same author class as the incident this PR cites (trusted-author lane merged a ⚠️ PR), just entered through the relay instead of the sweep.
  • src/docs/hive-merge.md (new section, "is never merged by hive") and operator-reference.md ("a matching PR is never merged by hive … however green and however approved") state a guarantee the code does not give. The human_merge_paths row right above it is explicit that the relay is covered, which is the model readers will assume.

Fix shape is small: evaluate RequiresHumanMerge(pr.Title, labels) next to the paths refusal in merge_request_watcher.go (or at the top of the relay gate before the hive-authored / trusted early-returns) and deny with the same reason code. If the intended scope is "sweeps and train only, the relay is a deliberate human-driven path", say so in the docs instead — but that needs the owner's call, which is the question above.

Verified and fine:

  • prstage/human_merge.go:25-54 — nil-vs-empty semantics match the config docs; TrimSpace on both title and prefix means "⚠️ foo" and " ⚠ foo" match and "" prefixes are ignored.
  • Rule is applied on the refetched PR in trySweepSelfAuthoredPR (automerge_sweep.go:1789) and trySweepQueuedPR (:2615); trySweepTrustedAuthorPR (:2264) re-runs prefilterTrustedAuthorPR on the refetched PR, which includes it (:2205). So a title edited after listing is caught in all three.
  • The 090 entry comment goes through writebackAllowed (automerge_stage_human.go:454-463) and a refusal leaves the record unmarked, as described.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

stage 080-awaiting-merge-admission → 050-review-pending: required-check-pending:build-and-test

…n-nil

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@kubestellar-prow
kubestellar-prow Bot deleted the breaking-human-merge branch October 29, 2026 20:10
@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

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-merge landed a ⚠️ breaking-titled PR while the owner was still deciding — breaking/needs-owner-merge PRs must wait for a human

1 participant