mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## Why Bazel release builds need Cargo-compatible Rust and native build-script settings. Platform-specific issues also include Windows command-line limits, MSVC runtime conflicts with V8's allocator, and a missing V8 `__clear_cache` symbol on ARM64 musl. ## What changed - Add `--config=release` settings for thin LTO, four target codegen units, and disabled debug assertions and overflow checks, with separate settings for build tools. - Add opt-in Cargo release profile support for build-script optimization and debug information, preserving explicit C/C++ flags. Give optimized Bubblewrap builds `-O3`, debug symbols, and enabled native assertions. - Statically link the MSVC CRT for Rust and C/C++ target and host dependencies, and disable SQLite intrinsics on x64 MSVC to avoid startup crashes on older CPUs. - Let the Rust process wrapper read its arguments from a multiline parameter file to avoid Windows command-line limits. - Select the ARM64 musl V8 archive containing compiler-rt builtins and raise the Rust recursion limit to `256` in the app-server client, exec, and TUI entry points for release compilation. GitOrigin-RevId: 8f61e62b8735c36209ee92e04a0e0339a70badc5
49 lines
1.5 KiB
Rust
49 lines
1.5 KiB
Rust
// Release builds exceed rustc's default query depth when laying out the async
|
|
// MessageProcessor::handle_initialized_client_request future.
|
|
#![recursion_limit = "256"]
|
|
|
|
//! Entry-point for the `codex-exec` binary.
|
|
//!
|
|
//! When this CLI is invoked normally, it parses the standard `codex-exec` CLI
|
|
//! options and launches the non-interactive Codex agent. However, if it is
|
|
//! invoked with arg0 as `codex-linux-sandbox`, we instead treat the invocation
|
|
//! as a request to run the logic for the standalone `codex-linux-sandbox`
|
|
//! executable (i.e., parse any -s args and then run a *sandboxed* command under
|
|
//! Landlock + seccomp.
|
|
//!
|
|
//! This allows us to ship a completely separate set of functionality as part
|
|
//! of the `codex-exec` binary.
|
|
use clap::Parser;
|
|
use codex_arg0::Arg0DispatchPaths;
|
|
use codex_arg0::arg0_dispatch_or_else;
|
|
use codex_exec::Cli;
|
|
use codex_exec::run_main;
|
|
use codex_utils_cli::CliConfigOverrides;
|
|
|
|
#[derive(Parser, Debug)]
|
|
struct TopCli {
|
|
#[clap(flatten)]
|
|
config_overrides: CliConfigOverrides,
|
|
|
|
#[clap(flatten)]
|
|
inner: Cli,
|
|
}
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
arg0_dispatch_or_else(|arg0_paths: Arg0DispatchPaths| async move {
|
|
let top_cli = TopCli::parse();
|
|
// Merge root-level overrides into inner CLI struct so downstream logic remains unchanged.
|
|
let mut inner = top_cli.inner;
|
|
inner
|
|
.config_overrides
|
|
.prepend_root_overrides(top_cli.config_overrides);
|
|
|
|
run_main(inner, arg0_paths).await?;
|
|
Ok(())
|
|
})
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "main_tests.rs"]
|
|
mod tests;
|