Summary
On Windows, @openai/codex 0.122.0 (native codex.exe) spawns a command-safety PowerShell parser process as:
pwsh.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand <...>
When codex.exe itself is launched hidden by a parent process, the descendant pwsh.exe still briefly flashes a visible console window. This appears to be because the PowerShell parser child process is spawned without Windows hide/no-window creation flags.
Evidence
Captured on Windows 11 on 2026-04-22 while running TORQUE factory Codex tasks:
torque-server (node.exe, windowsHide:true)
└── codex.exe (spawned directly, not through codex.cmd / node wrapper)
└── pwsh.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand <...>
The parent windowsHide:true is applied to codex.exe. The pwsh.exe descendant still flashes a visible console. We already bypassed the npm/node wrapper (@openai/codex/bin/codex.js) and spawn the bundled native binary directly; the remaining visible window is from the native binary's own child process.
Likely call site
In the current upstream tree, the command-safety parser process is started in:
codex-rs/shell-command/src/command_safety/powershell_parser.rs
Specifically, PowershellParserProcess::spawn() builds:
let mut child = Command::new(executable)
.args([
"-NoLogo",
"-NoProfile",
"-NonInteractive",
"-EncodedCommand",
encoded_parser_script(),
])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::null())
.spawn()?;
I do not see a Windows-specific creation_flags() call on this Command before .spawn().
Suggested fix
On Windows, apply CREATE_NO_WINDOW to the PowerShell parser child process:
#[cfg(windows)]
use std::os::windows::process::CommandExt;
#[cfg(windows)]
const CREATE_NO_WINDOW: u32 = 0x08000000;
let mut command = Command::new(executable);
command
.args([
"-NoLogo",
"-NoProfile",
"-NonInteractive",
"-EncodedCommand",
encoded_parser_script(),
])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::null());
#[cfg(windows)]
command.creation_flags(CREATE_NO_WINDOW);
let mut child = command.spawn()?;
An equivalent STARTF_USESHOWWINDOW + SW_HIDE setup would also work, but CREATE_NO_WINDOW is the simplest fit for a non-interactive helper process.
Reproducer
- On Windows 11, install
@openai/codex@0.122.0.
- From a parent process, spawn the native bundled
codex.exe with hidden-window semantics. For example, Node child_process.spawn(..., { windowsHide: true }).
- Run several Codex tasks that trigger shell command-safety checks.
- Observe that
pwsh.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand <...> children appear in the process tree and briefly flash visible console windows.
Expected: the parser pwsh.exe children still run, but no visible console window appears, even briefly.
Actual: a visible PowerShell console flashes for the parser child despite the parent being hidden.
Notes
This is not a request to change the npm wrapper. The wrapper has already been bypassed in the reproducer. The requested fix is in the Rust/native binary's PowerShell parser spawn path.
Summary
On Windows,
@openai/codex0.122.0(nativecodex.exe) spawns a command-safety PowerShell parser process as:When
codex.exeitself is launched hidden by a parent process, the descendantpwsh.exestill briefly flashes a visible console window. This appears to be because the PowerShell parser child process is spawned without Windows hide/no-window creation flags.Evidence
Captured on Windows 11 on 2026-04-22 while running TORQUE factory Codex tasks:
The parent
windowsHide:trueis applied tocodex.exe. Thepwsh.exedescendant still flashes a visible console. We already bypassed the npm/node wrapper (@openai/codex/bin/codex.js) and spawn the bundled native binary directly; the remaining visible window is from the native binary's own child process.Likely call site
In the current upstream tree, the command-safety parser process is started in:
Specifically,
PowershellParserProcess::spawn()builds:I do not see a Windows-specific
creation_flags()call on thisCommandbefore.spawn().Suggested fix
On Windows, apply
CREATE_NO_WINDOWto the PowerShell parser child process:An equivalent
STARTF_USESHOWWINDOW + SW_HIDEsetup would also work, butCREATE_NO_WINDOWis the simplest fit for a non-interactive helper process.Reproducer
@openai/codex@0.122.0.codex.exewith hidden-window semantics. For example, Nodechild_process.spawn(..., { windowsHide: true }).pwsh.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand <...>children appear in the process tree and briefly flash visible console windows.Expected: the parser
pwsh.exechildren still run, but no visible console window appears, even briefly.Actual: a visible PowerShell console flashes for the parser child despite the parent being hidden.
Notes
This is not a request to change the npm wrapper. The wrapper has already been bypassed in the reproducer. The requested fix is in the Rust/native binary's PowerShell parser spawn path.