Skip to content

perf(ci): cancel superseded CodeQL runs and idle triggers - #4763

Merged
dan-petty merged 2 commits into
mainfrom
perf/4651-codeql-idle-triggers
Nov 11, 2026
Merged

dan-petty merged 2 commits into
mainfrom
perf/4651-codeql-idle-triggers

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

CodeQL has no concurrency group and no job timeout, so an old pull request head runs to the end and a hung job can run for 360 minutes. A pull request run now cancels the run of the old head. A push to main and the schedule each use a group of their own run, so each commit of main is analysed. The analyze job has a 15-minute timeout (measured maximum 212 s).

Fail-to-Pass skips an edit of the body alone, which changes neither the replay nor the job condition. That run uses a group of its own, so it cannot cancel the replay of the head. An edit of the title or the base runs the job again.

Cleanup PR DevContainer no longer starts on a closed pull request, because no workflow pushes a pr- tag. The daily schedule and workflow_dispatch stay.

Closes #4651

Change: openspec/changes/archive/2026-11-11-4651-cancel-superseded-codeql-runs-and-idle/

CodeQL cancels the run of an old pull request head and has a job
timeout. Fail-to-Pass skips an edit of the body alone in a group of
its own. A closed pull request starts no cleanup run.
@dan-petty dan-petty added type/infra Type infra: the build, CI, images or cluster scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners labels Nov 11, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Before and after

Source: the Actions API, the last 100 runs of each workflow, read on 2026-11-11 at about 18:10Z.

Workflow Before (measured) After (expected)
CodeQL Advanced 100 runs (11:55Z to 18:11Z): 58 pull request, 42 push, 0 cancelled. 8 pull request runs were still running when a newer push to the same branch started a run. The analyze jobs of 50 runs: median 58 s, maximum 212 s, 127 runner-min (about 2.5 runner-min for each run). No job timeout (default 360 min). A newer push cancels the run of the old head: about 2 jobs and 2.5 runner-min less for each superseded push (8 in 6 hours in this sample). Job timeout 15 min. Each push to main and each scheduled run is still analysed.
Fail-to-Pass Test Replay 100 runs (07:18Z to 18:07Z): 24 runs repeat the head commit of an earlier run on the same branch (edited or reopened). 17 of them ran the replay job again, 53.6 run-min in total. An edit of the body alone gets a skipped job, with no runner time. An edit of the title or the base and a reopen run the job as before.
Cleanup PR DevContainer 100 runs in 27.9 hours: 99 from a closed pull request, 1 from the schedule. About 85 runs a day. Job median 16 s, maximum 57 s (each is one billed job minute). 0 runs from a closed pull request. 1 scheduled run a day.

Not measured yet

  • The after values are expected values. A pull request run uses the workflow file of the merge commit, so this pull request shows the new CodeQL group only if it gets a second push. The Fail-to-Pass path filter does not start that workflow for this pull request, because it changes no file under src/.
  • After the merge, these reads show the effect (no owner step is necessary, and no repository setting changes):
    • uv run devops gh api "repos/dan-petty/devops-cli/actions/workflows/codeql.yml/runs?event=pull_request&per_page=100" --jq '[.workflow_runs[].conclusion] | group_by(.) | map({(.[0] // "running"): length}) | add' shows cancelled runs.
    • uv run devops gh api "repos/dan-petty/devops-cli/actions/workflows/cleanup-devcontainer.yml/runs?event=pull_request&per_page=1" --jq '.workflow_runs[0].created_at' shows no run after the merge.

Checks run locally

  • uv run devops ci --only actionlint,zizmor: pass.
  • uv run pytest tests/invariants/test_workflow_contracts.py: 117 passed. The changed contract tests failed on the old workflow first (22 failed).
  • uv run devops ci docs, uv run devops openspec check: pass.

This pull request is a perf change, not a fix, so it has no fail-to-pass run.

@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 18:38
@dan-petty
dan-petty enabled auto-merge (squash) November 11, 2026 18:38
@dan-petty
dan-petty merged commit c951368 into main Nov 11, 2026
31 checks passed
@dan-petty
dan-petty deleted the perf/4651-codeql-idle-triggers branch November 11, 2026 18:48
@dan-petty

Copy link
Copy Markdown
Owner Author

After the merge: the close of this pull request (merged at 18:48:25Z) started no Cleanup PR DevContainer run. The last run with event pull_request started at 18:37:49Z, before the merge. The CodeQL cancellations need newer pushes to open pull requests. The first read in the comment above shows them.

dan-petty pushed a commit that referenced this pull request Nov 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.112.3](v0.112.2...v0.112.3)
(2026-11-11)


### Bug Fixes

* **ai:** record the duration of each agent model request
([#4717](#4717))
([1930b71](1930b71))
* **devcontainer:** poll the Docker daemon through the clock
([#4721](#4721))
([be32268](be32268))
* **roadmap:** confine repair fix turns to the plan files
([#4689](#4689))
([d2e7597](d2e7597))
* **roadmap:** name the nearest test of a module
([#4696](#4696))
([b746c95](b746c95))
* **roadmap:** scoped intake reads a bounded page count
([#4740](#4740))
([f89ccc5](f89ccc5))
* **roadmap:** stage context reads runner facts from the package
([#4723](#4723))
([05e09dc](05e09dc))
* **roadmap:** stage holds an item where openspec is not set up
([#4749](#4749))
([45bd54a](45bd54a))
* **roadmap:** trace gate reads a tool call citation
([#4694](#4694))
([5c71ad4](5c71ad4))


### Performance Improvements

* **ci:** cancel superseded CodeQL runs and idle triggers
([#4763](#4763))
([c951368](c951368))


### Code Refactoring

* **ai:** delete orphan prompts and the prompt fallbacks
([#4710](#4710))
([38a1b13](38a1b13))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners type/infra Type infra: the build, CI, images or cluster

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(ci): cancel superseded CodeQL runs and idle triggers

1 participant