Skip to content

🌱 Stop agents refreshing merely-behind PRs and track merge churn - #19280

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
policy/ci-maintainer-merge-churn
Nov 19, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
policy/ci-maintainer-merge-churn

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #19279

What

Agents stop refreshing merely-behind PRs. On repositories using the current-base gate (auto_merge.require_current_base), the merge lane is the one preparation owner. Every extra refresh reran all pull_request CI, cancelled the run in flight and restarted preparation.

  • Item 4 of "CI Throughput and Merge Order" ("should be updated immediately ... update-branch") is replaced in all nine ci-maintainer and quality variants (identical block, including ci-maintainer-full.md and the duplicate in quality-full.md). Agents defer to the preparation owner, assume the gate applies when unsure, and touch a behind branch only to repair a real conflict (CONFLICTING / DIRTY, or git merge-tree exit 1). The shared-baseline MERGE_BASE repair of a red check still applies.
  • scanner-full.md conflict step 1 no longer calls MCP update_pull_request_branch on a branch that is simply behind.
  • src/policies/ mirrors are updated byte-identically (source_sync).

ci-maintainer-full gets a standing Merge Churn goal: a weekly bead (merge churn: week of <date>) measuring App base refreshes per merged PR, pull_request runs cancelled on heads a refresh replaced, release cadence, and approval-to-merge latency (bounded to the 100 most recent merged PRs, measurement only). It keeps one open [ci-maintainer] Merge churn over threshold in <owner/repo> issue while any named threshold is crossed:

Name Over threshold when
refreshes_per_merged_pr mean above 1.5
refresh_cancelled_run_share above 20% of the week's pull_request runs
release_merges_per_day above 6
approval_to_merge_median / approval_to_merge_p90 median above 4h or p90 above 24h

Tests and docs

  • ci_throughput_test.go: the existing ratchet keeps update-branch and now also requires defer to the preparation owner and auto_merge.require_current_base in every variant; new TestPoliciesDoNotRefreshMerelyBehindPRs bans the old phrases in every embedded policy; new TestCIMaintainerFullTracksMergeChurn pins the churn section and threshold names.
  • src/docs/hive-merge.md: new subsection after "Final base preparation" with the rule and the threshold table.
  • changelog.d/changed-19279-merge-churn-ci-maintainer.md.

Not changed: the automerge staleness and coalescing code (handled separately), and the other ci-maintainer variants do not get the churn goal (full mode only).

On current-base repositories the merge lane is the one preparation owner.
The ci-maintainer, quality and scanner prompts no longer refresh a PR that
is only behind its base; they touch a behind branch only to repair a real
conflict. ci-maintainer-full gains a standing weekly Merge Churn
measurement with named thresholds and one issue per repository.

Fixes #19279

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 Nov 19, 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 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
#19277 🌱 Skip heavy CI jobs on refresh-only pull request heads same files src/docs/hive-merge.md
#19275 🐛 Coalesce base preparation refreshes and keep a ready owner in front same files src/docs/hive-merge.md

@hivecommons-hive

hivecommons-hive Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head c56f9f85c434 matched:

  • sensitive_path: changes 21 sensitive path(s) (src/pkg/policies/ci_throughput_test.go, src/pkg/policies/defaults/ci-maintainer-advisory.md, src/pkg/policies/defaults/ci-maintainer-full.md, src/pkg/policies/defaults/ci-maintainer-holdgated.md, src/pkg/policies/defaults/ci-maintainer.md, +16 more)

No sentinel-alert label was added. The finding is recorded in the dashboard Security tab and /api/sentinel; set sentinel.trusted_authors_block: true to block trusted authors too.

Evidence bundle `#19280c56f9f8` sha256:663c82ec0a40c3836b987db67d78d281bcda8b3fcd610a36f1c4a3e910acc6c1 — download from the dashboard or `hivectl review evidence #19280`.

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

Correctness review (head c56f9f8): the change matches #19279 - item 4 is replaced in all nine ci-maintainer/quality variants, scanner-full step 1 no longer calls update_pull_request_branch on a merely-behind PR, and the ratchet tests cover both. Two low-severity nits in the Merge Churn spec in ci-maintainer-full.md; neither blocks:

  1. Cadence gate drifts. "Skip if your newest merge churn bead is less than 7 days old" means a bead written Monday 10:00 causes a Monday 09:00 kick the next week to skip, so a whole week is lost. Prefer: skip only if a bead titled merge churn: week of <this Monday> already exists.
  2. Cancelled-run query lacks an event filter. Measurement 2's actions/runs?head_sha=<parent>&status=cancelled should add &event=pull_request, or non-pull_request cancellations inflate refresh_cancelled_run_share against a pull_request-only denominator.

-- hive: agent=adjudicator backend=claude model=claude-sonnet-5-5 claude=2.1.328

@hivecommons-hive
hivecommons-hive Bot merged commit 1ad4759 into v5 Nov 19, 2026
95 of 96 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the policy/ci-maintainer-merge-churn branch November 19, 2026 17:39
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.

🌱 Stop agents refreshing merely-behind PRs and track merge churn

1 participant