Skip to content

Make sccache read-only outside main - #1909

Merged
ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:sccache-readonly-prs
Oct 8, 2026
Merged

ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:sccache-readonly-prs

Conversation

@ludfjig

@ludfjig ludfjig commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Make sccache read-only on every ref except main, so only main writes sccache entries to the GitHub Actions cache. PR runs still read main's entries.

This fixes two problems caused by PR runs writing sccache entries, one per compiled crate:

  • They filled the repository cache past its 10 GB limit and evicted the main caches that every PR reads.
  • They exceeded the cache rate limit of 200 uploads per minute per repository (HTTP 429). When that happens, rust-cache reports "No cache found" and the job builds from scratch. In run 37820817731, 15 of 39 rust-cache restores failed this way.

With these changes, PRs lose sccache reuse between pushes, but this is fine since PR entries were evicted within an hour anyway (due to other prs evicting them), so no big deal. sccache lookups still count toward the download limit, so some rate limiting may remain.

PR runs filled the cache past its limit and evicted the main caches
that every PR reads.

PRs lose sccache reuse between pushes, but this is fine since PR
entries were evicted within an hour anyway, so no big deal.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused configuration change correctly applies sccache’s supported read-only mode to non-main refs.

0 open findings

What changed in this PR

Makes sccache read-only outside main to protect shared cache entries from eviction.

Changes:

  • Sets SCCACHE_GHA_RW_MODE=READ_ONLY for non-main refs.
  • Documents the cache-write policy.
File Description
.github/​actions/​setup-sccache/​action.yml Restricts sccache writes to main.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ludfjig ludfjig added the C-bug For PRs that fix bugs label Oct 8, 2026
@hyperlight-gh-bot

Copy link
Copy Markdown

Benchmark Results

Measured commit: b097b7e9dede
Baseline commit: 73f8f3ef9d3d

kvm / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 814.80 ns (➖ 1.08x slower)
vec_bytes 590.09 ns (➖ 1.01x slower)
373.83 µs (➖ 1.01x faster)

payload_allocation

slot_pool_segmented
262144 533.89 ns (➖ 1.01x slower)
65536 151.59 ns (➖ 1.07x slower)

sandboxes

create_initialized_and_drop
medium 88.45 ms (➖ 1.10x slower)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
8.10 ns (➖ 1.01x slower) 8.45 ns (➖ 1.09x slower) 10.29 ns (➖ 1.30x slower)

snapshot_files

load_snapshot_unverified
small 92.58 µs (➖ 1.01x faster)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.65 µs (➖ 1.07x slower) 7.66 µs (➖ 1.06x slower)
65536 2.15 µs (➖ 1.11x slower) 2.08 µs (➖ 1.00x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 6.28 µs (➖ 1.01x faster) 6.98 µs (➖ 1.11x slower)
8192 1.08 µs (➖ 1.03x slower) 1.08 µs (➖ 1.03x slower)
262144 28.01 µs (➖ 1.03x slower)
kvm / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 717.83 ns (➖ 1.04x slower)
vec_bytes 528.24 ns (➖ 1.02x faster)
679.90 µs (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
262144 506.14 ns (➖ 1.02x faster)
65536 136.85 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 70.93 ms (➖ 1.08x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
7.04 ns (➖ 1.06x faster) 6.99 ns (➖ 1.02x faster) 6.98 ns (➖ 1.04x faster)

snapshot_files

load_snapshot_unverified
small 45.14 µs (➖ 1.01x slower)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.56 µs (➖ 1.00x slower) 7.59 µs (➖ 1.00x slower)
65536 2.14 µs (➖ 1.00x slower) 2.16 µs (➖ 1.04x slower)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 7.21 µs (➖ 1.02x slower) 7.11 µs (➖ 1.00x faster)
8192 743.53 ns (➖ 1.02x faster) 728.30 ns (➖ 1.01x slower)
262144 29.87 µs (➖ 1.05x faster)
mshv3 / amd (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 985.30 ns (➖ 1.05x slower)
vec_bytes 705.57 ns (➖ 1.02x faster)
315.17 µs (➖ 1.02x faster)

payload_allocation

slot_pool_segmented
262144 721.79 ns (➖ 1.07x slower)
65536 183.05 ns (➖ 1.01x slower)

sandboxes

create_initialized_and_drop
medium 61.52 ms (➖ 1.02x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
10.55 ns (➖ 1.06x slower) 9.91 ns (➖ 1.00x faster) 10.00 ns (➖ 1.01x slower)

snapshot_files

load_snapshot_unverified
small 86.23 µs (➖ 1.00x faster)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 9.25 µs (➖ 1.01x faster) 9.97 µs (➖ 1.11x slower)
65536 2.64 µs (➖ 1.01x faster) 2.47 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 8.12 µs (➖ 1.00x faster) 8.11 µs (➖ 1.03x faster)
8192 1.43 µs (➖ 1.10x slower) 1.32 µs (➖ 1.06x faster)
262144 35.07 µs (➖ 1.00x faster)
mshv3 / intel (Linux) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 952.09 ns (➖ 1.03x slower)
vec_bytes 657.27 ns (➖ 1.01x slower)
686.36 µs (➖ 1.03x faster)

payload_allocation

slot_pool_segmented
262144 636.75 ns (➖ 1.03x slower)
65536 179.18 ns (➖ 1.10x slower)

sandboxes

create_initialized_and_drop
medium 61.96 ms (➖ 1.08x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
9.66 ns (➖ 1.00x faster) 8.79 ns (➖ 1.02x faster) 8.80 ns (➖ 1.00x slower)

snapshot_files

load_snapshot_unverified
small 44.47 µs (➖ 1.02x slower)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 8.00 µs (➖ 1.01x slower) 7.96 µs (➖ 1.01x slower)
65536 2.30 µs (➖ 1.00x slower) 2.28 µs (➖ 1.02x slower)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 7.59 µs (➖ 1.01x slower) 7.52 µs (➖ 1.00x faster)
8192 910.73 ns (➖ 1.02x faster) 910.08 ns (➖ 1.01x slower)
262144 39.09 µs (➖ 1.00x slower)
hyperv-ws2025 / amd (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.13 µs (➖ 1.10x faster)
vec_bytes 742.94 ns (➖ 1.01x faster)
2.21 ms (➖ 1.01x slower)

payload_allocation

slot_pool_segmented
262144 840.64 ns (➖ 1.07x slower)
65536 230.12 ns (➖ 1.00x faster)

sandboxes

create_initialized_and_drop
medium 106.08 ms (➖ 1.01x slower)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
11.72 ns (➖ 1.10x slower) 10.62 ns (➖ 1.00x slower) 10.54 ns (➖ 1.00x faster)

snapshot_files

load_snapshot_unverified
small 777.55 µs (➖ 1.19x slower)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 8.60 µs (➖ 1.00x slower) 8.66 µs (➖ 1.00x slower)
65536 2.53 µs (➖ 1.01x faster) 2.53 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 8.77 µs (➖ 1.01x slower) 8.91 µs (➖ 1.02x slower)
8192 1.38 µs (➖ 1.04x faster) 1.40 µs (➖ 1.03x slower)
262144 37.36 µs (➖ 1.04x faster)
hyperv-ws2025 / intel (Windows) (➖ stable)

No benchmark improved or regressed.

Benchmark Results

function_call_codec

encode_control decode_vec_bytes_copy
byte_chunks 1.22 µs (➖ 1.02x slower)
vec_bytes 787.83 ns (➖ 1.07x faster)
3.06 ms (➖ 1.00x faster)

payload_allocation

slot_pool_segmented
262144 745.56 ns (➖ 1.00x slower)
65536 211.15 ns (➖ 1.02x faster)

sandboxes

create_initialized_and_drop
medium 107.13 ms (➖ 1.11x faster)

slot_pool

alloc_dealloc_1500 alloc_dealloc_4096 alloc_dealloc_128
10.57 ns (➖ 1.02x slower) 10.24 ns (➖ 1.01x slower) 10.69 ns (➖ 1.02x faster)

snapshot_files

load_snapshot_unverified
small 539.29 µs (➖ 1.52x faster)

virtq_readonly

slot_pool_segmented_fragmented slot_pool_segmented
262144 7.83 µs (➖ 1.01x slower) 7.76 µs (➖ 1.12x faster)
65536 2.33 µs (➖ 1.14x faster) 2.32 µs (➖ 1.01x faster)

virtq_readwrite

slot_pool_segmented_fragmented slot_pool_segmented
65536 8.37 µs (➖ 1.03x faster) 8.36 µs (➖ 1.06x faster)
8192 1.12 µs (➖ 1.21x faster) 1.11 µs (➖ 1.09x faster)
262144 41.05 µs (➖ 1.06x faster)

Reported by cargo ci bench-report --candidate run:37840164996 --config-file bench_report.toml.

@ludfjig
ludfjig merged commit 9980dd3 into hyperlight-dev:main Oct 8, 2026
62 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bug For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants