Skip to content

[OMNIML-6182] [1/2] Run the required checks in GitHub's merge queue - #2858

Draft
shengliangxu wants to merge 3 commits into
mainfrom
shengliangx/ci-12-merge-queue
Draft

shengliangxu wants to merge 3 commits into
mainfrom
shengliangx/ci-12-merge-queue

Conversation

@shengliangxu

@shengliangxu shengliangxu commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Type of change: CI (merge queue support)

GitHub's merge queue builds a temporary branch of main plus the queued PR (gh-readonly-queue/main/pr-<N>-<sha>) and waits for the required status checks to report on it. Today none would: the unit tests, code quality and docs run on pull_request events, and the GPU, example and regression workflows only on pushes to the copy-pr-bot branches (pull-request/N) and on schedule. This adds the merge_group trigger to all six, limited to main, release/* and feature/* (the branches of their pull_request triggers), and makes a merge group count as a PR run:

  • Gate and diff. The gate of the GPU, example and regression workflows (_pr_gate.yml, the example gate) and the unit tests' changed-files check diff the group against the commit it was built on, so the same lanes run as on the PR and the wait for the unit linux check stays. The pr-merge-base action reads base_sha and head_sha from the merge_group payload for this; the unit workflow passes them to changed-files directly (empty on a PR, where the action finds its base itself).
  • Everything keyed on "a PR run" now includes a merge group: the *-pr-required-check aggregators (the required checks), the single-GPU runners, the example timeouts, hf_ptq's -n 4, and leaving out the manual tests (unit lane).
  • TruffleHog and Codecov. The secret scan reads the group's base_sha..head_sha like a PR. The Codecov uploads are skipped for a group: its commit never lands on main, and the unit job's upload (fail_ci_if_error: true) could otherwise fail a required check.
  • CONTRIBUTING.md says what the queue does for a contributor.

How the queue treats PRs: each PR still lands as its own commit (the main ruleset allows squash only). The temporary branch of a group is only for testing: the target branch plus the PRs ahead of it plus this one. If its checks fail, that PR is removed from the queue, the PRs ahead of it carry on, and the PRs behind it are re-tested without it.

PR runs, nightly runs and on-demand runs behave exactly as before (see Testing). What this PR does not do is turn the queue on: that is a ruleset setting, see below.

Enabling the queue (repository admin, once this PR is in)

A queue is a ruleset rule, so it takes one change per branch family, for the three the checks run for:

  1. main. Add Require merge queue with merge method Squash (the only method this ruleset allows). Starting values, to tune to the GPU runner capacity: build concurrency 2, merge 1 to 4 entries, wait 5 min for more entries, Only merge non-failing pull requests on, and a status check timeout of at least 90 minutes: the GPU workflow takes 59 min at the median today (its jobs time out at 60 min), so the default of 60 would eject slow groups. The required checks stay as they are (DCO, code-quality, build-docs and the four *-pr-required-check).
  2. release/*. The same rule. Its ruleset allows merge, squash and rebase, so the queue's method is a choice (squash keeps the history like main). Its required checks (DCO, code-quality, build-docs, and the unit, gpu and example *-pr-required-check) are all reported in a merge group.
  3. feature/*. This ruleset has no required status checks today, so a queue there would merge without testing anything. Require the same checks as release/* first.
  4. The branch needs the workflows. A merge group runs the workflow files of its target branch, so a release/* or feature/* branch reports the checks only once it carries these merge_group triggers: cherry-pick this PR into each active release branch (the cherry-pick-<X.Y.Z> label does that) and merge main into each feature branch that will use the queue.
  5. DCO. The DCO app reports on merge groups since July 2026 (dco app doesn't run in merge queues dcoapp/app#199, 📝 Add docstrings to aboubezari/fix_autocast_cast_output_producer_bug #303), but each installation has to approve its new "Merge queues: read" permission. If the first queued PR waits on DCO for good, approve it, or fall back to a job named DCO on merge_group and point the required check at "any source".
  6. Watch the first queued PR on each branch family through all four workflows. GitHub only sends merge_group events for a repository with the queue on, so nothing in this PR's own CI can exercise them.

Possible follow-up: a run of a group that gets rebuilt or dequeued is not cancelled (a group's sha is unique, so the concurrency groups never match); the GPU lanes would run to completion.

Time impact (measured in CI)

No change to a PR's own CI run. What the queue adds is a re-run of the required checks at merge time, so a merge takes about as long as the slowest required workflow. Wall time of a PR run today (median of PR runs, 2026-09-25 to 10-09; the unit figure after #2823):

workflow wall time
GPU tests (includes the 5 min minimum wait for the unit linux check) 59 min
Example tests 64 min
Regression tests 26 min
Unit tests (linux, then the multi-version and Windows legs) 24 min

So a merge through the queue takes about an hour today, and the GPU and example workflows set it. The separate speed-up series (#2845-#2855) brings the GPU workflow to 36-40 min and the example workflow to 19-29 min in its own PR runs. The queue's status check timeout has to cover the slower figure, see below.

Usage

Nothing changes for contributors until the queue is on; then merging a PR adds it to the queue (CONTRIBUTING.md).

Testing

  • actionlint over all workflows and every pre-commit hook pass.
  • The branches filter under merge_group is the documented one (GitHub's events reference: it runs the workflow "only for merge groups that target specific branches"), with the same patterns as the pull_request triggers.
  • A script (not part of this PR) evaluates the 26 changed if, runs-on, env and with expressions under a push to pull-request/N, schedule, workflow_dispatch, pull_request and a push to main, and finds the same value as on the base for each; for a merge_group event every one gives what a PR run gives. The shell condition for hf_ptq's -n 4 was run for the same cases.
  • This PR's own CI runs the PR paths of all six workflows with the new expressions.
  • Not run: a merge_group event, for the reason above. The merge_group payload fields (base_sha, head_sha) and the checks_requested type are the documented ones, and the TruffleHog action's handling of base and head inputs was read in its source.

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: N/A (CI and tests)
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: no new dependency
  • Did you write any new necessary tests?: N/A (CI configuration)
  • Did you update Changelog?: N/A (CI and tests)
  • Did you get Claude approval on this PR?: N/A (optional, not run)

Additional Information

Slice 1 of 2 of the merge queue work; #2860 is stacked on it. Independent of the GPU-CI speed-up series (#2845-#2855, reference draft #2730): it is based on main and changes nothing until a repository admin enables the queue. Both touch unit_tests.yml, gpu_tests.yml and regression_tests.yml in neighbouring lines, so whichever lands second needs a trivial rebase. The series adds two conditions that key off a PR run, --run-release in #2847 and the swinv2 skip of the torch_onnx test in #2853; if this PR lands first they need the same merge_group case (a one-line change each), and if the series lands first this PR carries it.

  1. [OMNIML-6182] [1/2] Run the required checks in GitHub's merge queue #2858 [OMNIML-6182] [1/2] Run the required checks in GitHub's merge queue (this PR)
  2. [OMNIML-6183] [2/2] Run the GPU, example and regression tests in the merge queue only #2860 [OMNIML-6183] [2/2] Run the GPU, example and regression tests in the merge queue only

Summary by CodeRabbit

  • New Features
    • Automated checks now run for changes in the merge queue across example, unit, GPU, regression, and code-quality workflows, as well as Pages builds.
    • Required checks and changed-file detection now account for queued changes, helping validate them before they merge.
  • Documentation
    • Updated contribution guidance to explain how merge queues handle queued pull requests, rerun checks, and respond to failures.

@copy-pr-bot

copy-pr-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/Model-Optimizer/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 23d61078-5109-448f-9250-5bba1b9db98d
📥 Commits

Reviewing files that changed from the base of the PR and between d7cbff3 and e260b71.

📒 Files selected for processing: 10
  • .github/actions/pr-merge-base/action.yml
  • .github/workflows/_example_tests_runner.yml
  • .github/workflows/_pr_gate.yml
  • .github/workflows/code_quality.yml
  • .github/workflows/example_tests.yml
  • .github/workflows/gpu_tests.yml
  • .github/workflows/pages.yml
  • .github/workflows/regression_tests.yml
  • .github/workflows/unit_tests.yml
  • CONTRIBUTING.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

📝 Walkthrough

CI workflows now handle GitHub merge queue events on configured branches. The changes add merge-group SHA handling, adapt change detection and test execution, and update required-check conditions. CONTRIBUTING.md describes the merge queue process and its check outcomes.

Changes: Merge queue validation

Layer / File(s) Summary
Merge-group SHAs and path gating
.github/actions/pr-merge-base/action.yml, .github/workflows/_pr_gate.yml, .github/workflows/example_tests.yml, .github/workflows/unit_tests.yml
The merge-base action exposes merge-group base and head SHAs. The PR gate and test workflows use merge-group events for change detection and lane selection.
Example and unit test checks
.github/workflows/_example_tests_runner.yml, .github/workflows/example_tests.yml, .github/workflows/unit_tests.yml
Example and unit test workflows add merge-group conditions for test execution, runner selection, timeouts, coverage uploads, and required checks.
GPU and regression checks
.github/workflows/gpu_tests.yml, .github/workflows/regression_tests.yml
GPU and regression workflows add merge-group triggers, runner selection, coverage-upload conditions, and required-check conditions.
Other checks and queue instructions
.github/workflows/code_quality.yml, .github/workflows/pages.yml, CONTRIBUTING.md
Code quality and Pages workflows add merge-group triggers. Code quality passes merge-group SHAs to secret scanning, and the contribution guide describes merge queue checks and outcomes.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant MergeQueue
  participant TestWorkflows
  participant MergeBaseAction
  participant ChangedFileDetection
  participant RequiredChecks
  MergeQueue->>TestWorkflows: starts checks_requested run
  TestWorkflows->>MergeBaseAction: requests merge-group base and head SHAs
  MergeBaseAction-->>TestWorkflows: returns base and head SHAs
  TestWorkflows->>ChangedFileDetection: compares changed files
  ChangedFileDetection-->>TestWorkflows: returns changed files and lanes
  TestWorkflows->>RequiredChecks: reports test results
Loading
Merge Risk: ⚪ Minimal · up to e260b

No actionable issue was found in the merge-queue changes. The queue-triggered checks can proceed through normal validation before merge.

Pre-merge checks: Passed 6
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: running required checks in GitHub's merge queue.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns Passed PASS: The reviewed pull request changes only GitHub workflows, the merge-base action, and CONTRIBUTING.md. It adds no modelopt or examples Python changes, no eval/exec or unsafe loading changes, and n…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (10 skipped: 10 unsupported.)

Full details: Security Anti-Patterns

Explanation

PASS: The reviewed pull request changes only GitHub workflows, the merge-base action, and CONTRIBUTING.md. It adds no modelopt or examples Python changes, no eval/exec or unsafe loading changes, and no pyproject.toml or requirements.txt dependency changes.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test c45aa28

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.44%. Comparing base (d7cbff3) to head (e260b71).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2858      +/-   ##
==========================================
- Coverage   76.99%   76.44%   -0.56%     
==========================================
  Files         658      658              
  Lines       73950    73950              
==========================================
- Hits        56939    56530     -409     
- Misses      17011    17420     +409     
Flag Coverage Δ
examples-diffusers 20.05% <ø> (ø)
examples-gpt-oss 13.52% <ø> (ø)
examples-hf_ptq 23.19% <ø> (-0.04%) ⬇️
examples-llm_distill 13.60% <ø> (-0.01%) ⬇️
examples-llm_eval 17.25% <ø> (ø)
examples-llm_qat 17.49% <ø> (-0.01%) ⬇️
examples-llm_sparsity 15.77% <ø> (ø)
examples-megatron_bridge 26.41% <ø> (-0.18%) ⬇️
examples-specdec_bench 13.30% <ø> (ø)
examples-speculative_decoding 17.48% <ø> (-0.06%) ⬇️
examples-torch_onnx 21.41% <ø> (ø)
examples-torch_trt 15.25% <ø> (ø)
examples-vllm_serve 15.09% <ø> (ø)
gpu 50.45% <ø> (-0.71%) ⬇️
regression 15.10% <ø> (-0.01%) ⬇️
unit 60.40% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shengliangxu
shengliangxu removed this pull request from stack #2856 October 17, 2026 06:58
@shengliangxu
shengliangxu changed the base branch from shengliangx/ci-11-megatron-session-pool to main October 17, 2026 06:58
@shengliangxu
shengliangxu force-pushed the shengliangx/ci-12-merge-queue branch from c45aa28 to 02dd64c Compare October 17, 2026 06:59
@shengliangxu shengliangxu changed the title [12/12] Run the required checks in GitHub's merge queue Run the required checks in GitHub's merge queue Oct 17, 2026
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 02dd64c

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-2858/

Built to branch gh-pages at 2026-10-18 22:29 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@shengliangxu
shengliangxu added this pull request to stack #2861 October 17, 2026 07:34
@shengliangxu shengliangxu changed the title Run the required checks in GitHub's merge queue [1/2] Run the required checks in GitHub's merge queue Oct 17, 2026
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 4665a0d

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test ed7fe85

@shengliangxu shengliangxu changed the title [1/2] Run the required checks in GitHub's merge queue [OMNIML-6182] [1/2] Run the required checks in GitHub's merge queue Oct 18, 2026
@shengliangxu
shengliangxu marked this pull request as ready for review October 18, 2026 22:23
@shengliangxu
shengliangxu requested a review from a team as a code owner October 18, 2026 22:23
The merge queue builds a temporary branch of the target branch plus the
queued pull requests and waits for the required status checks on it. The
unit, code quality and docs workflows only ran on pull_request events, and
the GPU, example and regression workflows only on pushes to the copy-pr-bot
branches (pull-request/N) and on schedule, so no required check would ever
report on a merge group.

Add the merge_group trigger (checks_requested) to all six workflows and treat
a merge group like a PR run:

- The gate of the GPU, example and regression workflows and the unit tests'
  changed-files check diff the group against the commit it was built on (the
  pr-merge-base action reads it from the merge_group payload), so the same
  lanes run as on the PR and the wait for the unit `linux` check stays.
- The *-pr-required-check aggregators, the single-GPU runners, the example
  timeouts, hf_ptq's -n 4 and the left-out `manual` unit tests all key off
  "a PR run", which now includes a merge group.
- TruffleHog scans base..head of the group, like a PR.
- The Codecov uploads are skipped: a queue commit never lands on main.

Nightly, on-demand and PR runs behave as before. The queue itself is a
ruleset setting (see the PR description); CONTRIBUTING.md describes it.

Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
The merge_group triggers had no branch filter, so a merge queue enabled on any
branch would start the required checks there. Give the six triggers the
branches of their pull_request triggers (main, release/*, feature/*), which are
the branches that have the required checks, and say so in CONTRIBUTING.md.

Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
The PR-like predicate made several runner, if and env values up to 193
columns wide. Fold them into `>-` scalars broken after `&&` / `||` (the
parsed YAML value is byte-identical) and wrap two shell conditions and two
comments, so no line this PR adds is longer than 110 columns.

Signed-off-by: Shengliang Xu <shengliangx@nvidia.com>
@shengliangxu
shengliangxu force-pushed the shengliangx/ci-12-merge-queue branch from ed7fe85 to e260b71 Compare October 18, 2026 22:23
@shengliangxu
shengliangxu marked this pull request as draft October 19, 2026 19:59

This branch has not been deployed

No deployments
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