Release build exceeds rustc query depth in downstream exec and TUI crates
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of Codex CLI is running?
Source build, codex-cli 0.0.0; base commit 455318c202.
What subscription do you have?
Not relevant to this source-build failure; subscription details not supplied.
Which model were you using?
Not applicable; compilation fails before model use.
What platform is your computer?
Arch Linux, x86_64-unknown-linux-gnu. Current host: Linux 7.2.3-arch1-2 x86_64 GNU/Linux.
What terminal emulator and version are you using (if applicable)?
Not supplied; failure occurs in the compiler/build system.
Codex doctor report
Not collected; this report concerns source compilation.
What issue are you seeing?
Release compilation fails in codex-exec and codex-tui:
error: queries overflow the depth limit!
help: consider increasing the recursion limit by adding a #![recursion_limit = "256"] attribute to your crate
query depth increased by 130 when computing layout of tracing::instrument::Instrumented<{async block@codex_app_server::message_processor::MessageProcessor::dispatch_initialized_client_request::{closure#0}::{closure#0}}>
What steps can reproduce the bug?
Build codex-cli in release mode from the base revision above with Cargo, after satisfying V8 dependencies. The reported failure came from cargo install of the CLI; the equivalent release build target is cargo build --release -p codex-cli from codex-rs. The failing build was not rerun solely to reproduce it; validation was performed after the fix.
What is the expected behavior?
The CLI release build should complete without exceeding rustc's layout-query depth limit.
Additional information
Root cause
The instrumented request future originates at message_processor.rs:930-947. Downstream crates compute its layout. app-server/src/lib.rs:1 already sets recursion_limit to 256, but this crate attribute does not propagate to exec, TUI, or the CLI. Their default limit is insufficient for this concrete future. This is compiler query nesting, not runtime recursion.
Proposed fix and scope
Fix commit 6b4ad41dfb sets the same limit in codex-rs/cli/src/main.rs, codex-rs/exec/src/lib.rs, and codex-rs/tui/src/lib.rs. Runtime behavior is unchanged. The fork branch contains only this fix.
Verification
With this fix and the separate app-server unused_mut cleanup applied together, the following passed locally:
- cargo check -p codex-app-server -p codex-exec -p codex-tui -p codex-cli
- cargo build --release -p codex-cli (5m22s)
- ./target/release/codex --version (codex-cli 0.0.0; exited successfully with a sandbox PATH-alias warning)
No test suite was run. The validation workspace also contained a local code-mode-runtime Cargo.toml adjustment; this does not establish that an untouched checkout can build the sandbox-enabled V8 dependency. Two unrelated cloud-tasks unused-import warnings remained.
Sharing the fix and analysis through an issue per the contribution guide; no upstream PR exists.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the recursion_limit attribute in codex-rs/app-server/src/lib.rs and compare the crate entry points codex-rs/cli/src/main.rs, codex-rs/exec/src/lib.rs, and codex-rs/tui/src/lib.rs. Build with cargo check -p codex-app-server -p codex-exec -p codex-tui -p codex-cli, then run cargo build --release -p codex-cli. Done means the release build completes without the rustc query-depth error and the CLI starts with --version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100