fix(code-mode): hide Codex's native console window on Windows

Codex's engine ships as a native console-subsystem binary (codex.exe). Launched
from our console-less Electron process tree, Windows allocated a fresh *visible*
console window for it; closing that window wedged the run in a pending state.
(Claude Code is a Node CLI, so it never triggers this.)

The window is created by @openai/codex's launcher (bin/codex.js), which spawns
codex.exe with no windowsHide. Patch it via pnpm to pass windowsHide: true
(CREATE_NO_WINDOW) so the console stays hidden — no window, nothing to close.
This commit is contained in:
Gagancreates 2026-06-04 02:06:31 +05:30
parent dda73d0daa
commit 768d5dcc19
3 changed files with 24 additions and 2 deletions

View file

@ -0,0 +1,15 @@
diff --git a/bin/codex.js b/bin/codex.js
index 67ab3e2d95dfac1c91882578b5403916c3121484..f8030b6e1459e05161af99e152b2e7f65ea6c41d 100644
--- a/bin/codex.js
+++ b/bin/codex.js
@@ -175,6 +175,10 @@ env[packageManagerEnvVar] = "1";
const child = spawn(binaryPath, process.argv.slice(2), {
stdio: "inherit",
env,
+ // Native console-subsystem binary: without this Windows pops a visible console
+ // window when launched from a console-less (Electron GUI) parent. Closing that
+ // window wedges the agent. CREATE_NO_WINDOW keeps the console hidden.
+ windowsHide: true,
});
child.on("error", (err) => {

9
apps/x/pnpm-lock.yaml generated
View file

@ -10,6 +10,11 @@ catalogs:
specifier: 4.1.7
version: 4.1.7
patchedDependencies:
'@openai/codex@0.128.0':
hash: 9edd926108a95aaa788aa93870fd6b16d70eeccdf5740b503af5d34cc9f25e86
path: patches/@openai__codex@0.128.0.patch
importers:
.:
@ -8249,7 +8254,7 @@ snapshots:
'@agentclientprotocol/codex-acp@0.0.44(zod@4.2.1)':
dependencies:
'@agentclientprotocol/sdk': 0.21.1(zod@4.2.1)
'@openai/codex': 0.128.0
'@openai/codex': 0.128.0(patch_hash=9edd926108a95aaa788aa93870fd6b16d70eeccdf5740b503af5d34cc9f25e86)
diff: 8.0.4
open: 11.0.0
vscode-jsonrpc: 8.2.1
@ -10101,7 +10106,7 @@ snapshots:
'@oozcitak/util@8.3.4': {}
'@openai/codex@0.128.0':
'@openai/codex@0.128.0(patch_hash=9edd926108a95aaa788aa93870fd6b16d70eeccdf5740b503af5d34cc9f25e86)':
optionalDependencies:
'@openai/codex-darwin-arm64': '@openai/codex@0.128.0-darwin-arm64'
'@openai/codex-darwin-x64': '@openai/codex@0.128.0-darwin-x64'

View file

@ -13,3 +13,5 @@ onlyBuiltDependencies:
- fs-xattr
- macos-alias
- protobufjs
patchedDependencies:
'@openai/codex@0.128.0': patches/@openai__codex@0.128.0.patch