Skip to content

ci: sccache read-only on pull requests, stable Linux CPU pin - #480

Merged
lazyxeon merged 1 commit into
mainfrom
cursor/ci-sccache-read-bb07
Oct 28, 2026
Merged

lazyxeon merged 1 commit into
mainfrom
cursor/ci-sccache-read-bb07

Conversation

@lazyxeon

@lazyxeon lazyxeon commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Description

Rebased onto a94e6838.

Pull requests set SCCACHE_GHA_RW_MODE=READ_ONLY. Pushes and schedules on refs/heads/main set READ_WRITE. CARGO_INCREMENTAL=0 was already set.

The shared setup does not set RUSTFLAGS. Cargo 1.89 replaces every rustflags entry in .cargo/config.toml when that variable is set. A probe with cargo 1.89.0 showed -C link-arg=FROM_CONFIG_LINUX on the rustc command, and the same command with RUSTFLAGS=-C target-cpu=x86-64 dropped that config flag. The repo's only rustflags today are the Windows 16 MiB stack flags (x86_64-pc-windows-msvc and x86_64-pc-windows-gnu). Those targets are not the Linux host, so a Linux-only RUSTFLAGS would 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 no RUSTFLAGS.

determinism-replay.yml still assigns RUSTFLAGS=-C target-cpu=x86-64 itself before cargo 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 40593627231 38.52% overall; gate 40235303264 24.34% overall and 21.17% rust; Ubuntu nextest job 121303738868 rust 11.01% with 263 cache write errors in ReadWrite mode. 826 of 2042 calls were non-cacheable (bin, proc-macro, and other crate types sccache 0.19 does not store).

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Security enhancement

Security Considerations

  • Does this PR introduce new dependencies? If yes, have they been vetted for security issues? No new dependency.
  • Does this PR modify how user input is handled? If yes, has it been validated/sanitized?
  • Does this PR change authentication or authorization mechanisms?
  • Does this PR access sensitive data or modify how it's stored?
  • Does this PR introduce new network communication or modify existing protocols?

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • I have run security checks (cargo audit, cargo deny) locally

Report

  1. Head 9b7e9ddf66f19fabceeecb27b40ac91f57a588f4, rebased onto a94e6838. Not green yet.
  2. Commands: test_sccache_pull_requests_are_read_only and test_aravath_supply_chain_uses_prebuilt_tools exit 0. aw_doc_lint --mode warn exit 0. player_facing_names.sh exit 0. Cargo 1.89 probe of RUSTFLAGS versus config rustflags, above. The full policy module still fails on aravath-windows.yml release and 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.
  3. Not run: a populated sccache hit-rate sample on this head. GPU frame budget: not measured.
  4. Before: rust hit rate 11.01% and 21.17%, overall 24.34% and 38.52%, 263 write errors on job 121303738868. After: this head's sccache post-step, filled in when it finishes. READ_ONLY should show write errors 0. The hit rate moves after a main job writes.
  5. Replay hashes: the replay workflow's own RUSTFLAGS assignment is unchanged. No hashed crate. A compare mismatch stops the pull request. The golden stays.
  6. Deferred issue links: none.
Open in Web Open in Cursor 

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T00:36:35.768171Z 63805e0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Open in Web View Automation 

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" ]; then

The 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@cursor
cursor Bot force-pushed the cursor/ci-sccache-read-bb07 branch from 63805e0 to 9b7e9dd Compare October 28, 2026 02:24

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 set READ_WRITE. workflow_dispatch on refs/heads/main writes too. develop is read-only, which matches the doc.
  • Pin sccache (PRRT_kwDOPp_H3s6w8UVj). The string in that thread, version: "0.19.0", 404s. setup.ts interpolates the input as the release tag. version: "v0.19.0" is the asset that exists (HEAD 302). An unrecognized mode in config.rs is unwrap_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 lock assertNotIn("RUSTFLAGS=") and the cargo-config pin. integration-tests.yml (push main/develop, schedule, workflow_dispatch) and toolchain-management.yml (push main, schedule, workflow_dispatch) still set SCCACHE_GHA_ENABLED with no mode, so they stay ReadWrite. They are not on pull_request. dependency-management.yml and benchmark_alert.yml install sccache and do not set SCCACHE_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.

Open in Web View Automation 

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lazyxeon
lazyxeon merged commit 0762c8a into main Oct 28, 2026
38 checks passed
@lazyxeon
lazyxeon deleted the cursor/ci-sccache-read-bb07 branch October 28, 2026 19:39
cursor Bot pushed a commit that referenced this pull request Oct 29, 2026
#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>
lazyxeon added a commit that referenced this pull request Nov 4, 2026
* 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>
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.

2 participants