ci: coalesce nightly publishes into a one-hour window
.github/workflows/nightly.yml ran 189 times in the 24 hours ending 2026-09-22T17:00Z (184 push, 5 schedule, all on main). 142 were cancelled while still queued, but the 40 that completed cost 2,032 runner-minutes per day — the second largest macOS consumer in the repo, against a Blacksmith macOS pool of roughly ten slots whose queue reached 36 deep today. Caching is not the cause: a successful build-nightly-app log had 1,132 Cache hit lines and zero misses, and 17.3 min is the warm number. The cause is cadence. main takes ~210 commits a day, the workflow fires on every one of them, and concurrency with cancel-in-progress: false lets the pipeline run back to back around the clock — median 23.4 minutes between successful run starts.
Nothing consumes that rate. An installed NIGHTLY polls its Sparkle feed once an hour: UpdateSettings registers SUScheduledCheckInterval at 60 * 60 and migrates older installs off the legacy 24h value (Packages/macOS/CmuxUpdater/Sources/CmuxUpdater/UpdateSettings.swift). The appcast only ever advertises the newest build, so a publish superseded inside that hour is never offered to any install.
Resulting behavior
decide holds a main build until the commit this channel last published is at least CI_NIGHTLY_MIN_PUBLISH_INTERVAL_MINUTES (default 60) old; the intermediate pushes fold into the next build. The daily 47 8 * * * tick becomes hourly 47 * * * *, so a main that goes quiet still publishes its newest revision rather than stranding it until the next merge.
- Bounded staleness.
main's newest revision is published at most one window (60 min) after the previous publish, plus the ~30-minute pipeline. The window is measured at run start against the published commit — not between commits — so it drains on the next push or hourly tick instead of waiting for more merges. - RC is untouched. The window is scoped to
isMainRef. Everyrc/**push still builds its own candidate. Norc/**run occurred in the measured window. - The feed contract is unchanged. No publication step moved. Each channel's feed still advances only within its own channel, and the release tag still moves only after every publication step succeeds.
- Escape hatches keep working.
force,build_only,fast, and cache seeding all bypass the window. SettingCI_NIGHTLY_MIN_PUBLISH_INTERVAL_MINUTES=0restores a build per push without a code change. - It fails open. An unreadable last-published commit publishes the revision rather than silently withholding it.
Expected saving
Per publish, from the measured per-job averages: 17.3 (build-nightly-app, Warp) + 9.2 + 7.0 + 6.4 (build-sign-notarize-nightly universal/x86_64/arm64, Blacksmith) + 3.3 (build-nightly-ghostty-cli-helper, Warp) + 3.0 (publish-nightly, Linux) = 46.2 runner-min. Going from 40 publishes/day to the 24/day the window permits removes 16 × 46.2 = 739 runner-min/day, 36% of the workflow's 2,032:
| pool | per publish | × 16 fewer publishes |
|---|---|---|
| Warp macOS (paid overflow) | 20.6 | 330 min/day |
| Blacksmith macOS (10 slots) | 22.6 | 362 min/day |
| Linux | 3.0 | 48 min/day |
Against that, the hourly tick adds 23 scheduled decide runs/day on Linux (~20 s each, ~8 min/day), and coalesced pushes still pay one decide run plus one extra API call.
The compilation cache stays hot
refresh-compilation-cache and refresh-test-compilation-cache are unchanged — still the 17 */6 * * * seed, still 171 min/day. build-nightly-app restores xcode-compilation-release-<os>-<arch>-<toolchain>- by prefix and saves per-SHA, so the newest entry becomes ~60 min old instead of ~36. The 6-hour warmer already treats a six-hour gap as survivable and cache eviction is measured in days, so nothing new goes cold. The real cost is drift, not eviction: each build now carries ~8 commits of change instead of ~5, so build-nightly-app may run somewhat longer than 17.3 min. Even at 20 min the row falls from 692 to 480 min/day.
Validation
tests/test_nightly_universal_build.sh pins nightly.yml verbatim, including the four job-level if: conditions and the shouldBuild expression, so this change had to update its guard in the same commit: the 47 8 * * * schedule strings, the pinned shouldBuild line, and the two comments naming the daily schedule. That is a guard edit, not a guard relaxation — the same assertions now pin the new strings, plus a new section that pins the cadence rule itself.
The new section extracts the real decide script from the workflow and runs it under node against a frozen clock, so the rule cannot regress into a no-op: a push 10 minutes after the last published commit coalesces; 61 and 180 minutes publish; rc/** and force bypass; a lookup failure publishes; CI_NIGHTLY_MIN_PUBLISH_INTERVAL_MINUTES=0 restores a build per push. Mutating / 60000 to / 1000 in the workflow fails the first assertion, confirming it bites.
Ran the full workflow-guard-tests command list from ci-guards.yml (131 commands): all pass except four that fail identically on clean origin/main or need unavailable tooling — test_dev_fleet_warm_slot.py (pre-existing failure, reproduced on a stashed tree), test_check_ghostty_zig_workflows.py (no bashlex), test_ghostty_zig_version_sync.sh (submodule not checked out), test_ci_nightly_prune_python_compat.sh (no python3.9).
PASS: nightly workflow builds once, thins per architecture, and keeps the legacy track migrating
PASS: pull request jobs restore caches read-only, and every Swift package cache they read is seeded from main
PASS: release guard structure
PASS: no workflow falls back to a Warp runner
PASS: CI change area filter
all workflow guards are wired
Python test execution registry valid: 219 tests
test-determinism: 0 active finding(s), 0 allowlisted, 0 total
Remaining gap
I could not establish how many of the 40 daily publishes a human ever downloads. Release asset download counts do not separate installs from CI: scripts/ci/fetch-previous-nightly-dmgs.py --count 2 makes every immutable DMG get fetched by the next two builds, and every per-build cmuxd-remote-* asset carries a uniform count of 2 that the delta step never touches, so the residual attributable to real installs is ~1 per DMG and indistinguishable from noise. The 378 .delta assets — which only a Sparkle client fetches — total 425 downloads with 62 at zero, which shows installs do update, but not that they need 40 chances a day rather than 24. The load-bearing evidence is the one-hour poll interval, not the download counts.
Scheduled events on this repository are delivered late: the four 17 */6 ticks in the measured window started 15, 43, 26, and 21 minutes after their cron time. The hourly tick is a backstop for a quiet main, not the primary path — pushes still drive publication — but a quiet main inherits that jitter on top of the 60-minute window.
Related: #13652 (macOS runner variables pointed at paid Warp overflow), #13707 (app-host unit tests burning 36% of macOS capacity).
🤖 Generated with Claude Code
Summary by cubic
Coalesces nightly macOS publishes into a one-hour window so a full signed build no longer runs on every main push (~40/day, 2,032 runner-min/day) when installed apps only poll the Sparkle feed once an hour. decide now holds a main build until the last published commit is at least 60 minutes old (configurable via CI_NIGHTLY_MIN_PUBLISH_INTERVAL_MINUTES), and the daily 08:47 UTC tick becomes hourly so a quiet main still publishes its newest revision.
- Cuts ~16 publishes/day, saving ~739 runner-min/day (36% of the workflow's cost).
- The window is scoped to main only; every
rc/**push,force, build-only, and cache-seeding run bypasses it. - A lookup failure publishes rather than silently withholding the revision.
- The guard test now executes the real
decidescript against a frozen clock to pin the coalescing rule.