Repository navigation
Description
The write errors in #893 are HTTP 429, and they are an upstream sccache bug
#893's first run showed Cache write errors 445 in test shard (rest) (equal to
its miss count — it stored nothing it compiled) and 316 of 742 in
fmt + clippy + docs, with Cache read errors: 0 and no error text logged.
Cause confirmed, not inferred: mozilla/sccache#2821
— ghac: cache writes are dropped on HTTP 429 because GHACache::build installs no RetryLayer. The three facts that make it ours:
- GitHub's Actions cache service rate limits per workflow run, shared across
every job in it, and answers a burst of writes with HTTP 429 plus a
retry-afterof 1–21s. - sccache's
GHACache::buildinstalls logging but noRetryLayer, so
opendal marks the error temporary and nothing acts on it. The write is dropped
and the counter incremented. - Affected in 0.17.0 and "unchanged on
mainas of 2026-08-23", so the
pinned 0.19.0 is affected. Upstream measured 45–90% write loss, which
brackets our 43% and 100% exactly.
There is no env-var workaround for the throttling itself — the issue says so
explicitly, and SCCACHE_GHA_RW_MODE only disables writing outright.
What is and is not at risk
The cost saving is already banked and is not at risk. S3 egress is gone
whatever the hit rate does — that was $209/month of
DataTransfer-Out-Bytes, and this bug cannot bring it back.
What is at risk is the hit rate, which is the reason to run sccache at all.
A 12-job matrix drawing on one shared per-run quota means main stores only a
fraction of what it compiles per run. It will accumulate across runs, but each
run re-pays for what the previous one dropped, and the ledger's 95% target may
not arrive.
Fix: concentrate the per-run quota on one writer
The quota is per run, so the lever is fewer concurrent writers inside the
main run — the single-writer pattern rust.yml already states for
shared-key: rust and #889 just applied to the frontend caches.
# rust.yml top-level env — everything reads
SCCACHE_GHA_RW_MODE: READ_ONLY
# on the `lint` job only, overriding it
SCCACHE_GHA_RW_MODE: ${{ github.ref == 'refs/heads/main' && 'READ_WRITE' || 'READ_ONLY' }}lint is the right writer: cargo clippy --workspace --all-targets plus
cargo doc --workspace compiles essentially the whole tree, and it is already
the designated single writer of the rust-cache key for the same reason.
This also closes the second risk recorded on #893 — PR runs stop writing
their own ~1.48 GB scope, which at 309 distinct PR branches in 7 days was
~457 GB of demand against a 20 GB limit. It restores exactly the S3 read-role
semantics (main writes, PRs read) without any IAM.
Verify
Cache write errorson amainlintrun should fall sharply; it will not
reach zero, because one job can still burst past the quota.- Warm hit rate on a second
mainrun: the 95% the ci(rust): sccache back on the Actions cache backend, off S3 #893 ledger asks for. gh api .../actions/cache/usageshould stop climbing from PR scopes; sccache
entries should appear onrefs/heads/mainand nowhere else.- Watch for the regression this could cause: PR runs lose the within-run climb
(13.11% → 62.13% measured on ci(rust): sccache back on the Actions cache backend, off S3 #893's cold run), which matters only while
main's scope is cold.
Activity