Skip to content

fix(ci): split mesh/shell-station in natives-build and cache Rust/Zig targets - #8863

Merged
CommaBot merged 2 commits into
mainfrom
fix/natives-build-split-and-cargo-cache
Nov 26, 2026
Merged

CommaBot merged 2 commits into
mainfrom
fix/natives-build-split-and-cargo-cache

Conversation

@CommaBot

@CommaBot CommaBot commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Root Cause

When a shared Rust dependency revision changes (e.g. bumping noq-proto in #8847), natives-build hit four compounding bottlenecks inside its 5-minute job cap:

  1. CPU contention in one VM: plan packed shell-station, mesh, and Linux reader/pion-reader for each target onto one 4-core ubuntu-24.04 VM, forcing two independent 200-crate iroh Rust builds to fight over 4 cores (~370–400 s cold vs. 241 s budget).
  2. Missing mesh Cargo target cache: station/native/mesh had no Actions cache at all, and native-shell-cargo-v1 did not include the Rust TOOLCHAIN version in its key.
  3. Poisoned registry cache: native-cargo-reg-v1-* matched a 1 MB launcher cache before falling back to check-rust-ubuntu-24.04-client- (86 MB) / check-rust-ubuntu-24.04-mesh- (79 MB), re-downloading 200+ crates and git repos on every miss.
  4. Uncached Zig sysroot builds: ~/.cache/zig was only cached when reader: was in the job, forcing win32-x64 shell-station/mesh to rebuild mingw-w64 libc/compiler_rt from scratch.

Changes

  • .github/workflows/pipeline.yml:
    • Split shell-station and mesh into dedicated natives-build matrix slots (shell, mesh, other) when sibling parts are present; keep single-VM default slot unchanged when only one independent part or readers run.
    • Add stage-2 natives-linux-readers matrix job (reusing *hosted-reader-steps) when shell-station for a Linux target is rebuilt in the same run; aggregate both in natives and include natives-linux-readers in gate.
    • Split Cargo registry caches by family (native-cargo-reg-v2-{client,mesh,other}-), add native-zig-cache-v1-<target>-, and cache both native-shell-cargo-v2 and native-mesh-cargo-v2 keyed by RUST_TOOLCHAIN + Cargo.lock with prefix fallback (main-only partial saves use a distinct partial-<run_id>-<attempt> key so exact lockfile keys are never polluted).
  • .github/actions/setup-native-linux/action.yml: export RUST_TOOLCHAIN from scripts/native.ts.
  • scripts/native-handoff.mjs & test/native-handoff-direct.test.ts: accept -shell, -mesh, -other, and -readers R2 manifest filenames and test restore + unknown-slot filtering.
  • .github/AGENTS.md: update Linux natives-build / natives-linux-readers documentation.

Verification

  • python3 scripts/ci-timeouts.py passed.
  • node --test test/native-handoff-direct.test.ts test/native-missing-plan.test.ts (19/19 passed).
  • Verified bash matrix-splitting script under set -euo pipefail across empty, reader-only, mesh-only, mesh+reader, and full #8847 missing lists.

Model: gemini-4-neon · Test frameworks: node:test, scripts/ci-timeouts.py


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

zzj3720 and others added 2 commits November 26, 2026 22:04
… targets

When a Rust dependency revision changes (such as bumping noq-proto or iroh in #8847), natives-build previously packed shell-station, mesh, and Linux readers for each target onto a single 4-core ubuntu-24.04 VM. Compiling two independent 200-crate iroh trees simultaneously exceeded the 5-minute with-timeout.sh budget, while mesh had no Cargo target cache, native-cargo-reg-v1 was shadowed by a 1 MB launcher cache, and win32-x64 did not cache ~/.cache/zig.

- Split shell-station and mesh into separate natives-build matrix VMs when both or sibling parts are missing, and defer Linux reader/pion-reader builds to a stage-2 natives-linux-readers matrix job whenever shell-station for that target is rebuilt (readers stay in natives-build when shell-station is already prebuilt).
- Accept per-slot R2 manifests (-shell, -mesh, -other, -readers) in scripts/native-handoff.mjs and cover them in test/native-handoff-direct.test.ts.
- Separate Cargo registry caches by crate family (client/mesh/other) so heavy crates fall back to check-rust-ubuntu-24.04-{client,mesh}- instead of a 1 MB launcher cache.
- Cache ~/.cache/zig for non-reader Linux/Windows zigbuild jobs and cache both shell-station and mesh Cargo targets keyed by RUST_TOOLCHAIN and Cargo.lock with prefix restore fallback (saving partial target caches only on main under a distinct partial key so exact lockfile keys stay complete).

Co-authored-by: zuozijian <zuozijian@cue.surf>
- Download split natives-<target>*-<sha> receipt artifacts (flattening subdirs) in pion-station.yml, pion-station-main.yml, and preview.yml so downstream workflows find shell-station/mesh/reader receipts after slot splitting.
- Match check-rust cache paths (~/.cargo/registry and ~/.cargo/git) so native-cargo-reg-v2-{client,mesh}- actually fall back to warm check-rust-ubuntu-24.04-{client,mesh}- caches.
- Key native-zig-cache-v1 by target and slot so shell and mesh slots do not race on one shared key.
- Drop the 'partial-' prefix from main timeout target-cache keys so cache_prune.mbt assigns partial and full keys the same rolling kind, raise main's save budget to JOB_END - 45, and guard Cargo target saves with a >= 35 s remaining-time check.
- Depend natives-win-reader, natives-win-reader-main, and natives-harness directly on natives-build so they run in parallel with natives-linux-readers.

Co-authored-by: zuozijian <zuozijian@cue.surf>
@CommaBot
CommaBot merged commit a31bb3a into main Nov 26, 2026
98 checks passed
@CommaBot
CommaBot deleted the fix/natives-build-split-and-cargo-cache branch November 26, 2026 13:24
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