openai / openai/codex

unified exec launch failures emit no lifecycle events, so a failed launch looks like a hang

Open
#44,557 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug CLI tool-calls
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

codex-cli 0.153.1 (also reproduced against rust-v0.153.3)

What subscription do you have?

Not relevant to this report — the defect is reproducible from the codex-rs crate tests and involves no account state.

Which model were you using?

Any. The failure is in the unified-exec process manager and is independent of the model.

What platform is your computer?

Darwin 25.6.0 arm64 arm

What steps can reproduce the bug?

Invoke exec_command under the UnifiedExec feature with a workdir that does not exist, so the process fails to launch.

{"cmd": "echo unreachable", "workdir": "<a path that does not exist>", "tty": false}
What is the expected behavior?

The attempt should surface as a commandExecution item that begins and then terminates as failed, the same as any other command that runs and fails.

What do you see instead?

Nothing at all. No ItemStarted, no ItemCompleted — the attempt vanishes from the item stream.

The cause is in codex-rs/core/src/unified_exec/process_manager.rs. Lifecycle events for unified exec are published by the process watcher, and on a launch failure no watcher is ever created: the error path calls release_process_id and returns the error directly, without emitting anything. Every other exec path emits a terminal item, so clients that track commandExecution items see a turn where a tool call was made and no corresponding item ever appeared.

The practical effect is that a client cannot distinguish "the launch failed" from "the tool call is still in flight", so a failed launch reads as a hang rather than as an error.

Patch

A fix and a regression test are on this branch, if useful:

https://github.com/Marvinthebored/codex/tree/fix/native-exec-failure-events-main

https://github.com/Marvinthebored/codex/commit/41a84245002876048c9da0a74c2ba29cb93d2f18

It emits the canonical pair on the launch-failure path — ToolEventStage::Begin followed by ToolEventStage::Failure(ToolEventFailure::Message(...)) — so the attempt appears and terminates like any other. Three files: the fix, a regression test in codex-rs/core/tests/suite/unified_exec.rs, and a matching note in the app-server README.

The test asserts exactly one start and one terminal item, that the terminal status is Failed, that its command and cwd match the start item, and that aggregated_output carries the launch error. It fails without the fix.

I would have opened this as a pull request, but this repository does not appear to accept them from outside contributors, so I am raising it as an issue instead. Happy to have the patch taken, adapted, or discarded — whatever is easiest.

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/core/src/unified_exec/process_manager.rs and inspect the launch-failure path, then read the related cases in codex-rs/core/tests/suite/unified_exec.rs. Run the unified-exec regression test and verify that a failed launch produces exactly one started and one terminal failed item, with matching command and cwd and the launch error in aggregated_output. Check the matching app-server README note if updating the documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.