ci: throttle main pushes by nightly published commit age
Summary
A push to main skips the Nightly build while the commit the nightly tag points at is less than NIGHTLY_PUSH_MIN_INTERVAL_HOURS old. The default is 2. Setting the repository variable to 0 restores publish-every-push without a PR.
Unchanged: RC branches, every manual dispatch (force, fast, build_only, seed_only), and both schedules. The 08:47 UTC schedule still catches up to main when GitHub starts that run; the cron time is not a delivery deadline, because scheduled runs can start late. If the tag or commit lookup fails, the run builds.
Data (7 days, 2026-09-15 12:47 to 2026-09-22 12:47 UTC, gh api)
- 392 push-to-main runs. 266 were cancelled while still queued, at no macOS cost, because the existing concurrency group already collapses bursts. 140 reached macOS and 101 published.
- Push-to-main macOS job time was 7,197 min, or about 1,030 min/day. Three hung
build-nightly-appjobs (996, 229 and 161 min) account for part of that; without them it is about 830 min/day. The whole workflow, including schedules and dispatches, used about 1,270 min/day. - Each publish costs about 51 macOS minutes at the median: app build 29, three sign/notarize jobs at 7 each, Ghostty helper 4.
- 70 of 101 publishes were replaced by another publish within 60 minutes. The median gap between publishes was 44 minutes, which matches the median trigger-to-publish time of 43 minutes. On busy days the pipeline runs back to back.
A replay of the same pushes, using the 43-minute pipeline and the 08:47 catch-up:
| interval | builds/day | merge β published, median / p90 / max |
|---|---|---|
| 0 (today) | ~21 | 1.1h / 1.4h / 1.4h |
| 2h (default) | ~9 | 1.9h / 3.1h / 5.9h |
| 4h | ~5 | 2.7h / 4.7h / 6.5h |
The expected result is about 55β60% fewer push builds, roughly 450β600 macOS min/day. The lower bound is about 280 min/day: 14.4 publishes a day becomes 9 or fewer, at 51 minutes each.
Trade-offs
- Latency. The two-hour threshold uses the published commit age, not publication time; build duration and push timing also affect delivery latency. In a quiet period it waits until the next push or 08:47 UTC. Anyone who needs a build sooner can dispatch the workflow.
- Compilation cache seeds (#13182). This does not affect the Debug seed that compile admission reads, because only the
17 */6schedule writes it. The Release seed (xcode-compilation-release-*) that the PR release-build lane restores is written by push builds and by the 6-hour schedule. It will be refreshed every 2 hours or so instead of every 45 minutes. The build step's own comment notes that the two whole-module compiles miss on every push anyway. - Why not
cancel-in-progressfor pushes? It was tried and reverted in 9fdf3d0f84. Merges land about 25 minutes apart at the median, and a publish takes 43 minutes, so cancelling would keep publishes from finishing and throw away partial builds. Run 35484670961 lost 157 macOS minutes when its signing jobs were cancelled. - #12610 skips builds whose changes are only web, docs or tests. That change is complementary: it avoids builds that change nothing, and this one limits how often builds that do change something run. Both edit
decide, so whichever lands second needs a small rebase.
Context: RFC #13095 (CI structure) and RFC #13325 (speed program).
Testing
python3 tests/test_ci_nightly_push_throttle.py(new) runs the realdecidescript under Node with a mocked API. It covers: young commit skips, old commit builds,0or invalid interval builds, lookup failure builds, same commit still skips, and schedule, dispatch and RC are never throttled. I also checked that it fails if the throttle is not limited topushevents.tests/test_nightly_universal_build.sh,tests/test_ci_release_guard_structure.py,tests/test_ci_linux_guard_routing.py,tests/test_ci_guard_workflow_structure.py: pass.tests/test_ci_change_areas.pyandtests/test_ci_workload_profiles.pyfail locally onmainwithout this change as well.
π€ Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Throttles push-triggered Nightly builds on main so the macOS pipeline is no longer busy around the clock. A push on main now skips while the commit the nightly tag points at is younger than NIGHTLY_PUSH_MIN_INTERVAL_HOURS (default 2; 0 restores publish-every-push). RC branches, manual dispatches, and both schedules decide exactly as before, and any lookup failure still builds.
Impact and trade-offs
- Expect ~55β60% fewer push builds, about 9/day instead of 21, saving roughly 450β600 macOS minutes per day.
- A merge can wait up to ~2 hours for a Nightly; the 08:47 UTC schedule still publishes whatever
mainHEAD is then. - Adds a test that runs the real
decidescript under Node with a mocked GitHub API and a fixed clock.
Summary by CodeRabbit
-
New Features
- Added configurable throttling for nightly macOS builds triggered by frequent pushes to the main branch.
- Builds are skipped when a recently published commit falls within the configured interval; scheduled, manual, and release-candidate builds remain unaffected.
- Set the interval to zero to restore builds for every push.
-
Tests
- Added automated coverage for throttling behavior, configuration values, event types, and lookup failures.
Validation after review fixes: fixed-clock behavioral suite passes, including exact interval boundaries; mutation checks confirm the non-default-interval and same-commit cases detect regressions. Release guard structure, 28 guard-routing tests, execution registry validation, and all required CI checks pass.