Skip to content

ci: add swap headroom for the hosted shard test build - #12725

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/shard-swap-headroom
Nov 3, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/shard-swap-headroom

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Requested by Steven · project thread

Governing issue or accepted claim: #12719
Acceptance delta (one sentence): The hosted shard test build gets 8 GB of swap so a memory spike pages out instead of starving the runner, and the trace reports swap use.

Measurements (same 4 CPU / 16 GB shape, CARGO_INCREMENTAL=0)

  • Scheduling options do not lower the peak. First build with 2 jobs: 14.2 GB used, build failed. ripr lib test built alone first, then the rest: OOM-killed at 13.9 GB.
  • -Ztime-passes on ripr --lib --profile test with 1 job: the lib test is one rustc over a 1.4M-line crate. About 11.2 GB is resident before codegen starts (frontend 3.7 GB, MIR borrowck +4.3 GB in 122 s, monomorphisation +1.8 GB), then codegen takes it to 13-14 GB.
  • CI after ci: build hosted test shards one memory-heavy crate at a time #12704: peak 13.8 to 14.8 GB used, 1.1 to 2.2 GB available.

So the floor is the lib test compile itself. Swap is the cheap safety net; the structural fix (a smaller lib test compile) is filed separately.

Change

New step Add swap headroom for the test build: 8 GB swapfile under /mnt (or /), best effort. If setup fails it logs a ::warning:: and the build still runs. It adds memory only: no gate, test selection, verifier or Result changes. The memory trace line now also prints swap_used_mb.

Not proven

Whether the hosted runner allows fallocate+swapon and how much disk is free: this run's log shows it. Swap trades an OOM stall for slowness, so check the Rust tests shard wall time too. cargo xtask check-workflows passes locally.


Generated by Claude Code

The ripr lib test rustc holds ~11 GB before codegen and peaks near 14 GB, so
build scheduling cannot lower the floor on a 16 GB runner. Add 8 GB of swap
and report swap use in the memory trace (#12719).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmr2V8kCE8LReycVLHP
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 3, 2026 00:06
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 148 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 06291732-cc91-47f7-9a4e-89be966931a6
Commits

Reviewing files that changed from the base of the PR and between 16233a1 and e716167.

Files selected for processing: 2
  • .github/workflows/rust-test-shards.yml
  • changelog.d/12719-hosted-shard-swap-headroom.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment thread .github/workflows/rust-test-shards.yml Resolved
…swap file

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmr2V8kCE8LReycVLHP
…sion-free swap path

The previous commit's sed edit mangled the workflow; this restores the file
and applies the path change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmr2V8kCE8LReycVLHP
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SvmPmr2V8kCE8LReycVLHP

Copy link
Copy Markdown
Member Author

Review of record, head e716167

Angles: (1) correctness and fail-closed, (2) evidence honesty, (3) contract/policy. Independent reviewer agent on the exact head, plus hosted run 41553610419: Result green, all four shards and verify green.

Findings, none blocking:

  • Fail-closed holds. The swap step sits before the build step, touches no test step, and cannot mask a build failure (it ends in free -m). The && chain is inside an if, so any sudo/fallocate/mkswap/swapon failure takes the ::warning:: branch and the step exits 0, as the comment says.
  • Evidence: swap was enabled on all four shards (/mnt/ci-swapfile-8g), peaks were 13.5 to 14.5 GB used with 0 to 15 MB swap used. So the step works, but swap was not exercised under real pressure: it is an intended safety net, not a demonstrated fix. The 11/14 GB figures are from local runs, and the structural fix is perf(build): the ripr lib test compile holds ~11 GB before codegen and peaks near 14 GB #12726. The PR body already says "Not proven"; this PR does not close ci: hosted test shards still peak at 13.8-14.8 GB of 16 GB during the test build #12719 on its own.
  • Policy: the run-block line budget (30) is respected; nothing pins the step list or forbids sudo (other workflows use it).
  • Earlier findings fixed on this PR: Graphite's swap-path collision (replied and resolved), a broken-YAML intermediate commit (repaired, final tree checked), and the static-language gate on a comment of mine (fixed).

Resolution: merge on the green exact-head Result. #12719 stays open for the post-merge watch (no exit 143 over the next routed-rust runs) and #12726.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants