Repository navigation
ci: skip test-only jobs on queue pushes to main and cancel failed merge groups early - #1527
LeeroyHannigan wants to merge 3 commits into
Conversation
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.
92e8542 to
80526f5
Compare
navareamol
left a comment
There was a problem hiding this comment.
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.
|
@navareamol The harness used 7d73c12 fixes the watch:
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. |
navareamol
left a comment
There was a problem hiding this comment.
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.
Changes since the last review
cancelledto the check-run match of the watch. GitHub gives a job that reaches itstimeout-minutesthe conclusioncancelled, as check runs 127967839757 and 133461095176 show. The time-limit scenario of the harness usedtimed_out, so no scenario covered this case.cassandra-authorizerand said "catalog jobs", butcassandra-catalog-checksstill runs.cancelled, and acancelledjob 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-corepool.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:
run-integration(3 shards),run-integration-sqlite(3 shards),run-integration-backup,run-integration-sqlite-s3,run-rust-integration,run-rust-integration-sqliteand the summary jobintegration.mongodb-pytest(3 shards),mongodb-backup-store,mongodb-catalogand the summary jobmongodb-integration.cassandra-pytest(5 shards),cassandra-rust,cassandra-authorizerand the summary jobcassandra-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 onlytests/rust, whosetarget/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 readsgithub.triggering_actor.Cancel the rest of a merge group when a required workflow fails. The new workflow
.github/workflows/merge-group-fail-fast.ymlruns onmerge_grouponly. Itswatchjob 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 conclusionfailure,timed_outorcancelledin a workflow that reports a required check. A job that reaches its time limit ends ascancelled. A run of such a workflow that fails to start is also a trigger. A separatecanceljob then cancels the other runs of the group. Only this job holdsactions: 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):
Testing done
actionlint1.7.12 with shellcheck 0.11.0 reports only the seven SC2034 warnings inintegration.ymlthat main also has. The run used a config that declares the runner labelextenddb_ubuntu-2404_4-core. It covered this branch and its merge with main at 5826e1b.devtools/check-actions-pinnedand its--selftestpass. The new workflow uses no actions.bash -eagainst recorded API responses of a past merge group. A fakeghrecorded each cancel request and did not send it. The scenarios covered these cases:timed_out, or ends ascancelledat its time limit. A required run fails to start. The script cancels each other unfinished run once. It never cancels its own run.checksfield. The script watches nothing.::warning::for that run and cancels the other runs. A run that ended before its cancel request gets a note and no warning.cancelledtime-limit scenario fails. In that scenario the summary jobtesthas not failed yet, and in that state the old watch cancels nothing. The other 22 scenarios pass on both commits.watchstep used the GitHub API:run-tests (stable)andtestand the failed run oftest.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.Trade-offs
mongodb-rust.tests/rustjobs stop updating. After the next stable toolchain release, these jobs download their crates again. That takes seconds.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
cargo test --workspace) (no Rust changes)cargo fmt --check) (no Rust changes)cargo clippy -- -W clippy::pedantic) (no Rust changes)Storagetrait, auth model, on-diskformat, 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.