Repository navigation
Description
Summary
PowerShell console flashing is not fully resolved by the Windows background-process fixes. Please investigate the remaining persistent PowerShell parser launch path rather than treating all console flashing as resolved by 0.159.2.
Issue #44768 was closed on September 30 with a statement that 0.159.2 should fix this. Before that closure, we posted a reproducible remaining failure with a passing minimal fix: #44768 (comment).
Versions and evidence boundaries
- Windows 11 build 26200, Windows PowerShell (
powershell.exe). - User-observed terminal/PowerShell flashes occurred during ordinary prompts and tool calls with the official 0.159.0 daemon. Our custom patched 0.159.0 daemon eliminated the observed flashes; follow-up tool calls and window tracing confirmed that result.
- The isolated parser regression below was reproduced against upstream main
bd5185820d, after the broader console fixes had landed. - On September 30, we inspected the newest published alpha, 0.161.0-alpha.5. Its persistent parser still uses plain
std::process::Command::newfollowed bycommand.spawn(), withoutCREATE_NO_WINDOWor the shared background-command helper: https://github.com/openai/codex/blob/rust-v0.161.0-alpha.5/codex-rs/shell-command/src/command_safety/powershell_parser.rs#L115-L129. - We have not installed or runtime-tested the official 0.159.2 or 0.161.0-alpha.5 binary. The alpha finding is a source inspection, and the runtime evidence is the upstream-source regression below. We are not claiming a new full-binary reproduction on those releases.
Expected behavior
A noninteractive parser helper started by a detached/background daemon must not allocate a console window. Normal interactive ConPTY behavior should remain intact.
Other reports
These are additional reports of visible Windows console/PowerShell flashes, not proof that every report has the same underlying cause or was tested on the latest release:
- Windows: terminal windows repeatedly flash during requests after installing the Codex daemon #48074 — Windows: terminal windows repeatedly flash during requests after installing the Codex daemon (open).
- Windows native CLI: visible CMD/PowerShell windows flash for every shell tool call #49371 — Windows native CLI: visible CMD/PowerShell windows flash for every shell tool call (open).
- Windows: CLI flashes a Windows Terminal window for every spawned command (regression, app-server daemon) #49264 — Windows: CLI flashes a Windows Terminal window for every spawned command (regression, app-server daemon) (open).
- Codex Windows PowerShell Console Flash #36560 — Codex Windows PowerShell Console Flash (open).
Requested follow-up
Please cover PowershellParserProcess::spawn with Windows console suppression and a detached-parent regression test, and validate ordinary prompt/tool execution on Windows with the managed daemon. The broader fixes in #49164 and #49308 are useful, but do not modify this independent parser spawn site. Please keep this remaining path tracked until it is addressed.
Detailed reproduction, minimal fix, and full regression
Remaining console window: persistent PowerShell parser
Thanks for #49164 and #49308. After comparing a locally verified Windows console-suppression patch against current main, the persistent PowerShell parser is the one remaining launch path from that patch that is still missing suppression.
Verified base: bd5185820d (current main when tested), Windows 11 build 26200, using Windows PowerShell (powershell.exe) as selected by the existing test helper.
In PowershellParserProcess::spawn, the code constructs a plain std::process::Command and calls spawn() without CREATE_NO_WINDOW. It does not use the new background-command or Job Object helpers.
Reproduction and results
I added the regression below to the existing Windows-only tests module in that file. It starts an isolated test process with DETACHED_PROCESS, launches the actual persistent parser, verifies that parsing Get-Location works, and checks the parser console window from the isolated process.
just test --release -p codex-shell-command --lib -E 'test(parser_process_has_no_console_window_from_detached_parent)'On the unchanged production code, the test failed on both nextest attempts with:
PowerShell parser created a console window
Adding a Windows-only CREATE_NO_WINDOW flag immediately before command.spawn() made the same regression pass. The full affected unit suite then passed:
just test --release -p codex-shell-command --lib
174 tests run: 174 passed, 0 skipped
The minimal local fix is:
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
command.creation_flags(CREATE_NO_WINDOW);
}Reusing the new shared background_command helper would also fit the upstream implementation if preferred. This parser is a background helper with piped stdin/stdout; interactive ConPTY creation is separate.
Detached-parent regression added to the existing Windows test module
#[test]
fn parser_process_has_no_console_window_from_detached_parent() {
use std::os::windows::process::CommandExt;
const CHILD_MARKER: &str = "CODEX_POWERSHELL_PARSER_CONSOLE_TEST";
if std::env::var_os(CHILD_MARKER).is_none() {
let output = Command::new(std::env::current_exe().unwrap())
.args([
"parser_process_has_no_console_window_from_detached_parent",
"--test-threads=1",
"--nocapture",
])
.env(CHILD_MARKER, "1")
.creation_flags(0x00000008)
.output()
.unwrap();
assert!(
output.status.success(),
"detached parser test failed: {}{}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr),
);
return;
}
let powershell = try_find_powershell_executable_blocking()
.expect("PowerShell is required for the detached parser regression");
let mut parser =
PowershellParserProcess::spawn(powershell.as_path().to_str().unwrap()).unwrap();
assert_eq!(
parser.parse("Get-Location").unwrap(),
PowershellParseOutcome::Commands(vec![vec!["Get-Location".to_string()]]),
);
#[link(name = "kernel32")]
unsafe extern "system" {
fn AttachConsole(process_id: u32) -> i32;
fn FreeConsole() -> i32;
fn GetConsoleWindow() -> *mut std::ffi::c_void;
}
// CREATE_NO_WINDOW may still provide an attachable headless console.
// Inspect its window from this isolated process after the parser responds.
let attached = unsafe { AttachConsole(parser.child.id()) };
if attached == 0 {
assert_eq!(std::io::Error::last_os_error().raw_os_error(), Some(6));
} else {
let window = unsafe { GetConsoleWindow() };
unsafe { FreeConsole() };
assert!(
window.is_null(),
"PowerShell parser created a console window"
);
}
}The test intentionally checks GetConsoleWindow() rather than requiring AttachConsole() to fail: a headless PowerShell process can still expose an attachable console with no window.
This is a focused reproduction on the source commit above, not a full runtime validation of the official 0.159.2 binary. Sharing it here in accordance with the contribution guide's request for issue reports and root-cause analysis instead of external PRs. Related: #48074.
Activity
github-actions commentedon Sep 30, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
hackus commentedon Oct 2, 2026
I have a focused implementation for the persistent PowerShell parser launch path in my fork:
The change applies
CREATE_NO_WINDOWwhenPowershellParserProcess::spawnstarts its background PowerShell child. The regression starts from a detached parent, checks that parsing works, and verifies that the parser has no console window. On Windows,cargo +1.95.0 test -p codex-shell-command --libpassed all 174 tests.I also built and launched the patched CLI locally. End-to-end tool execution is still unverified: the standalone CLI build was missing its
codex-windows-sandbox-setup.execompanion, so sandboxed commands failed before they could run. That local packaging problem is separate from this parser patch.I am sharing the branch here for inspection in line with the contribution guide's issue-based workflow.