Skip to content

ci: cancel superseded Packages runs on main unless the push changes Desktop - #1415

Merged
abrichr merged 4 commits into
mainfrom
ci/main-dedupe
Oct 20, 2026
Merged

abrichr merged 4 commits into
mainfrom
ci/main-dedupe

Conversation

@abrichr

@abrichr abrichr commented Oct 20, 2026

Copy link
Copy Markdown
Member

Why

Packages runs on main were never cancelled, so every push queued a full run behind the previous ones.

Baseline over the last 24 completed main push runs (medians):

Metric Value
Wall time 51.3 min
Job queue wait 14.1 min
Longest job wait in a run 18.9 min
Jobs per run 11
Runner-minutes per run 66

In the last 48 hours main got 137 first-parent pushes. Only 12 of them changed packages/desktop.

The only reader that needs a particular main commit's own Packages run is desktop-release.yml. It waits for the push run of the newest first-parent commit that changed packages/desktop (#1398).

What changes

packages.yml concurrency:

  • Pull requests: unchanged. A newer push supersedes the older run.
  • A push to main whose payload mentions packages/desktop/ (any commit's file lists, or even a message): keeps its own packages-<sha> group and is never cancelled.
  • A push without a commit list: also keeps its own group and is never cancelled.
  • Every other push to main: shares packages-main-without-desktop with cancel-in-progress, so a newer push cancels the older run.
  • Merge queue groups and dispatches: per-SHA and never cancelled.

The Desktop test is deliberately conservative. A false "Desktop" match only means a run isn't cancelled.

tests/test_packages_concurrency.py keeps the Desktop exception, the per-SHA fallback, and the rule that queue and dispatch runs are never cancelled.

Savings

I replayed the last 48 hours of first-parent push times against the 51-minute median run:

  • 112 of the 125 non-Desktop pushes were superseded before their run would have finished, so they would now be cancelled.
  • That's up to 112 × 66 ≈ 7,400 runner-minutes over 48 hours. It's an upper bound, since a cancelled run has usually done some work.
  • More importantly, those runs no longer hold the 20 job slots (5 macOS) that PR runs wait for. I'll post measured queue medians after a day of main traffic.

What this gives up

A non-Desktop commit that is superseded within the hour no longer gets its own green or red result on main; the next commit's run covers the same tree plus more. With the merge queue (#1412), each group is tested before it lands.

Coordination

I've told the session moving the release trigger to workflow_run. workflow_run also fires for cancelled runs, so that trigger should act only on a successful run for a Desktop-changing first-parent commit. This PR changes no release workflow, and never cancels a release run or the run for a Desktop-changing commit.

Verified

  • The workflow parses.
  • tests/test_packages_concurrency.py and tests/test_desktop_release_subject.py pass.

🤖 Generated with Claude Code

abrichr and others added 3 commits October 20, 2026 01:34
…esktop

A push to main whose commits mention packages/desktop/ keeps its own
concurrency group and is never cancelled, because desktop-release.yml waits
for the Packages run of the newest first-parent commit that changed Desktop
(#1398). Every other push to main shares one group with cancel-in-progress,
so a newer push cancels the older run instead of queueing behind it. Merge
queue groups and dispatches are never cancelled. tests/test_packages_concurrency.py
keeps the Desktop exception in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub truncates a push payload's commit list at 20 entries, so a large push
could hide a packages/desktop change from the toJSON check and have its run
cancelled. Such a push now keeps its own group, like a Desktop change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit added the guard to packages.yml but left the test
asserting the old expression, so it failed. The test now requires
!github.event.commits[19] in both the group and cancel-in-progress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@abrichr

abrichr commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

Update: a push with 20 or more commits now keeps its own group and is never cancelled. GitHub truncates the push payload's commit list at 20, which could hide a packages/desktop change. The guard is !github.event.commits[19], in both group and cancel-in-progress, and tests/test_packages_concurrency.py requires it. Compatible with #1414: workflow name, job prefixes and Desktop-push behavior are unchanged.

@abrichr abrichr closed this Oct 20, 2026
@abrichr abrichr reopened this Oct 20, 2026
@abrichr
abrichr merged commit 6b363f5 into main Oct 20, 2026
11 of 39 checks passed
@abrichr
abrichr deleted the ci/main-dedupe branch October 20, 2026 15:39
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.

1 participant