Skip to content

ci(release): pin the release toolchain and build macOS PGO with rustc 1.98 - #47

Merged
capy-ai[bot] merged 7 commits into
mainfrom
capy/release-pin-macos-pgo
Dec 3, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
capy/release-pin-macos-pgo

Conversation

@jaredLunde

Copy link
Copy Markdown
Contributor

The macOS PGO cell builds again. release.yml run 47047758167 on branch head 63fe0981 built, trained and uploaded rustwright-mcp-aarch64-apple-darwin, and the v0.3.8 release now carries 8 of 8 assets (releases/latest/download/rustwright-mcp-aarch64-apple-darwin answers 200 unauthenticated).

What was wrong. Rust's -Cprofile-generate instrumentation and the profiling runtime that Xcode's clang links carry a profile raw version that has to match, and the two move independently. The runner's clang 17 runtime is version 10; rustc 1.99 moved its instrumentation to version 11. A floating stable toolchain let the release move to 1.99 between v0.3.7 and v0.3.8, so the instrumented binary rejected its own runtime at startup, training wrote no .profraw at all, and the cell failed at merge time with LLVM Profile Error: Runtime and instrumentation version mismatch : expected 11, but get 10.

What this changes.

  • RUSTWRIGHT_RUST_TOOLCHAIN: "1.100.1" pins the toolchain the release builds with, so instrumentation cannot drift again. Both the setup action and the PGO script read this one value.
  • RUSTWRIGHT_PGO_TOOLCHAIN_DARWIN: "1.98" is the newest toolchain whose instrumentation is still raw version 10 — verified by reading the version field out of the .profraw header for 1.95 through 1.99 (11 only at 1.99). A Select the PGO toolchain step installs it for the macOS PGO cell and hands it to the script through RUSTWRIGHT_PGO_TOOLCHAIN; the Linux PGO cells keep the release toolchain, whose runtime comes from its own sysroot and never had this problem.
  • tools/build_mcp_pgo.sh echoes the toolchain, the llvm-profdata it merges with and the compiler that drives the link before the instrumented build, so the next mismatch names the component that moved instead of surfacing five minutes later as "no .profraw files".

Trade, plainly: one artifact in this release — the Apple Silicon MCP binary — is built by rustc 1.98 while the rest of the release is 1.100.1. That is deliberate and pinned: the runtime ladder skips 11 (clang 16.0 provides 8, clang 17 provides 10, rustc 1.99 writes 11), so no Xcode on the image can meet 1.100.1, and the alternative was no Apple Silicon MCP binary or no PGO on it. The pin is one line to move when the runtime side catches up.

Nothing in this change touches a shipped byte other than the toolchain that compiles that one binary; the other seven assets are byte-identical builds of the same sources.

Open in Capy

jaredLunde and others added 7 commits December 3, 2026 06:24
The macOS PGO cell failed on v0.3.8 with "Runtime and instrumentation version
mismatch : expected 11, but get 10": the instrumentated binary links a profiling
runtime whose version disagrees with rustc's instrumentation, so training writes
no .profraw and the failure surfaces at merge time.

A floating `stable` let the runner image's toolchain drift between v0.3.7 and
v0.3.8. Pin it by exact version in one place and pass the same pin to the PGO
script, which already resolves llvm-profdata from the toolchain's own sysroot.
Echo the toolchain, llvm-profdata and linker-driver versions before the build so
a future mismatch names the component that moved.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The instrumented binary links the profiling runtime of the Xcode that drives
the link. The macos-15 image's default moved to Xcode 26 (Apple clang 17.0.0),
whose runtime rejects rustc 1.100.1's instrumentation with "expected 11, but
get 10", so training wrote no .profraw and the cell failed at merge time. Pin
the PGO link to Xcode 16.4, the image default when v0.3.7 shipped, and print the
selection and the clang version the build actually used.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Selecting Xcode 16.4 changed the developer dir but not the clang that drove
the link: cc still resolved to Apple clang 17 and training wrote no .profraw.
Prepend that Xcode's usr/bin to PATH for the PGO cell, export CC/CXX/AR to its
absolute paths, and print command -v cc, cc --version and xcrun --find clang
next to the existing diagnostics so the next run says whether the selection
actually reached the compiler.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Xcode 16.4 ships the same Apple clang 17 as the image default, so selecting
it changed nothing; the runtime it provisions is the version rustc 1.100.1
rejects. Select Xcode 16.1 (16.0 fallback) for the PGO cell and drop the
PATH-level CC/CXX/AR override: cc follows xcode-select, and the override pointed
at a path that does not exist. Echo the selection, cc and xcrun so the log names
the compiler that actually linked.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The runtime is the clang the image ships (profile raw version 10 at clang 17,
8 at clang 16) and the instrumentation is rustc's (11 on 1.100.1), so the pair
has to be chosen from the rustc side: no Xcode on the image provisions 11.

Probe candidates newest first by compiling and running a one-line instrumented
binary against the same runtime the build uses, and keep the first that writes a
.profraw. Linux PGO cells keep the pinned toolchain unchanged.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
1.99.1 was selected because the probe saw a .profraw, but a runtime that
rejects the version still leaves a file behind: the real build then failed with
"expected 11, but get 10", so 1.99 emits the same instrumentation version as
1.100.1. Require a non-empty .profraw and no version error, log both for every
candidate, and extend the walk down to 1.95.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The runtime/instrumentation pair has to share a profile raw version, and the
number is set by the compiler: the profraw header is 11 on rustc 1.99 and 10 on
1.98 and earlier (read directly from the header of 1.95 through 1.99), while the
runner's clang 17 runtime is 10. Pin the one cell to 1.98 instead of probing at
build time: the probe was not faithful to the real link and accepted 1.99.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 2be3331 into main Dec 3, 2026
3 checks passed
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.

1 participant