Repository navigation
codex: drop codegen-units=1 (reproducible via the entropy shim), strip, link system sqlite/zstd/oniguruma/bzip2, skip the rusty_v8 fetch - #1713
Conversation
…m sqlite/zstd/oniguruma/bzip2, skip the rusty_v8 fetch - Reproducibility without serial codegen: CARGO_PROFILE_RELEASE_LTO=off + 16 codegen units replaces `-C codegen-units=1` in RUSTFLAGS (which hit all ~1070 crates). Without ThinLTO nothing gets a `.llvm.<hash>` name. Two local --rebuilds (6 and 4 cargo jobs) gave the same usr/bin/codex sha256. - debug=0, strip=symbols: 1.21 GB binary -> 344 MB. - Link pkgs' sqlite, zstd, oniguruma, bzip2 (pkg-config) instead of the -sys crates' vendored copies; fail closed on NEEDED if any fell back. - Drop the three workspace members that alone reach rusty_v8, so cargo stops cloning it with its Chromium submodules (fetch phase 413 s -> 36 s locally); pin check now allows only removals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…the entropy shim), not lto=off Measured locally (arm64, 6-CPU min box), stripped usr/bin/codex: - lto=off, cgu=16: 343,685,496 B, same sha256 over 2 rebuilds, cargo 18m36s - upstream thin/cgu=4: 282,277,080 B, same sha256 over 3 rebuilds (4/4/6 jobs), cargo 16m55s cgu=1 was needed only alongside the getrandom shim (#878); with the shim the upstream profile is reproducible on its own, faster and 18% smaller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
norrietaylor
left a comment
There was a problem hiding this comment.
Scope matches the title. Both files are in packages/codex, and every hunk traces to one of the four stated changes.
Clobber none. git log -- packages/codex shows no recent fix reverted. The removed RUSTY_V8_ARCHIVE=/nonexistent guard has a replacement: the added-pin check and the name = "v8" lock check fail before cargo fetch.
Correctness The guards read correctly. The v8_lines count check runs before the sed. comm -13 reports added or moved pins and permits removals. The NEEDED loop fails closed for all four libraries. The four subsetOf output names exist in sqlite, zstd, oniguruma and bzip2. readelf comes from toolchain through binutils. The detbuild preload stays on the one --frozen command. The findings are about comments only. One comment gives a security reason that the code does not support.
Not checked (needs a build or the crate sources): the reproducibility of thin LTO with 4 codegen units on the build-bot. The PR states that the evidence is three same-host builds. I did not check the claim that SQLITE_DEFAULT_FOREIGN_KEYS=1 is the only behavioral define that pkgs' sqlite lacks. packages/sqlite/build.sh sets only SQLITE_ENABLE_COLUMN_METADATA plus fts4, fts5, rtree and session. The upstream Cargo.toml shape that v8_lines matches was not checked. One small note: bzip2's libs glob is usr/lib/*, so the runtime subset can also carry libbz2.a. That is a bzip2 packaging matter, not a defect in this PR.
…im, build_cost_multiple from build-bot CPU/wall - sqlite: the pkgs CVE patch only touches shell.c (the CLI), so it is no reason to link libsqlite3; the reason is one shared, pkgs-updated copy. - build_cost_multiple 6 -> 8: build-bot at 6b61b25 kept 8.5 (arm64, 7701 s CPU / 902 s wall) and 11.5 (amd64, 9173 s / 799 s) cores busy. - build.sh keeps only why cgu=1 must not come back; measurements and the rejected lto=off candidate live in the PR body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Makes
packages/codexbuild faster and install smaller, keeps it reproducible, and links pkgs' C libraries instead of vendored copies.Changes
-C codegen-units=1from RUSTFLAGS and keep upstream's release profile (lto = "thin",codegen-units = 4). codex: -C codegen-units=1, v0 symbol mangling, path remap (parallel codegen made every build differ) #878 made the build reproducible with two fixes together: cgu=1 and the detbuild getrandom shim. Its lab double build still differed with cgu=1 alone. With the shim in place, cgu=1 is no longer needed: three local--rebuilds of upstream's profile, at 4, 4 and 6 cargo jobs, produced the same sha256. Set in RUSTFLAGS, cgu=1 applied to all ~1070 crates and made each crate's codegen serial. v0 mangling, path remapping and the shim stay.debug = 0,strip = "symbols". Upstream keeps line tables and symbols only so its own packaging can archive sidecar symbols before stripping.LIBSQLITE3_SYS_USE_PKG_CONFIG=1,ZSTD_SYS_USE_PKG_CONFIG=1,RUSTONIG_SYSTEM_LIBONIG=1, plus a generatedbzip2.pc, because bzip2 1.0.8 ships none and bzip2-sys only probes pkg-config. Each crate silently falls back to its bundled copy when pkg-config fails, so build.sh now fails closed unlessreadelf -dlists all four libraries. aws-lc-sys, ring and tree-sitter have no system option and stay bundled.bundledfeature on, uses bundled bindings for 3.54.1 and requires at least 3.45.3; pkgs' sqlite is also 3.54.1. (Its CVE-2026-119586 patch touches only the CLI's shell.c, so the library is the same; the gain is one shared copy that pkgs updates.) The bundled build's only behavioral define that pkgs' sqlite doesn't set isSQLITE_DEFAULT_FOREIGN_KEYS=1, and sqlx turnsforeign_keyson itself.unlock_notifyis not enabled. zstd-sys 2.0.16+zstd.1.5.7 haslegacyandzdict_builderon, and pkgs' zstd is 1.5.7. onig_sys 69.9.1 needs at least 6.9.3; pkgs has 6.9.10.build_deps(headers and .pc files) and asruntime_depssubsets (sqlite libs,zstd libzstd,oniguruma libs,bzip2 libs).-p codex-cli.v8(rusty_v8 plus its Chromium submodules) is reached only bycode-mode-host,code-mode-runtimeandv8-poc. build.sh drops those three members and the v8[patch](and fails if those lines change shape), andcargo update --workspaceprunes v8 and the 24 crates only it used. The pin check now refuses any registry or git pin that is added or moved; removals are allowed. It also fails ifv8is still in the lock. If codex-cli ever reaches v8, the fetch becomes a new registry pin and the build fails, which covers what the oldRUSTY_V8_ARCHIVE=/nonexistentguard did.Measurements
Local builds ran on an arm64 Mac in a
minbox with 6 CPUs and 26 GB, usingmin package build --rebuild. Build-bot numbers come from Cloud Logging (build feed claimed).bytesbuild_cost_multipleusr/bin/codex(arm64)llvm-strip --strip-all)Compiling--rebuilds gave the same sha25662fb906f…a65df0Candidates tried and rejected
lto = "off"with 16 codegen units (the first commit of this PR). It was reproducible over 2 rebuilds at 6 and 4 jobs, because with no ThinLTO there are no.llvm.<hash>names. But the stripped binary was 343,685,496 B, 22% bigger than upstream's profile, and it built no faster locally (cargo 18m36s at 6 jobs). Replaced by the second commit.lto, and ThinLTO promotes locals across every dependency's modules, not only the final crate's.strip = "symbols"alone to hide differing names: not relied on. The 2026-10 diff churned 49% of the binary, which is code layout and not only names. Stripping is in this PR only for size.Caveat: the reproducibility evidence is three same-host local builds. The build-bot builds each arch once per push, so a prod-pair comparison only comes from a later rebuild.
🤖 Generated with Claude Code
Summary by CodeRabbit