Repository navigation
ci: sccache read-only on pull requests, stable Linux CPU pin - #480
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
|
@coderabbitai review |
|
There was a problem hiding this comment.
Head 63805e07dce8e0279e77da77bfce8c8e12ced5fd. No blocking defect in the read-only switch or the Linux CPU pin. The pin matches the compiler default, and the replay job's command line stays the same.
SCCACHE_GHA_RW_MODE=READ_ONLY / READ_WRITE are the strings sccache 0.19.0 parses (cache_mode_from_env_var, case-insensitive). In that tag, RemoteStorage::check returns ReadOnly before the .sccache_check write when the mode is already read-only. A rate-limited read is logged and the server stays up. ReadOnlyStorage drops later puts, so a pull request does not store compile objects. SCCACHE_GHA_ENABLED=true is a value that parser accepts (true / on / 1).
The Linux flag is -C target-cpu=x86-64 only for x86_64-unknown-linux-gnu. rustc 1.89.0 --print cfg for that target is identical with and without the flag. target-cpu=native on this host adds fma and AVX-512; the pin does not. astraweave-physics/build.rs and aravath_runtime/build.rs refuse target-cpu=native and +fma, and this flag is neither. determinism-replay.yml still sets the same RUSTFLAGS after the action on every x86_64-* host, so the compare job's rustc command line is unchanged. aarch64 still sets no RUSTFLAGS. Windows is left alone here, so .cargo/config.toml keeps /STACK:16777216 and --stack,16777216 for every job except the replay pin step, which already replaced those flags. Root config has no Linux rustflags, so the new variable does not drop a link argument. gpu-frame-budget.yml and the allocation-measurement GPU job do not use this action.
integration-tests.yml, toolchain-management.yml, dependency-management.yml, and benchmark_alert.yml still install sccache-action@v0.0.9 and enable the GHA backend with no SCCACHE_GHA_RW_MODE. None of them run on pull_request. They still write on push to main and on schedule, and they do not pass the CPU pin, so their objects are a different cache key. Main's own ci.yml matrix remains READ_WRITE and can still hit the cache write limit.
Commands: python3 scripts/ci/test_workflow_policy.py -v exit 1. test_sccache_pull_requests_are_read_only passed. The two failures are pre-existing and outside this diff (aravath-windows.yml, determinism-profile.yml, aravath-determinism.yml, render-device-validation.yml). bash scripts/ci/player_facing_names.sh exit 0. actionlint is not installed. Replay hash tests were not run: no hashed crate changed and the replay pin step is unchanged. Expected hashes unchanged. GPU frame time not measured.
No new crate. Cargo.lock untouched. No deferred issue.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
| # evicts the shared cache. Main pushes and schedules populate it. | ||
| # CARGO_INCREMENTAL=0 is already required; sccache still refuses bins, | ||
| # cdylibs, and proc-macros. | ||
| if [ "${{ github.ref }}" = "refs/heads/main" ] && [ "${{ github.event_name }}" != "pull_request" ]; then |
There was a problem hiding this comment.
Actions expands ${{ github.ref }} and ${{ github.event_name }} before bash parses this script. github.event_name is a fixed token. github.ref is not: a branch name may contain ", ;, and $(). Today's callers do not hand that ref to a fork. pull_request uses refs/pull/N/merge, and ci.yml pushes only main and develop. Quote the runner variables, which are not reparsed:
if [ "$GITHUB_REF" = "refs/heads/main" ] && [ "$GITHUB_EVENT_NAME" != "pull_request" ]; thenThe write arm is also wider than the comment above it. Every event other than pull_request writes when the ref is refs/heads/main, including workflow_dispatch. There is no pull_request_target workflow in the tree. A later one that calls this action would write, because that event's github.ref is the base branch and its name is not pull_request. An allowlist of push and schedule matches the comment. Keep workflow_dispatch on that list only if a manual main run should keep populating the cache.
| echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" | ||
| echo "SCCACHE_CACHE_SIZE=10G" >> "$GITHUB_ENV" | ||
| echo "SCCACHE_IDLE_TIMEOUT=0" >> "$GITHUB_ENV" | ||
| # sccache 0.19 writes through the Actions cache. A pull request that |
There was a problem hiding this comment.
This comment treats sccache 0.19 as the implementation. The install step calls mozilla-actions/sccache-action@v0.0.9 with no version input, and that action installs the latest release when the input is empty. Latest on 2026-10-28 is v0.19.0 (published 2026-10-24), so SCCACHE_GHA_RW_MODE works today. In that tag, an unrecognized mode warns and config_from_env uses unwrap_or(ReadWrite). A later release that renames or drops the variable turns pull requests back into writers, and test_sccache_pull_requests_are_read_only still passes because it only searches this file for the string. Pass version: "0.19.0".
| def test_sccache_pull_requests_are_read_only(self) -> None: | ||
| action = (ROOT / ".github" / "actions" / "rust-ci-setup" / "action.yml").read_text(encoding="utf-8") | ||
| self.assertIn("CARGO_INCREMENTAL=0", action) | ||
| self.assertIn("SCCACHE_GHA_RW_MODE=READ_ONLY", action) |
There was a problem hiding this comment.
These assertIn checks stay green if the if / else arms are swapped, if READ_ONLY exists only in a comment, or if both echoes run unconditionally. GITHUB_ENV keeps the last assignment, so an unconditional pair that ends on READ_WRITE would write from every pull request and this test would still pass.
Lock one substring that contains the refs/heads/main condition and the READ_WRITE echo, and another that contains the else and the READ_ONLY echo. The same test never opens integration-tests.yml, toolchain-management.yml, dependency-management.yml, or benchmark_alert.yml. Those workflows still enable the GHA backend with no mode variable. They are not on pull_request, so they do not break this pull-request claim; they do keep writing on main pushes and schedules.
Pull requests read the Actions cache. Main pushes and schedules write. CARGO_INCREMENTAL=0 was already set. The Linux CPU pin is a cargo config target table beside the Windows stack flags. The shared setup does not set RUSTFLAGS, because Cargo 1.89 replaces every rustflags entry when that variable is set.
63805e0 to
9b7e9dd
Compare
There was a problem hiding this comment.
Head 9b7e9ddf66f19fabceeecb27b40ac91f57a588f4. No blocking defect. The read-only switch is unchanged since 63805e07. The Linux CPU pin moved out of this action into .cargo/config.toml, and that move does not change the replay rustc command line.
Determinism. determinism-replay.yml still appends RUSTFLAGS=-C target-cpu=x86-64 on x86_64-* and sets nothing on aarch64-*. Cargo 1.89 replaces .cargo/config.toml rustflags when RUSTFLAGS is set. On toolchain 1.89.0 I built a probe three ways: config only, RUSTFLAGS=-C target-cpu=x86-64 with that config present, and the env var with the config removed. The rustc argv was identical, including -C metadata=eccc911960ee991f, -C extra-filename=-8a1b1ffcae440604, and a single -C target-cpu=x86-64. RUSTFLAGS=-C target-feature=-fma replaced the pin rather than appending, so aravath-determinism.yml (which does not use this action) stays -C target-cpu=x86-64 -C target-feature=-fma. rustc --print cfg for x86_64-unknown-linux-gnu with and without -C target-cpu=x86-64 was an empty diff. Features are fxsr, sse, sse2. fma is absent, which is what astraweave-physics and aravath_runtime build.rs refuse. The Windows stack tables are separate targets and were not on the Linux rustc line. aarch64 has no table. Replay hashes were not run. Expected unchanged.
sccache. v0.19.0 (published 2026-10-24) is still the latest release. SCCACHE_GHA_RW_MODE parses READ_ONLY / READ_WRITE. RemoteStorage::check returns before the .sccache_check write when the mode is already read-only. ReadOnlyStorage::put returns Cannot write to read-only storage without calling the backend. server.rs counts that as a cache write error and does not fail the compile, so pull-request stats will show one write error per miss. That counter is local. It is not the Actions rate limit. mozilla-actions/sccache-action@v0.0.9 does not start the server; the first later sccache sees GITHUB_ENV. Gets still forward.
Security. Fork pull_request refs are refs/pull/N/merge. Every current caller of this action filters push to main and/or develop. The unquoted ${{ github.ref }} is still the wrong layer: workflow_dispatch can select any ref, and a later pull_request_target caller would both inject and take the write arm, because that event's ref is the base and its name is not pull_request. There is no pull_request_target workflow in the tree. Quote $GITHUB_REF and $GITHUB_EVENT_NAME, and allowlist push and schedule.
Three threads from 63805e07 are still open:
- Quote the runner variables, and narrow the write arm (
PRRT_kwDOPp_H3s6w8UVe). The doc bullet still says only pushes and schedules setREAD_WRITE.workflow_dispatchonrefs/heads/mainwrites too.developis read-only, which matches the doc. - Pin sccache (
PRRT_kwDOPp_H3s6w8UVj). The string in that thread,version: "0.19.0", 404s.setup.tsinterpolates the input as the release tag.version: "v0.19.0"is the asset that exists (HEAD 302). An unrecognized mode inconfig.rsisunwrap_or(ReadWrite), so a later sccache that drops the variable turns pull requests back into writers while the policy test still passes. The doc says 0.19.0; the action does not pin it. - The new test still does not lock which arm is which (
PRRT_kwDOPp_H3s6w8UVk). It does now lockassertNotIn("RUSTFLAGS=")and the cargo-config pin.integration-tests.yml(pushmain/develop, schedule,workflow_dispatch) andtoolchain-management.yml(pushmain, schedule,workflow_dispatch) still setSCCACHE_GHA_ENABLEDwith no mode, so they stayReadWrite. They are not onpull_request.dependency-management.ymlandbenchmark_alert.ymlinstall sccache and do not setSCCACHE_GHA_ENABLED.
No new dependency. Cargo.lock is not in the diff. GPU frame budget not measured. The pin does not change target features versus the 1.89.0 default, and this agent cannot measure the GTX 1660 Ti.
Commands: python3 -m unittest on test_sccache_pull_requests_are_read_only exit 0. Full scripts/ci/test_workflow_policy.py exit 1, same two pre-existing failures (aravath-windows.yml release timeout; cancel-in-progress on aravath-determinism.yml, aravath-windows.yml, render-device-validation.yml). bash scripts/ci/player_facing_names.sh exit 0. actionlint 1.7.7 on ci.yml, determinism-replay.yml, integration-tests.yml, and toolchain-management.yml exit 0. Replay hashes not run.
Sent by Cursor Automation: ASTRA PR AUDIT AGENT
| echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" | ||
| echo "SCCACHE_CACHE_SIZE=10G" >> "$GITHUB_ENV" | ||
| echo "SCCACHE_IDLE_TIMEOUT=0" >> "$GITHUB_ENV" | ||
| # sccache 0.19 writes through the Actions cache. A pull request that |
There was a problem hiding this comment.
This comment treats sccache 0.19 as what the job runs. The install step above is still mozilla-actions/sccache-action@v0.0.9 with no version input. setup.ts uses an empty input as getLatestRelease().tag_name and interpolates that string into both the download URL and the asset name. Latest on 2026-10-28 is v0.19.0 (published 2026-10-24). I requested the musl asset: .../download/v0.19.0/sccache-v0.19.0-x86_64-unknown-linux-musl.tar.gz returned 302, and the same path with 0.19.0 returned 404. The pin is version: "v0.19.0", not 0.19.0.
In that tag, cache_mode_from_env_var("SCCACHE_GHA_RW_MODE").unwrap_or(ReadWrite) (config.rs) turns any other string into a writer. A later release that renames or drops the variable puts pull requests back on the write path, and test_sccache_pull_requests_are_read_only still passes because it only searches this file for the echo.
ReadOnlyStorage::put does not drop the write quietly. It returns Cannot write to read-only storage without calling the backend, and server.rs counts that as a cache write error without failing the compile. Pull-request sccache --show-stats will show one write error per miss. That counter is local. It is not the Actions rate limit the comment above is describing. RemoteStorage::check still skips the .sccache_check write when the mode is already read-only, and gets still forward.
* docs: record the Linux archive, sccache mode, and macOS GPU skip #477, #480, #481, and #439 left the toolchain guide, the CI timeout table, and two present-tense profile sentences on the old jobs. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> * Correct the net-ecs test rollup and the appendix. Family 5 has 4 tests, so the families are 41, the server is 44, and the standalone trio is 110. The test grep matches a tokio test with a flavor argument. Under Warn a bad tag still assigns tokens and last_refill. The four crates have no dedicated workflow; the client binaries and the proto fuzz target are in CI. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> * Cite run 40235303264 for the Ubuntu test timeout. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> #477 removed the ci.yml comment that recorded a 45 min cancel after 27,057 passes. The timeout row now cites the run the replacement comment names. * docs(ci): the benchmark nightly cron is gone Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> #519 removed it. The profile and the bottleneck note still said a main push pays the 16 shards again at 05:17 UTC. * docs(net): keep revision 1.11 append-only Restore the main text that cites de6f272. Revision 1.12 records that aa30a82 is the reachable equivalent, dated 2026-10-28. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> * docs(net-ecs): restore post-merge doc truth for PR #505 review Update ci.yml client-binary cites after #633, fix bench and test rollups, Warn policy appendix text, grep -cE maintenance, and CI gating claims for Gate and net-tests. Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>


Description
Rebased onto
a94e6838.Pull requests set
SCCACHE_GHA_RW_MODE=READ_ONLY. Pushes and schedules onrefs/heads/mainsetREAD_WRITE.CARGO_INCREMENTAL=0was already set.The shared setup does not set
RUSTFLAGS. Cargo 1.89 replaces everyrustflagsentry in.cargo/config.tomlwhen that variable is set. A probe withcargo 1.89.0showed-C link-arg=FROM_CONFIG_LINUXon the rustc command, and the same command withRUSTFLAGS=-C target-cpu=x86-64dropped that config flag. The repo's onlyrustflagstoday are the Windows 16 MiB stack flags (x86_64-pc-windows-msvcandx86_64-pc-windows-gnu). Those targets are not the Linux host, so a Linux-onlyRUSTFLAGSwould not have removed them from a Linux rustc line. The pin is merged in instead:[target.x86_64-unknown-linux-gnu] rustflags = ["-C", "target-cpu=x86-64"]sits beside the Windows tables. The action assigns noRUSTFLAGS.determinism-replay.ymlstill assignsRUSTFLAGS=-C target-cpu=x86-64itself beforecargo test. That assignment is unchanged. On Linux it replaces the new config pin with the same flag.Samples that motivated read-only mode, sccache 0.19.0: gate
4059362723138.52% overall; gate4023530326424.34% overall and 21.17% rust; Ubuntu nextest job121303738868rust 11.01% with 263 cache write errors inReadWritemode. 826 of 2042 calls were non-cacheable (bin,proc-macro, and other crate types sccache 0.19 does not store).Type of change
Security Considerations
Checklist
Report
9b7e9ddf66f19fabceeecb27b40ac91f57a588f4, rebased ontoa94e6838. Not green yet.test_sccache_pull_requests_are_read_onlyandtest_aravath_supply_chain_uses_prebuilt_toolsexit 0.aw_doc_lint --mode warnexit 0.player_facing_names.shexit 0. Cargo 1.89 probe ofRUSTFLAGSversus config rustflags, above. The full policy module still fails onaravath-windows.ymlreleaseand the Aravath/render concurrency strings. Those are the files ci: scope heavy PR workflows and fail safe on workflow edits #475 changes. This branch does not edit them.121303738868. After: this head's sccache post-step, filled in when it finishes.READ_ONLYshould show write errors 0. The hit rate moves after a main job writes.RUSTFLAGSassignment is unchanged. No hashed crate. Acomparemismatch stops the pull request. The golden stays.