From f7d034ca9ff1cea4ad7c7ace2426a43506fcb81e Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Tue, 21 Apr 2026 07:35:02 -0700 Subject: [PATCH] build: reduce Rust dev debuginfo The slow codex-core rebuilds are dominated by debug-info codegen, not parsing or type checking. On a warm-dependency package rebuild, the baseline codex-core compile was about 39.5s wall / 38.9s rustc total, with codegen_crate around 14.0s and LLVM_passes around 13.4s. Setting codex-core to line-tables-only debug info brought that to about 27.2s wall / 26.7s rustc total, with codegen_crate around 3.1s and LLVM_passes around 2.8s. I also sampled other first-party crates instead of keeping a codex-core-only package override. codex-app-server showed the same pattern: rustc total dropped from 15.85s to 10.48s, while codegen_crate plus LLVM_passes dropped from about 13.47s to 3.23s. codex-app-server-protocol had a smaller but still real improvement, 16.05s to 14.58s total, and smaller crates showed modest wins. That points to a workspace dev-profile policy rather than a hand-maintained list of large crates. Use `[profile.dev] debug = 1` so local dev builds keep line tables and useful backtraces while avoiding full variable debug info. This can cause a one-time rebuild because the Cargo dev profile hash changes, but subsequent rebuilds avoid the expensive debug-info work. Bazel does not read Cargo profiles for this setting. rules_rust derives debuginfo from Bazel toolchain/compilation-mode settings and the current fastbuild action already emitted `--codegen=debuginfo=0`. This change makes the CI choice explicit for both target and exec-configuration Rust actions with `-Cdebuginfo=0`. Verification: - `just bazel-lock-update` - `just bazel-lock-check` - `cargo check -p codex-core --lib` - `cargo test -p codex-core --lib` - Bazel `aquery --config=ci-linux` confirmed `--codegen=debuginfo=0` and `-Cdebuginfo=0` for `//codex-rs/core:core` --- .bazelrc | 4 ++++ codex-rs/Cargo.toml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/.bazelrc b/.bazelrc index 3a49a22c20..34287b1074 100644 --- a/.bazelrc +++ b/.bazelrc @@ -65,6 +65,10 @@ common:ci --verbose_failures common:ci --build_metadata=REPO_URL=https://github.com/openai/codex.git common:ci --build_metadata=ROLE=CI common:ci --build_metadata=VISIBILITY=PUBLIC +# rules_rust derives debug level from Bazel toolchain/compilation-mode settings, +# not Cargo profiles. Keep CI Rust actions explicit and lean. +common:ci --@rules_rust//rust/settings:extra_rustc_flag=-Cdebuginfo=0 +common:ci --@rules_rust//rust/settings:extra_exec_rustc_flag=-Cdebuginfo=0 # Disable disk cache in CI since we have a remote one and aren't using persistent workers. common:ci --disk_cache= diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.toml index ed6bdc0fd6..ccabd43da0 100644 --- a/codex-rs/Cargo.toml +++ b/codex-rs/Cargo.toml @@ -424,6 +424,11 @@ ignored = [ "codex-v8-poc", ] +[profile.dev] +# Keep line tables/backtraces while avoiding expensive full variable debug info +# across local dev builds. +debug = 1 + [profile.release] lto = "fat" split-debuginfo = "off"