What issue are you seeing?
When Codex is embedded inside another application instead of being run as
the codex CLI itself, apply_patch can fail even when arg0_paths.codex_self_exe is set correctly at
startup
What steps can reproduce the bug?
-
Start Codex in-process from a host binary that is not the codex executable.
-
Pass a valid arg0_paths.codex_self_exe pointing to a real Codex runtime binary.
-
Start a thread/turn that triggers apply_patch.
-
Observe that the file change fails even though the same bundled Codex binary can apply the patch
directly outside the embedded host.
let client = InProcessAppServerClient::start(InProcessClientStartArgs {
arg0_paths: Arg0DispatchPaths {
codex_self_exe: Some(path_to_real_codex_binary),
codex_linux_sandbox_exe: None,
main_execve_wrapper_exe: None,
},
// normal config + startup args...
}).await?;
The failure shows up after thread/turn config derivation, not at startup.
From inspection, the problematic paths are the helpers that derive a fresh Config but do not reapply
runtime exec paths:
What is the expected behavior?
Embedded app-server mode should preserve the runtime exec paths from
arg0_paths across all config derivation paths, so tool runtimes like apply_patch behave the same way
they do in CLI-hosted flows.
If codex_self_exe was valid at startup, derived configs should continue to carry it unless
explicitly overridden.
Additional information
I am attaching a patch if you'd like to use since external contribution is closed.
codex-embedded-runtime-exec-paths-main.patch
What issue are you seeing?
When Codex is embedded inside another application instead of being run as
the codex CLI itself, apply_patch can fail even when arg0_paths.codex_self_exe is set correctly at
startup
What steps can reproduce the bug?
Start Codex in-process from a host binary that is not the codex executable.
Pass a valid arg0_paths.codex_self_exe pointing to a real Codex runtime binary.
Start a thread/turn that triggers apply_patch.
Observe that the file change fails even though the same bundled Codex binary can apply the patch
directly outside the embedded host.
The failure shows up after thread/turn config derivation, not at startup.
From inspection, the problematic paths are the helpers that derive a fresh Config but do not reapply
runtime exec paths:
derive_config_from_params(...)
derive_config_for_cwd(...)
What is the expected behavior?
Embedded app-server mode should preserve the runtime exec paths from
arg0_paths across all config derivation paths, so tool runtimes like apply_patch behave the same way
they do in CLI-hosted flows.
If codex_self_exe was valid at startup, derived configs should continue to carry it unless
explicitly overridden.
Additional information
I am attaching a patch if you'd like to use since external contribution is closed.
codex-embedded-runtime-exec-paths-main.patch