Skip to content

ci: skip test-only jobs on queue pushes to main and cancel failed merge groups early - #1527

Queued
LeeroyHannigan wants to merge 3 commits into
mainfrom
ci/merge-queue-waste
Queued

LeeroyHannigan wants to merge 3 commits into
mainfrom
ci/merge-queue-waste

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

  • 7d73c12 adds the conclusion cancelled to the check-run match of the watch. GitHub gives a job that reaches its timeout-minutes the conclusion cancelled, as check runs 127967839757 and 133461095176 show. The time-limit scenario of the harness used timed_out, so no scenario covered this case.
  • The What section now names each skipped job. The earlier list omitted cassandra-authorizer and said "catalog jobs", but cassandra-catalog-checks still runs.
  • The harness has 23 scenarios. Two are new: a required job cut at its time limit with cancelled, and a cancelled job outside the watched workflows. The third added case, a run that ended before its cancel request, was in the harness already, but the earlier count of 20 omitted it.

What

This PR makes two changes. Both reduce the runner time that the merge queue wastes on the capped extenddb_ubuntu-2404_4-core pool.

  1. Skip the test-only jobs on the merge queue's pushes to main. That push lands the merge group commit that the queue tested. On that push, Integration Tests, MongoDB Integration Tests and Cassandra Integration Tests now skip 25 of their 39 jobs. In these counts, each matrix shard is one job. The skipped jobs are:

    • Integration Tests: run-integration (3 shards), run-integration-sqlite (3 shards), run-integration-backup, run-integration-sqlite-s3, run-rust-integration, run-rust-integration-sqlite and the summary job integration.
    • MongoDB Integration Tests: mongodb-pytest (3 shards), mongodb-backup-store, mongodb-catalog and the summary job mongodb-integration.
    • Cassandra Integration Tests: cassandra-pytest (5 shards), cassandra-rust, cassandra-authorizer and the summary job cassandra-integration.

    The jobs that build into target/ under rust-cache still run. Only a push to main saves the caches that the other runs restore. The three Rust jobs in the list build only tests/rust, whose target/ rust-cache does not save. A person's push, or a person's re-run of the queue's push run, still runs every job, because the condition reads github.triggering_actor.

  2. Cancel the rest of a merge group when a required workflow fails. The new workflow .github/workflows/merge-group-fail-fast.yml runs on merge_group only. Its watch job holds only read permissions. It reads the required checks of the base branch from branch protection. Then it polls the runs and check runs of the group every 30 s. The trigger is a job with the conclusion failure, timed_out or cancelled in a workflow that reports a required check. A job that reaches its time limit ends as cancelled. A run of such a workflow that fails to start is also a trigger. A separate cancel job then cancels the other runs of the group. Only this job holds actions: write. The summary jobs still run (if: always()) and report the failure.

Why

Data from 18 to 27 November 2026 (93 merge groups, about 2,200 workflow runs):

  • The median time from first enqueue to merge was 82 min. A merge group takes about 24 min when runners are free. Most of the remaining time went to waits for the 60-runner pool. The pool stayed saturated for hours, with up to about 470 jobs in its queue.
  • Each merged PR ran the full suite about 4 times: on PR pushes, in the queue, and again on the push to main.
  • All 49 queue pushes to main in the data tested a commit again after its merge group run passed. On the push runs of c175e42, the jobs that this PR skips took 237 of 353 runner-minutes in these workflows.
  • After their first failure, 24 failed merge groups used 4,469 more runner-minutes. Most of them used 300 to 390 runner-minutes each.

Testing done

  • actionlint 1.7.12 with shellcheck 0.11.0 reports only the seven SC2034 warnings in integration.yml that main also has. The run used a config that declares the runner label extenddb_ubuntu-2404_4-core. It covered this branch and its merge with main at 5826e1b.
  • devtools/check-actions-pinned and its --selftest pass. The new workflow uses no actions.
  • An offline harness ran 23 scenarios. In each scenario, the scripts of both jobs ran under bash -e against recorded API responses of a past merge group. A fake gh recorded each cancel request and did not send it. The scenarios covered these cases:
    • A required job fails, ends as timed_out, or ends as cancelled at its time limit. A required run fails to start. The script cancels each other unfinished run once. It never cancels its own run.
    • A green group, and failed check runs of push and scheduled suites on the same commit. The script cancels nothing.
    • A failed or cancelled job in a workflow that is not required (wasm), and cancelled check runs of other suites on the same commit. The script cancels nothing.
    • A check that branch protection no longer requires. The script cancels nothing.
    • A check that only a ruleset requires, or protection data without the checks field. The script watches nothing.
    • Required checks that the script cannot read. The script watches nothing.
    • API errors. The script tries the call again.
    • A cancel request that fails. The script writes a ::warning:: for that run and cancels the other runs. A run that ended before its cancel request gets a note and no warning.
    • A failed group with no unfinished run. The cancel job does not start.
    • A required run that never appears, the 350-minute deadline, an empty SHA, and job names that contain commas.
    • A jq error during the evaluation, and a check-run list larger than the 128 KiB argument limit. The script tries again and does not cancel.
  • On 80526f5 the cancelled time-limit scenario fails. In that scenario the summary job test has not failed yet, and in that state the old watch cancels nothing. The other 22 scenarios pass on both commits.
  • Read-only live runs of the watch step used the GitHub API:
    • Green group 5026c89: the step reported "finished with no failure".
    • Failed group e8a1c8e: the step found the failed jobs run-tests (stable) and test and the failed run of test.yml. It also found five jobs cancelled after that failure: the matrix fail-fast cancelled one, and a forced cancel of two runs cancelled the other four.
  • The cancel path cannot run before merge, because it needs a live failed merge group. The merge group of this PR runs the watch job. Neither job is a required check. A fault in either job leaves the queue as it is today.

Trade-offs

  • In a cancelled group, a second, independent failure shows as cancelled. In the week to 27 November 2026, 9 of 22 failed groups had another failure more than 45 s after the first. The most frequent second failure was mongodb-rust.
  • The summary jobs run on the capped pool. When no runner in the pool is free, the queue learns of the failure at the same time as today. The cancel still frees the runners.
  • Queue merges no longer get a second test run on main after the merge. Timings for shard weights and timeouts must now come from merge group runs.
  • The registry caches of the three skipped tests/rust jobs stop updating. After the next stable toolchain release, these jobs download their crates again. That takes seconds.
  • A run created after the watch job finds the failure keeps running. In 1 of 33 recent merge groups, one run started 109 s after the others.
  • After a cancel, several required checks show as failed. Only the notice of the fail-fast run names the jobs and runs that started the cancel.
  • When a person cancels a run of a required workflow in a merge group, the watch cancels the rest of the group. After a normal cancel, that group cannot merge in any case, because the required check of that workflow fails. A forced cancel skips the summary job, so a re-run of that run could still pass. The watch still cancels the rest of the group.

Overlaps

No open or recent PR makes either change. Other open PRs change the same workflow files. Of these, only #874 and #318 conflict with this PR, in integration.yml. Both already conflict with main in that file.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace) (no Rust changes)
  • Code is formatted (cargo fmt --check) (no Rust changes)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic) (no Rust changes)
  • I have added or updated tests for new functionality (the offline harness stays outside the repo, see Testing done)
  • I have updated documentation if behavior changed (workflow comments)
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC: n/a (CI only)


By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

A push to main by the merge queue lands the merge group commit the queue
tested with the same workflows: the queue merges a group only after its
required checks succeed. Of the 50 pushes to main from 17 to 27
November 2026, 49 came from github-merge-queue[bot], and each landed a
commit whose merge_group run of Integration Tests had succeeded. Each of
those pushes ran the whole suite again on the capped pool.

On that push, Integration Tests, MongoDB Integration Tests and Cassandra
Integration Tests now skip the jobs that only run tests, and the summary
job that checks them:

- run-integration (3 shards), run-integration-backup,
  run-integration-sqlite (3 shards), run-integration-sqlite-s3,
  run-rust-integration, run-rust-integration-sqlite, integration
- mongodb-pytest (3 shards), mongodb-backup-store, mongodb-catalog,
  mongodb-integration
- cassandra-pytest (5 shards), cassandra-rust, cassandra-authorizer,
  cassandra-integration

That is 25 of the 39 jobs these workflows run on a push. On the push runs
of c175e42 the skipped jobs took 237 of 353 runner-minutes.

The jobs that build into target/ under Swatinem/rust-cache still run,
because a push to main is the only run that saves the caches the other
runs restore. The three Rust integration jobs skipped build only
tests/rust, whose target/ rust-cache does not save, so their caches hold
only the cargo registry.

The condition reads github.triggering_actor, so a person's push to main,
or a person's re-run of the queue's push run, still runs every job.
A merge group with a failed job in a workflow that reports a required
check cannot merge, but its other runs go on. From 18 to 27 November 2026, 24
merge groups had a failed job. After their first failure they spent 4,469
more runner-minutes on the capped pool, 300 to 390 for most of them.

.github/workflows/merge-group-fail-fast.yml runs on merge_group only:

- The watch job, with read permissions, reads the base branch's required
  checks from branch protection and keeps the listed workflows whose check
  is still required. It then polls the group's runs
  and check runs every 30 s, for up to 350 minutes.
- When such a workflow has a failed or timed-out job, or its run ends in
  failure with no job (a startup failure), the watch job passes the
  group's unfinished runs to the cancel job. That job holds actions: write,
  cancels each run, and warns about a run it cannot cancel.

A cancelled run's summary job still runs (`if: always()`) and reports the
failure. Neither job checks out or runs repository code, and neither is a
required check. When the required checks cannot be read, nothing is
watched. Every job of the seven watched workflows is in its summary job's
needs today, which the comments next to the summary jobs and the REQUIRED
list now ask to keep.

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

The fail fast trigger does not fire on a job that hits its time limit. The description says the trigger is "a failed job, or a job that reaches its time limit", and the watch step matches check runs with conclusion failure or timed_out. On this repo a time limit cut reports cancelled: check run 127967839757 (run 42240110473) and 133461095176 (run 43913418092), both run-tests (stable), have conclusion cancelled and the annotation "The job has exceeded the maximum execution time of 15m0s". So when an Integration, MongoDB or Cassandra shard hits its limit, nothing is cancelled until that workflow's summary job fails, and the summary waits for every other job in the workflow. I think adding cancelled to the conclusions in the check run filter fixes it: any cancelled job in a watched workflow already makes its summary fail (!= "success"), so it cannot cancel a group that would pass. Could you check which conclusion your harness used for the time limit scenario?

The list of skipped jobs in the description does not match the code. It names "the pytest shards, the backup, s3 and catalog jobs, the three tests/rust jobs and the summary jobs". The head also skips cassandra-authorizer, and cassandra-catalog-checks still runs. The 25 of 39 count is right. Could you name the authorizer job in that sentence?

I will approve once the time limit case triggers the cancel, or the description drops that claim, and the job list is corrected.

GitHub gives a job that reaches its timeout-minutes the conclusion
cancelled. Check runs 127967839757 and 133461095176 of run-tests
(stable) ended as cancelled, with the annotation "The job has exceeded
the maximum execution time of 15m0s". The watch matched only failure
and timed_out, so a required job cut at its time limit started no
cancel. In the four workflows with a summary job, the cancel waited
until that job failed. In Format, Clippy and Licenses, which have no
summary job, no cancel followed.

The watch now matches cancelled too. After a normal cancel or a
time-limit cut, a cancelled job fails the required check of its
workflow. The four summary jobs still run (if: always()) and require
every other job to succeed. In Format, Clippy and Licenses the job is
the required check. A forced cancel skips the summary job, so a re-run
of that run could still pass. The watch now cancels the rest of such a
group as well.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@navareamol The harness used timed_out for the time-limit scenario, so it never tested the conclusion that GitHub gives. Both check runs you found end as cancelled, with the annotation "The job has exceeded the maximum execution time of 15m0s".

7d73c12 fixes the watch:

  • The check-run match now includes cancelled.
  • A new harness scenario cuts a required job at its time limit with cancelled, while the summary job of its workflow has not failed yet. In that state the watch of 80526f5 cancels nothing, and the watch of 7d73c12 cancels the other runs of the group.
  • A second new scenario gives cancelled to a job of a workflow that is not required. It also gives cancelled to check runs of other suites on the same commit. The script cancels nothing.
  • All 23 scenarios pass on 7d73c12. The earlier description said 20 and omitted one scenario that the harness already had.

As you wrote, a cancelled job also fails the required check of its workflow. The four summary jobs still run after a cancel and require every other job to succeed. In Format, Clippy and Licenses the job is the required check. A forced cancel is the one exception: it skips the summary job, so a re-run of that run could still pass. The watch now cancels the rest of such a group.

The description now names each skipped job by workflow. cassandra-authorizer is in the list, and cassandra-catalog-checks is not.

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

Both points from my review are fixed in 7d73c12. The check run filter now includes cancelled, and the description names every skipped job by workflow. I counted the list again: Integration 11, MongoDB 6, Cassandra 8, which is the 25 of 39.

I ran the changed watch step on the desktop with a fake gh and a fake clock, 13 scenarios of my own, since your harness is outside the repo. All 13 pass on 7d73c12. On 80526f5, 3 of them fail: a required job cut at its time limit while the summary has not failed, a cancelled job whose name has commas, and a cancel that shows up on the second poll. Removing cancelled from the filter makes the same 3 fail again. Removing the suite filter makes a cancelled wasm job and a cancelled check of another suite cancel the whole group. Removing the exclusion of the watcher's own run puts it in the cancel list. actionlint and shellcheck are clean.

I also looked for a case where counting cancelled would cancel a group that would have passed. In the last 45 merge groups that landed on main, no check run in a required workflow has the conclusion failure, timed_out or cancelled, so I found none.

I did not measure a forced cancel of a run on GitHub, so the claim that its summary job is skipped is yours and not checked by me.

All 62 checks pass on 7d73c12, so I approve.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Dec 4, 2026
Any commits made after this event will not be merged.

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.

2 participants