Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7716e0f26
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| unsafe { | ||
| std::env::set_var("CODEX_HOME", codex_home.path()); | ||
| } |
There was a problem hiding this comment.
Serialize environment mutation in this test
This test mutates CODEX_HOME/PATH via unsafe std::env::set_var/remove_var without any serialization, but Rust tests run in parallel by default. If any other test thread reads environment variables concurrently, this violates std::env's safety contract and can cause undefined behavior or flaky CI failures. Please wrap these mutations in a process-wide lock (or mark the test serial) so environment access is synchronized.
Useful? React with 👍 / 👎.
884a49d to
ac0da77
Compare
|
I'm not sure why Bazel tests appear "frozen" on the PR page, but I see them running here: https://github.com/openai/codex/actions/runs/24792741756/job/72554548095?pr=18999 |
Why
The Ubuntu GNU remote Cargo run has been regularly failing sandboxed
suite::remote_envfilesystem tests withNo such file or directory, while the same cases pass under Bazel. The Cargo remote-env setup startstarget/debug/codex exec-serverinside Docker viascripts/test-remote-env.sh. That CLI buildscodex-linux-sandboxand other arg0 helper aliases in a temporary directory, then passes those alias paths into the exec-server runtime.arg0_dispatch_or_elseconstructedArg0DispatchPathsfrom that temporary alias guard, but then awaited the async CLI entry point without otherwise keeping the guard live. That allowed the guard to be dropped while the exec-server was still running, removing the helper alias directory. Later sandboxed filesystem calls tried to spawn the now-deletedcodex-linux-sandboxpath and surfaced asENOENT.The relevant distinction I found is that
core/tests/commonstores the result ofarg0_dispatch()in a process-lifetimeOnceLock<Option<Arg0PathEntryGuard>>for test binaries. The Cargo remote-env setup exercises a realcodex exec-serverprocess instead, so it depends on the normal CLI lifetime behavior fixed here.What Changed
main_fn(paths).awaitcompletes.arg0_dispatch()shape, where alias setup can fail and returnNonein production.Verification
cargo test -p codex-arg0just argument-comment-lint -p codex-arg0just fix -p codex-arg0