ci: save main sccache right after build; pull requests only read it #1733
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1740"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:00:45Z.
What
Two changes in
.github/workflows/windows.yml, from the CI audit of the 20-minute timeouts on main pushes. Nothing in thectestlines is touched, so this does not overlap #1173 (git merge-treeof this branch against #1173: 0 conflicts, and the merged workflow still parses and keeps--parallel 4).A. Main saves its compiler cache right after the build.
Cache not found for input keys: sccache-...-dev-and thenCache hits 0 / Cache misses 765.gh apishows no sccache entry onrefs/heads/main, only per-PR ones.actions/cachesaves in its post step and only if the job succeeds; the cold job (build 515 s dev, 645 s /O2, then up to 751 serial tests) hitstimeout-minutes: 20first, so nothing is saved and the next run is cold again.Build on Windows/Build on Windows at /O2),actions/cache/saveruns straight after it with!cancelled() && github.event_name != 'pull_request' && steps.build.outcome != 'skipped'(so a failed build still saves its objects), and only then the existing test step runs. The existing step is not edited: itscmake --buildbecomes a no-op (cost: a secondcmake --presetconfigure, about 12 s measured, plus an up-to-date ninja check).prbuild (measured, runs 45452219940 and 45451614588); main's dev and /O2 builds should drop by a similar factor once warm. That scale-up is an estimate until the first main runs after merge.B. Pull requests stop filling the repository cache.
gh apiactions/cache/usage: 10.94 GB active in 244 entries (limit 10 GB). The 100 newest entries (17:06 to 17:53 UTC) were 41 pip caches of 74 MB (3.0 GB) and 57 sccache-pr caches of about 22 MB (1.25 GB), about 5.5 GB per hour, which evicts main's entries first.cache: 'pip'only outside pull requests, and the compiler cache step is nowactions/cache/restorewith the-dev-/-release-prefix as restore key. Pull requests read main's entries (a PR can read its base branch's caches) and write none. The Linux job's 1 MB pip cache is unchanged.Not verified (read this)
Linux only: no Actions run of this workflow. Done locally:
yaml.safe_loadof the workflow and of the merge with #1173; checks that every${{ }}is balanced, step ids are defined before use, restore and save use identical key and path, no remainingactions/cache@for sccache;git diff --check;docs_links_check.py;bidi_controls_check.py;dev_ps1_sccache_check.py(text only, no pwsh here). To confirm after merge: the save step appears in the main run log (Cache saved with key: sccache-...) and the next main run shows hits. Open points: the first main run after merge is still cold (about 515 s and 645 s build, inside the 20 minutes); the key includes a hash of all sources, so each push that completes the build writes one new entry of roughly 70 MB, which is bounded by the 2 GBSCCACHE_CACHE_SIZEper entry and by the eviction of old ones.AI-assisted; commands listed were executed locally.
[PR #1740] ci: save the main sccache right after the build; pull requests only read itto [PR #1740] ci: save main sccache right after build; pull requests only read itImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:16:59Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
9f96425ebaℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:37:21Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:11:46Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
9f96425ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:16:59Z.
Code review location:
.github/workflows/windows.yml; line 254When a new source revision is built on a clean Windows runner, CMake writes generated headers/C++ into
out/build/...(CMakeLists.txt:465-471is one concrete example). Those files match thishashFilescall, so evaluating it after the build produces a different key from the restore step's pre-build key. Identical reruns then fall back torestore-keysrather than getting an exact hit, leaving the save condition true and causing needless archive/save attempts in both Windows jobs even when the cache is already warm. Reuse${{ steps.sccache-restore.outputs.cache-primary-key }}for both saves, or exclude the generatedout/**tree from both hashes.AGENTS.md reference: AGENTS.md:L28-L29
Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:37:21Z.
Code review location:
.github/workflows/windows.yml; line 254Fixed in
d65ac1d2:${{ steps.sccache-restore.outputs.cache-primary-key }}in both dev and releaseSave compiler cache(actions/cache/[email protected]) steps so the saved key always matches the pre-build key resolved bysccache-restore(actions/cache/[email protected]).'!out/**'tohashFiles(...)in bothRestore compiler cachesteps so pre-build files underout/cannot affect the primary key either.Verified locally with
/usr/bin/python3 -c "import yaml; yaml.safe_load(open('.github/workflows/windows.yml'))",git diff --check origin/main...HEAD,python3 tests/docs_links_check.py, andpython3 tests/bidi_controls_check.py.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:43:24Z.
The premise and the shape both check out
Cache state, from the API rather than the logs:
So the 126 sccache caches are attached to anything but
main, which matches what the PR read out of the run logs(
Cache not found for input keys: sccache-...-dev-). That is the mechanism the change targets, and it is real.Shape: the patch adds two
Restore compiler cachesteps, twoBuild on Windowssteps and twoSave compiler cachesteps,i.e. both the
devjob and the/O2job, not just one.Details that are right, and one I would change
Right, and worth saying so because they are the things that usually go wrong here:
…-dev-…/…-release-…instead of…-{{ pr|dev }}-…, so a pull request restores main'sentry. The
restore-keysprefix was changed with it (line 233–234 of the file holdssccache-…-dev-), so PR runs do notfall back to their own old
prkeys.key: ${{ steps.sccache-restore.outputs.cache-primary-key }}— the exact key that was looked up, not the key thathappened to match. With
restore-keyspartial hits that is the correct pairing.-dev-vs-release-), so neither can collide with the other and fail to reservea key.
steps.sccache-restore.outputs.cache-hit != 'true'means an exact hit does not re-save, while a partial restore does.What I would change:
actions/cache/savehas nocontinue-on-error. A cache failure — quota, or two runs racing for thesame key — therefore fails a job that has already built successfully and has not yet run its tests, which turns a cache problem
into a red
main. With 126 sccache entries in the repository and 2 GB allowed per entry this is not hypothetical. Addingto both save steps keeps the benefit (a saved cache) and drops the new failure mode (a lost cache reported as a build failure).
The condition already tolerates a failed build; the step itself should tolerate a failed save.
Minor:
steps.build.outcome != 'skipped'is unreachable-false givengithub.event_name != 'pull_request', since the build stepis skipped only for pull requests. Harmless, but a reader will wonder which of the two guards is meant to do the work.
What I did not verify
The 59–70 s → 14–17 s numbers. I have no way to run these jobs; I checked the cache inventory and the workflow logic, not the
timings. Those come from runs 45452219940 and 45451614588 as cited.
Verdict
The change does what it claims and the cache evidence supports the diagnosis. One suggestion (error-tolerant save) before
merge, since with the build split out, a save failure is now on the critical path of every
mainrun.Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:59:54Z.
Thanks @ChazY11, good catch. Done in
72e4cea4:continue-on-error: trueis now on bothSave compiler cachesteps, so a failed save no longer turns a built job red.