Skip to content

fix(ci): load-shed stale merge-group generations (BLO-21953) - #1260

Merged
kkroo merged 1 commit into
masterfrom
codex/reopen-pr-1042-merge-group-loadshed
Aug 11, 2026
Merged

fix(ci): load-shed stale merge-group generations (BLO-21953)#1260
kkroo merged 1 commit into
masterfrom
codex/reopen-pr-1042-merge-group-loadshed

Conversation

@kkroo

@kkroo kkroo commented Aug 10, 2026

Copy link
Copy Markdown

Thinking Path

  • Paperclip is the control plane people use to coordinate AI agents and their work.
  • Every protected pull request eventually depends on the repository's merge-queue workflow completing against a generated merge-group commit.
  • GitHub creates a new merge_group.head_sha whenever the queue re-stages its sole active build, so the existing SHA-keyed concurrency group treats each generation as unrelated.
  • Superseded generations therefore keep their full ARC matrices queued or running even though their check results can no longer satisfy a live queue entry.
  • The repository merge queue is configured with maximumEntriesToBuild: 1, so the base ref is the stable identity of the one legitimate candidate for that queue.
  • This pull request keys merge-group concurrency by that base ref and pins the contract in policy CI.
  • The benefit is immediate cancellation of superseded generations instead of multiplying runner demand on every re-stage.

Linked Issues or Issue Description

What Changed

  • Changed merge-group workflow concurrency from the per-generation head_sha to the stable merge-queue base_ref; pull-request concurrency remains keyed by PR number.
  • Documented the maximumEntriesToBuild=1 queue-setting dependency next to the workflow key.
  • Added a focused regression test that rejects merge_group.head_sha, requires base_ref plus cancel-in-progress, and verifies the test remains wired into policy.

Verification

  • node --test scripts/__tests__/merge-group-concurrency.test.mjs (2 passing)
  • git diff --check
  • Queried repository.mergeQueue(branch: "master").configuration: maximumEntriesToBuild is 1.
  • Observed and cleaned four simultaneous generations for queue head fix(agent): refresh persisted browser link #1222 (31445053131, 31445776112, 31445889310, 31447738839); only the newest candidate was live.

Risks

  • Low implementation risk: ordinary pull-request grouping is unchanged, and the merge-group key uses a documented event field.
  • The key intentionally permits one active merge-group workflow per base branch. If repository administration raises maximumEntriesToBuild above 1, this concurrency strategy must be revisited before that setting change so legitimate speculative candidates do not cancel one another.

For core feature work, check ROADMAP.md first and discuss it in #dev before opening the PR. Feature PRs that overlap with planned core work may need to be redirected - check the roadmap first. See CONTRIBUTING.md.

Model Used

  • OpenAI Codex based on GPT-5 (exact deployment model ID and context-window size are not exposed), with reasoning, repository/GitHub/cluster inspection, and local code execution.

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have specified the model used (with version and capability details)
  • I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work
  • I have searched GitHub for duplicate or related PRs and linked them above
  • I have either (a) linked existing issues with Fixes: # / Closes # / Refs # OR (b) described the issue in-PR following the relevant issue template
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots (not applicable)
  • I have updated relevant documentation to reflect my changes
  • I have considered and documented any risks above
  • All Paperclip CI gates are green
  • Greptile is 5/5 with no open P2s, recommendations, or follow-ups
  • I will address all Greptile and reviewer comments before requesting merge

@allyblockcast

allyblockcast Bot commented Aug 10, 2026

Copy link
Copy Markdown

🔗 Paperclip issue: BLO-21953

1 similar comment
@allyblockcast

allyblockcast Bot commented Aug 10, 2026

Copy link
Copy Markdown

🔗 Paperclip issue: BLO-21953

@kkroo
kkroo force-pushed the codex/reopen-pr-1042-merge-group-loadshed branch from 97a7d2f to 38a3fa4 Compare August 11, 2026 01:36
@kkroo
kkroo marked this pull request as ready for review August 11, 2026 01:37
@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@kkroo

kkroo commented Aug 11, 2026

Copy link
Copy Markdown
Author

@ally please review exact head 38a3fa436ad05b600062abc530923948e57aec2d. The prior draft guard only sampled queue membership before policy and could miss a re-stage after that sample. This replacement uses the workflow concurrency mechanism itself: merge groups share the stable base_ref key, so cancel-in-progress terminates the prior generation when the replacement event is created. The repository merge queue reports maximumEntriesToBuild: 1. Focused regression test: 2/2 passed; git diff --check passed.

@allyblockcast allyblockcast Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ally — Consolidated PR Review

Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex.
Reviewed head: 38a3fa4

Critical Issues (0)

Important Issues (0)

Suggestions (0)

Strengths

  • The concurrency key preserves per-PR cancellation while grouping merge-queue re-stages by the stable base ref.
  • The comment records the maximumEntriesToBuild=1 operating assumption beside the expression it justifies.
  • The focused policy test checks the key, rejects the unstable head_sha, and verifies the test remains wired into the policy job.

Recommended Action

  1. Safe to merge with the documented single-entry merge-queue constraint retained.

@allyblockcast allyblockcast left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ally — Consolidated PR Review

Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex.
Reviewed head: 38a3fa4

Critical Issues (0)

Important Issues (0)

Suggestions (0)

Strengths

  • The concurrency key preserves per-PR cancellation while grouping merge-queue re-stages by the stable base ref.
  • The comment records the maximumEntriesToBuild=1 operating assumption beside the expression it justifies.
  • The focused policy test checks the key, rejects the unstable head_sha, and verifies the test remains wired into the policy job.

Recommended Action

  1. Safe to merge with the documented single-entry merge-queue constraint retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants