The Codex desktop app's execution service (`codex-code-mode-host.exe`) exits during handshake, so every `exec` tool call fails. The error is intermittent but frequent.bug
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Bug Report: "code-mode host exited during handshake"
Summary
The Codex desktop app's execution service (codex-code-mode-host.exe) exits during handshake, so every exec tool call fails. The error is intermittent but frequent.
Error message
error=code-mode host exited during handshake
target=codex_core::tools::router
Environment
- App: ChatGPT desktop app (Codex) —
OpenAI.Codex_26.820.7780.0_x64__2p2nqsd0c76g0 - Bundled CLI:
codex-cli 0.150.0-alpha.8(windows-x86_64) - OS: Windows 10 (10.0.19045, build 19045.6466), Chinese locale, ANSI code page 936 (GBK)
- Model: gpt-5.6-terra / gpt-5.6-sol
When it started
Immediately after the auto-update on 2026-08-26 (~17:47 local time), which bumped the bundled CLI from 0.149.0-alpha.4.x to 0.150.0-alpha.8. No such errors before the update.
Repro steps
- Open the Codex desktop app.
- Start any task that triggers the
exectool (e.g. "runecho hello"). - The exec tool call fails with
code-mode host exited during handshake; the model retries and fails repeatedly.
Key observations
- The error is intermittent: some exec calls succeed, then a cluster of failures follows.
- It reproduces in both ASCII and non-ASCII working directories (so it is not path/encoding specific).
- No crash dump or WER report is generated for
codex-code-mode-host.exe— the host exits cleanly, so this is a handshake/protocol failure, not a crash. - Running
codex-code-mode-host.exemanually works; it starts and waits for the client hello. - Disabling the feature
code_mode_hostmakes exec fail closed (the model cannot run commands at all), so that is not a viable workaround. codex doctorreports:searchcommand not verified, and a generic Microsoft Defender advisory (exclusions were added but did not resolve the issue).
Impact
All exec-based work (running commands, Python, spreadsheet/document artifact creation, etc.) is blocked intermittently in the desktop app. The older VS Code extension CLI (0.147.0-alpha.6.5) does NOT have this problem.
Log excerpt
codex_core::tools::router (core\src\tools\router.rs:225)
... dispatch_tool_call_with_code_mode_result{otel.name=exec tool_name=exec ...}:dispatch_tool_call_with_terminal_outcome: error=code-mode host exited during handshake
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at core/src/tools/router.rs:225 and trace the exec code-mode handshake using the reported error and log excerpt. Reproduce with the bundled codex-cli 0.150.0-alpha.8 on the listed Windows environment, comparing behavior with the older CLI where useful. Done means the code-mode host completes handshakes reliably and exec calls no longer fail intermittently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100