Repository navigation
Commit 8b49e99
committed
fix: stop wrapping Windows spawns in process.env.SHELL
openai#236 reports the app-server broker hanging indefinitely at
"Initializing..." on Windows with no error surfaced. The direct spawn
path (used by the broker itself to launch `codex app-server`, and by
runCommand for utilities like taskkill) wraps the child process with
process.env.SHELL on win32, trusting whatever shell the user happens
to have configured (git-bash, a WSL bash.exe shim, an unresolvable
literal POSIX path, etc.) to correctly proxy a JSON-RPC stdio pipe.
That is unpredictable: it can silently swallow the handshake, fail
with ENOENT, or otherwise misbehave depending on what SHELL resolves
to, and the broker's own cleanup logic already assumed the spawned
child was cmd.exe (see the terminateProcessTree comment in
app-server.mjs), which breaks when SHELL points elsewhere.
process.env.SHELL was added in openai#178 to fix openai#138, but that fix
targeted the wrong layer: the outer spawn wrapper only resolves the
codex executable itself (npm installs ship a .cmd shim that
CreateProcess cannot exec directly) and has no bearing on what shell
Codex uses internally for its own command-execution tool, since SHELL
is already passed straight through via the `env` option regardless of
this wrapper. Reverting to a deterministic cmd.exe wrapper on Windows
fixes the hang without reopening openai#138.
Verified: baseline test suite has 6 pre-existing failures including
"cancel sends turn interrupt to the shared app-server before killing
a brokered task" (a taskkill/terminateProcessTree test whose process
tree assumptions broke exactly the way described above); with this
fix that test passes and no other test regresses (5 failures remain,
all pre-existing and unrelated: platform-mismatch path assertions,
npm/setup env assumptions, Claude-session-transfer path assumptions).
A live headless round trip against `codex app-server` (broker start,
initialize, thread/start, turn/start, turn/completed, clean shutdown)
also passes end to end.1 parent db52e28 commit 8b49e99
2 files changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
195 | 203 | | |
196 | 204 | | |
197 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
0 commit comments