Repository navigation
fix(acp): drop an inherited CODEX_PATH so Codex uses its bundled CLI - #920
Open
Frank-zhu2000 wants to merge 1 commit into
Open
Frank-zhu2000 wants to merge 1 commit into
Frank-zhu2000 wants to merge 1 commit into
Conversation
codex-acp spawns CODEX_PATH instead of the @openai/codex shipped with the adapter. A desktop or CLI install can pair an older client, whose decoder expects only cell_id, content_items, and error_text, with a newer codex-code-mode-host that sends code_mode_host_duration_ns. Every code-mode shell_command then fails before it runs (spacering-net#656). An empty value is the spawn layer's env_remove. An explicit non-empty runtime CODEX_PATH still wins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #656
Root cause
The
shell_commandfailure (unknown field code_mode_host_duration_ns) is a serde error raised inside Codex, not by codeg's parser. Codeg's Codex child process inheritsCODEX_PATHfrom the user's environment. When it is set, codex-acp spawns that binary instead of the@openai/codexbundled with the adapter. A desktop/CLI install at Codex ≤0.151 decodes the code-mode IPCResultwithdeny_unknown_fieldsand only knowscell_id,content_items,error_text. The newercodex-code-mode-host(0.152+) also sendscode_mode_host_duration_ns, so decoding fails beforeshell_commandruns.Change
src-tauri/src/acp/connection.rs: the Codex env policy now pushes an emptyCODEX_PATH. The existing spawn layer already turns an empty value intoenv_remove, so codex-acp falls back to its matched bundled pair. A non-emptyCODEX_PATHset explicitly in the runtime env still wins. Unit tests cover the new behavior (one test was red before the fix).Verification (src-tauri, Linux)
cargo test --features test-utils --lib codex_env_policy_: 6 passed (the new test failed before the fix)cargo test --features test-utils: exit 0cargo clippy --all-targets --features test-utils -- -D warnings: exit 0cargo test --no-default-features --features server-bin --bin codeg-server --lib: exit 0 (run withCARGO_BUILD_JOBS=1because of local memory)cargo clippy --no-default-features --features server-bin --bin codeg-server --lib -- -D warnings: exit 0cargo fmt --checkwith rustfmt 1.99 already reports differences on the untouched base tree. CI does not run fmt, and the new code is not in those hunks.I couldn't reproduce this on Windows locally. The analysis comes from reading the codex-acp and openai/codex sources (rust-v0.151.0 vs rust-v0.152.0 payload).
This change was prepared with help from an AI coding assistant and reviewed by me.