Sub topic 12
Troubleshooting common queue problems
This chapter covers the problems that stall a merge queue or remove pull requests from it, and how to find the cause of each. It assumes you can read GitHub Actions workflow syntax, you know how required status checks work, and you have already enabled a merge queue on a branch by following the earlier chapters.
A triage order that works
Most queue problems come from a small set of causes. Check them in this order, because the early checks are cheap and explain most cases:
- Did the required checks start on the merge group at all?
- If they started, did they report under the names the branch rule expects?
- If they reported, did one of them fail or time out?
- If everything passed, is the queue waiting on its own settings?
Symptom: the pull request waits forever for checks
This is the most common failure. The pull request enters the queue, GitHub creates the temporary gh-readonly-queue/main/pr-123-<sha> branch, and the queue then waits for the required checks. If no workflow runs for that branch, nothing ever reports. After the configured check_response_timeout_minutes (60 in the earlier ruleset example), the queue removes the pull request.
The cause is almost always a workflow that only listens for pull_request. It reported on the pull request branch, but it never starts for the merge group. The fix is to add the merge_group trigger:
name: CI
on:
pull_request:
branches: [main]
merge_group:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: make testSeveral details trip people up even after the trigger is added:
- GitHub runs the workflow file as it exists on the merge group commit, not the version on the pull request branch. A workflow change that is only in a queued pull request does not apply to that pull request's own merge group in the way you might expect, so test workflow edits before queueing them.
actions/checkoutchecks out the merge group commit by default, so your tests run against the combined result. Do not hard-coderef: ${{ github.head_ref }}. That variable is empty outside pull request events, and pinning to the pull request head would defeat the purpose of the queue.- Workflow-level
pathsfilters are a trap. A workflow skipped by a path filter reports nothing, so a required check stays pending. Do not rely onpathsto limit work on required workflows. Use a job-levelifinstead, because a job skipped byifreports as skipped, which counts as passing. - Workflows that use
workflow_dispatchorpushalone are never started by the queue. Onlymerge_groupevents start for the merge group.
Symptom: checks ran but the queue says they are missing
A required check is matched by name. If the name differs, the queue waits for a name that never appears. Common reasons:
- A matrix job reports under names such as
test (18)andtest (20). Adding a matrix value changes the set of names and can silently orphan a required check. - A job was renamed with
name:and the rule still lists the old name. - A reusable workflow produces names that include the caller job, such as
caller / callee. - A check was configured to come from a specific app, and a different app (or Actions) now reports it.
A stable gate job removes this whole class of problems. Require only the gate, and let it summarize everything else:
name: CI
on:
pull_request:
branches: [main]
merge_group:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm test
ci-ok:
if: always()
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Fail unless every needed job succeeded
run: |
if [ "${{ needs.test.result }}" != "success" ]; then
echo "test result: ${{ needs.test.result }}"
exit 1
fiThe if: always() matters. Without it, ci-ok is skipped when test fails, and a skipped job counts as passing for a required check. That would let a failed build through. Make ci-ok the only required check in your ruleset.
Symptom: external CI never reports
Third-party CI systems receive events from GitHub and decide for themselves what to build. They must build the gh-readonly-queue/ branches. If your CI only builds pull requests or a fixed list of branches, add a rule that includes gh-readonly-queue/**. Then confirm it reports a status on the merge group commit under the exact name your rule requires. If the CI uses its own branch filters, check those first.
Symptom: the pull request is removed from the queue
GitHub removes a pull request, with a message on the pull request page, for one of these reasons:
| Reason | What happened | What to do |
|---|---|---|
| A required check failed on the merge group | Tests failed on the combined commit | Open the `merge_group` run, fix the cause, requeue |
| Check response timeout | Checks did not report within the configured minutes | Fix the trigger or names, or raise the timeout if builds are slow |
| Merge conflict | The pull request no longer merges cleanly with the base plus the entries ahead | Update the branch, resolve the conflict, requeue |
| A pull request ahead of it was removed | The merge group had to be rebuilt | Usually no action. Later entries are rebuilt without the removed one |
| A branch rule stopped being satisfied | A review was dismissed or a required rule changed | Restore the approval, then requeue |
Failures that only appear in the queue are the point of the feature. If the pull request passed on its own branch but failed on the merge group, the change interacts badly with something merged ahead of it. This is a semantic conflict. It is usually a real bug, not a queue defect.
To read the failing run from the command line:
gh run list --event merge_group --limit 10
gh run view RUN_ID --log-failedReplace RUN_ID with the ID from the first command. The list also shows the gh-readonly-queue/... branch name for each run, which tells you which pull request the run belongs to.
Symptom: everything passed but nothing merges
If checks are green and the pull request sits in the queue, look at the queue settings:
min_entries_to_mergegreater than 1 makes the queue wait for that many entries.min_entries_to_merge_wait_minutesis how long it waits before merging a smaller group. With a value of 5 minutes, a lone pull request can look stuck for 5 minutes.max_entries_to_buildlimits how many merge groups build at once. A long line of entries behind a slow build waits its turn.- A pull request that is awaiting review or has unresolved requirements is not eligible to enter the queue at all. If the Merge when ready button is missing, check the branch rule and the review state first.
A quick test is to temporarily set min_entries_to_merge to 1 on a quiet branch and see whether behavior changes. Compare the queue entry state in the pull request timeline with your settings before changing anything.
Symptom: the queue is slow after one failure
When a pull request fails, entries behind it were built on top of it. GitHub rebuilds them without the failed entry, and their checks run again. One flaky test can therefore waste the CI time of every entry behind it. Track flaky tests that fail only on merge_group runs, and fix or quarantine them. Slow builds cost more here than on pull requests, because every entry behind the slow one waits.
Quick checklist
- Every required workflow lists
merge_group. - Required workflows do not use workflow-level
pathsfilters. - The branch rule requires one stable gate job, or names that you have verified.
- External CI builds
gh-readonly-queue/**and reports the expected names. check_response_timeout_minutesis longer than your slowest normal build.- Minimum group size and wait time match how busy the branch is.
Exercise
A pull request enters the merge queue, and 60 minutes later it is removed with a timeout message. The same checks passed on the pull request. The workflow file has on: pull_request only. What is the cause, and what is the fix?
Show answer
The workflow never started for the merge group, so the required check never reported on the temporary gh-readonly-queue commit, and the queue timed out waiting. Add merge_group: to the on: section of the workflow (and confirm the job name still matches the required check), then requeue the pull request.
Exercise
Your gate job ci-ok has needs: [test] but no if: always(). A test fails in the queue. Why might the pull request merge anyway?
Show answer
When test fails, a job that needs it is skipped by default, and a skipped job counts as passing for a required check. Adding if: always() makes the gate job run, so it can inspect needs.test.result and fail explicitly.