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

Open 💬 4 comments Opened Aug 26, 2026 by c296274227-oss

codex_bug_report.md

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

  1. Open the Codex desktop app.
  2. Start any task that triggers the exec tool (e.g. "run echo hello").
  3. 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.exe manually works; it starts and waits for the client hello.
  • Disabling the feature code_mode_host makes exec fail closed (the model cannot run commands at all), so that is not a viable workaround.
  • codex doctor reports: search command 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

View original on GitHub ↗

4 Comments

CloudyRiver9 · 1 day ago

Related Windows Desktop report with additional diagnostics: https://github.com/openai/codex/issues/40913

Key extra finding there: from the ChatGPT Desktop process context, spawning the bundled runtime fails at the lowest level:

C:\Users\c\AppData\Local\OpenAI\Codex\runtimes\cua_node\950613ca46815e82\bin\node.exe --version
nodeVersionError.code = 3221225506  (0xC0000022)

while the exact same node.exe launched manually from PowerShell succeeds (v24.19.0, exit 0). A full clean-room reset of all Codex/Desktop state, reinstall, disabling code_mode_host, Defender exclusions, and stopping Nahimic did not change the result. The main Desktop -> codex app-server stdio handshake succeeds; only the local code-mode execution child-chain fails. This points to the Desktop/MSIX packaged child-process context rather than the binaries or user state.

wangzongshuji · 1 day ago

How to solve? I have tried various methods, but none of them have solved the problem

CloudyRiver9 · 1 day ago

用旧版本吧,我在找了

CloudyRiver9 · 1 day ago

换了beta版本。能用了