openai / openai/codex

Release-only loader_overrides unused_mut warning: scoped fix and verification

Open Beginner friendly
#43,317 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug CLI
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 emits:

warning: variable does not need to be mutable
    --> app-server/src/lib.rs:1377:5
1377 |     mut loader_overrides: LoaderOverrides,

This is the same warning reported in #29872 and #32939. This report supplies a separately published fix and debug/release verification for maintainers to consider alongside those reports.

What steps can reproduce the bug?

Build codex-app-server or a consuming codex-cli target with Cargo's release profile from the base revision above, after satisfying dependencies. The mutation is cfg-disabled in a normal release build, while the parameter remains mutable.

What is the expected behavior?

Release builds should avoid unused_mut, and debug builds should retain the test user-config override behavior.

Additional information
Root cause

In loader_overrides_with_test_user_config_file, loader_overrides.user_config_path is assigned only under cfg(debug_assertions). The parameter's mut declaration is unconditional, so release compilation removes the mutation but retains mutability.

Proposed fix and scope

Fix commit 827f92cf1c changes only codex-rs/app-server/src/lib.rs: keep the parameter immutable and shadow it as mutable under cfg(debug_assertions). This preserves debug behavior without suppressing the lint. The fork branch is based directly on upstream main and does not include the recursion-limit fix.

Verification

With this cleanup and the separate recursion-limit fix applied together:

  • cargo check -p codex-app-server -p codex-exec -p codex-tui -p codex-cli passed.
  • cargo build --release -p codex-cli passed and the reported loader_overrides warning was absent.

No test suite was run. The validation workspace also contained a local code-mode-runtime Cargo.toml adjustment; this validation does not establish clean-checkout V8 build support. No isolated warning-branch rebuild was performed after publishing the independent branch.

Sharing the root cause, patch, and results through an issue per the contribution guide; no upstream PR exists.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in codex-rs/app-server/src/lib.rs at loader_overrides_with_test_user_config_file, especially the parameter around lines 1376-1399 and its cfg(debug_assertions) mutation. Apply the scoped mutability fix described in the issue, then run cargo check -p codex-app-server -p codex-exec -p codex-tui -p codex-cli and cargo build --release -p codex-cli. Done means debug behavior remains available and the release build no longer emits the unused_mut warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.