Skip to content

ci.yml: superseded runs on next/hotfixes are never cancelled and starve the org's hosted runners #583

Done

Description

@Shinrai

The ci.yml template sets cancel-in-progress: true, but its group gets a unique -${{ github.run_id }} suffix whenever the ref is the default branch, next or hotfixes (or the PR head is next/hotfixes):

group: ci-${{ github.workflow }}-${{ github.ref }}${{ (github.ref == ... || github.ref == 'refs/heads/next' || ... ) && format('-{0}', github.run_id) || '' }}

So every push to next runs the full matrix to the end, even when a newer push to next has already started its own run. Feature branches cancel as expected.

What it caused on 2026-11-26: slothlet had 60 CI runs in progress at once, started between 02:44 and 02:54 UTC by back-to-back merges into next (#952, #953) plus a few branches. Their test and coverage matrices took every GitHub-hosted job slot the org has. From about 03:17 UTC no other CLDMV repo could start a hosted job: lib-sqlite-wasm, vitest-runner and fix-headers pushes and even issue workflows sat queued for 40+ minutes. GitHub status was green and billing was fine. slothlet is also $747 of the month's $1,183 Actions usage (free because it's public, but the slots are shared).

Fix:

  • Cancel superseded runs on next and hotfixes too. The newest commit on the branch is the one that ships, and its run covers everything before it.
  • If a job really must run once per commit (the post-merge lint/format autofix, the badge push), move it to its own job or workflow with its own non-cancelling group, so the expensive test and coverage matrix can still be cancelled.
  • Keep the default branch (master) uncancelled, since each push there is a release.
  • Consider a max-parallel cap on the build-and-test matrix (or an input for it), so one heavy repo can't take every hosted slot even within a single run.

The template change then needs syncing to every repo's ci.yml (slothlet first).

Activity

  1. added
    type: bug
    priority: high
    status: confirmed
    on Nov 26, 2026
  2. Shinrai commented on Nov 26, 2026

    @Shinrai
    ContributorAuthor

    Correction on the cause: only 2 of slothlet's in-progress runs were on next (#952, #953). Most were pushes to about 22 separate feature branches between 02:20 and 02:50 UTC, each a "Merge next and the PRs queued ahead of this one into " commit. Each branch is its own concurrency group and already cancels its own older runs, so cancelling superseded runs on next wouldn't have prevented this. 22 full matrices simply ran in parallel.

    The next cancellation is still worth doing, but the fix that matters is limiting how much one repo can start at once: a max-parallel cap on the build-and-test matrix, and not re-merging next into many branches in one go (or doing it without triggering a full CI run on each).

  3. added
    status: in progress
    and removed
    status: confirmed
    on Nov 26, 2026
  4. added
    status: implemented
    and removed
    status: in progress
    on Nov 26, 2026
  5. cldmv-bot commented on Nov 26, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #586, merged into next. This issue closes automatically when that work ships to the default branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: highstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions