potiuk opened a new pull request, #75619:
URL: https://github.com/apache/airflow/pull/75619

   Merging a pull request does not stop its `pull_request` runs. Maintainers 
often merge as soon as the checks they need are green, while slower jobs of the 
same run are still queued or running, and those keep using the ASF's 
GitHub-hosted minutes and our self-hosted runners for a result nobody reads. So 
far maintainers have cancelled such runs by hand, when they noticed them; on 
2026-10-25 four runs of merged pull requests had to be cancelled that way, two 
of them only with force-cancel.
   
   This adds a pass to the fork CI monitor (`breeze ci fork-ci-reconcile`, 
every 15 minutes, already with `actions: write`) that cancels them 
automatically.
   
   ## What gets cancelled
   
   Each monitor run lists the `pull_request` runs of `apache/airflow` that are 
`queued`, `in_progress`, `waiting`, `pending` or `requested`, and looks up the 
pull requests of their head branches (one GraphQL query per 25 branches, paging 
through every pull request of a branch). A run is cancelled when:
   
   - a merged pull request has the run's head repository, branch and commit 
(runs of pull requests from forks do not list their pull request, so they are 
matched this way);
   - no open pull request has the same head, since a branch can be reused, and 
a common name such as `main` has pull requests from many forks;
   - the run was created before the merge, so workflows triggered by the merge 
itself, such as on `closed`, still run.
   
   It covers the pull requests of every author, not only those gated to fork 
CI. A run still `in_progress` 30 minutes after the merge, for example because a 
step ignores the cancellation, is force-cancelled. A run that finished 
meanwhile (HTTP 409) is fine; any other failure goes to Slack with the pull 
request, and a failure of the whole pass is reported as a note without 
affecting the reconciliation of gated pull requests. `--dry-run` only reports, 
and `cancel_merged_runs = false` in `.github/fork-ci-gate.toml` turns it off.
   
   Only runs of the merged head commit are matched; runs of earlier commits are 
normally cancelled by the workflow's concurrency group when the next commit is 
pushed.
   
   The design is in the new "Cancelling runs of merged pull requests" section 
of `dev/breeze/doc/ci/08_fork_ci_for_external_contributors.md`. The same idea 
is proposed for other ASF projects on the Infra website's GitHub Actions 
optimization page.
   
   ## Verified
   
   - Dry run against live `apache/airflow` on 2026-10-25 (`breeze ci 
fork-ci-reconcile --dry-run` from this branch): it picked exactly the two runs 
still going for #75618, merged 13 minutes earlier 
([40222615146](https://github.com/apache/airflow/actions/runs/40222615146), 
CodeQL, and 
[40222615398](https://github.com/apache/airflow/actions/runs/40222615398), 
Tests (AMD)), and left the runs of open pull requests alone. Nothing was 
cancelled: both runs were still in progress afterwards.
   - The `dev/breeze` test suite passes (1881 passed, 7 skipped), with new 
tests for the matching rules, force-cancel, paging through a branch's pull 
requests, the 409 handling, the switch and the Slack reporting.
   - prek pre-commit hooks pass (the Docker-based lychee link check was not 
run), and so does `mypy-dev`.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to