Lightweight coding agent that runs in your terminal
Rust
build: use ThinLTO for release binaries (#23710)
Adam Perry @ OpenAIf97d5c327538
diff --git a/.github/workflows/rust-ci-full.yml b/.github/workflows/rust-ci-full.ymlindex 60d508b21d..50ecf2f8d6 100644--- a/.github/workflows/rust-ci-full.yml+++ b/.github/workflows/rust-ci-full.yml@@ -167,8 +167,6 @@ jobs:USE_SCCACHE: ${{ (startsWith(matrix.runner, 'windows') || (matrix.runner == 'macos-15-xlarge' && matrix.target == 'x86_64-apple-darwin')) && 'false' || 'true' }}CARGO_INCREMENTAL: "0"SCCACHE_CACHE_SIZE: 10G- # In rust-ci, representative release-profile checks use thin LTO for faster feedback.- CARGO_PROFILE_RELEASE_LTO: ${{ matrix.profile == 'release' && 'thin' || 'fat' }}strategy:fail-fast: falsediff --git a/.github/workflows/rust-release-windows.yml b/.github/workflows/rust-release-windows.ymlindex b4c2b84c0a..14d38b9db5 100644--- a/.github/workflows/rust-release-windows.yml+++ b/.github/workflows/rust-release-windows.yml@@ -2,10 +2,6 @@ name: rust-release-windowson:workflow_call:- inputs:- release-lto:- required: true- type: string# Cargo's libgit2 transport has been flaky when fetching git dependencies with# nested submodules. Prefer the system git CLI across every Cargo invocation.@@ -16,17 +12,14 @@ jobs:build-windows-binaries:name: Build Windows binaries - ${{ matrix.runner }} - ${{ matrix.target }} - ${{ matrix.bundle }}runs-on: ${{ matrix.runs_on }}- # Windows release builds can exceed an hour on fat-LTO mainline releases,- # so keep the timeout aligned with the top-level release build headroom.+ # Windows release builds can exceed an hour, so keep the timeout aligned+ # with the top-level release build headroom.timeout-minutes: 90permissions:contents: readdefaults:run:working-directory: codex-rs- env:- CARGO_PROFILE_RELEASE_LTO: ${{ inputs.release-lto }}-strategy:fail-fast: falsematrix:diff --git a/.github/workflows/rust-release.yml b/.github/workflows/rust-release.ymlindex 5e3b263ed0..2888ea6ce8 100644--- a/.github/workflows/rust-release.yml+++ b/.github/workflows/rust-release.yml@@ -149,9 +149,6 @@ jobs:run:working-directory: codex-rsenv:- # 2026-03-04: temporarily change releases to use thin LTO because- # Ubuntu ARM is timing out at 60 minutes.- CARGO_PROFILE_RELEASE_LTO: ${{ contains(github.ref_name, '-alpha') && 'thin' || 'thin' }}# Use the git CLI instead of Cargo's libgit2 path for git dependencies.# macOS release runners have intermittently failed to fetch nested# submodules through SecureTransport/libgit2, especially libwebrtc's@@ -325,7 +322,6 @@ jobs:for binary in ${{ matrix.binaries }}; dobuild_args+=(--bin "$binary")done- echo "CARGO_PROFILE_RELEASE_LTO: ${CARGO_PROFILE_RELEASE_LTO}"cargo build --target "$target" --release --timings "${build_args[@]}"- name: Upload Cargo timings@@ -1330,8 +1326,6 @@ jobs:if: ${{ github.event_name != 'workflow_dispatch' || inputs.release_mode == 'build_unsigned' }}needs: tag-checkuses: ./.github/workflows/rust-release-windows.yml- with:- release-lto: ${{ contains(github.ref_name, '-alpha') && 'thin' || 'fat' }}secrets: inheritargument-comment-lint-release-assets:diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.tomlindex 15e0e2c010..5d6d116049 100644--- a/codex-rs/Cargo.toml+++ b/codex-rs/Cargo.toml@@ -501,7 +501,7 @@ debug = "none"strip = "symbols"[profile.release]-lto = "fat"+lto = "thin"split-debuginfo = "off"# Because we bundle some of these executables with the TypeScript CLI, we# remove everything to make the binary as small as possible.