Skip to content

ci: run CI in a merge queue so promotions stop deferring forever - #978

Merged
blove merged 1 commit into
mainfrom
blove/ci-merge-queue-support
Sep 3, 2026
Merged

ci: run CI in a merge queue so promotions stop deferring forever#978
blove merged 1 commit into
mainfrom
blove/ci-merge-queue-support

Conversation

@blove

@blove blove commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Land this before enabling the merge queue in settings. Turning the queue on first would hang every merge on a required check that never runs.

Why

Merges arrive faster than CI completes (~25 min apart vs ~30 min runs), so the deploy job's staleness gate defers to a newer commit — which then defers itself. Tonight that ran five rounds and production never advanced past the pre-#963 build. The gate is correct in isolation; it just has no way to eventually win.

A merge queue serialises main so each candidate gets a clean window.

What this changes

GitHub runs queue candidates on the merge_group event. Three things are required:

  1. Trigger CI on merge_group.
  2. Scope a candidate from the merge group's base/head range, so queued runs stay as narrow as pull requests instead of running the full matrix every time.
  3. Report CI — required on merge_group. It is the only required status context and the queue waits on it per candidate — this is the one that would hang merges if missed.

What deliberately does not change

  • The 18 verification jobs. They already read github.event_name == 'push' || needs.ci-scope.outputs.X, so on merge_group they fall through to the scope outputs and behave exactly as they do on a PR.
  • The 4 deploy jobs. They additionally require github.ref == 'refs/heads/main', and a candidate builds on refs/heads/gh-readonly-queue/*. A queued candidate therefore cannot promote to production. This is the safety-critical property, and it is now pinned by a test rather than left implicit.

Verification

  • ci-workflow.spec.mjs: 36/36, including three new guards — the merge_group trigger exists, the required context reports there, and all four production jobs stay pinned to refs/heads/main.
  • Mutation-probed: removing the merge_group trigger fails a guard.
  • Re-pinned the existing CI — required if: assertion to the new expression rather than loosening it.

After merging

Enable the merge queue on main in branch protection. Worth doing in the same sitting — the two halves are only useful together.

🤖 Generated with Claude Code

Merges arrive faster than CI completes, so the deploy job's staleness gate
defers to a newer commit that then defers itself. Tonight that ran five rounds
and production never advanced past the pre-#963 build. A merge queue serialises
main so each candidate gets a clean window.

GitHub runs queue candidates on the merge_group event. Three things are needed
before the queue can be turned on — enabling it first would hang every merge on
a required check that never runs:

- trigger CI on merge_group;
- scope a candidate from the merge group's base/head range, so queued runs stay
  as narrow as pull requests instead of running the full matrix;
- report `CI — required` on merge_group. It is the only required status
  context, and the queue waits on it per candidate.

The 18 verification jobs need no change: they already fall through to the
ci-scope outputs whenever the event is not `push`. The deploy jobs need none
either — they additionally require github.ref == 'refs/heads/main', and a
candidate builds on gh-readonly-queue/*, so a queued candidate cannot promote.
Both properties are now pinned by tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
threadplane Ready Ready Preview Sep 3, 2026 4:37am UTC

Request Review

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

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

@blove
blove merged commit 6cf0218 into main Sep 3, 2026
76 checks passed
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.

1 participant