Repository navigation
Description
What version of Codex CLI is running?
The original incident occurred in a downstream build based on upstream 0.157.1, with a separately managed app-server still on 0.157.0 during the initial investigation. Updating the daemon addressed some symptoms, but additional direct process-launch paths needed fixes.
The reference patch and regression tests below are based directly on official upstream main at 44fe510ce3ee61c8ef623adcbf89b901c73ddd61, which already includes #48138, #48238, and #48483. The patch contains no downstream localization or interface changes. This report distinguishes the original runtime incident from the subsequent upstream source inspection and scoped test run; it is not a claim that the latest official release was reproduced end to end.
What subscription do you have?
Not provided. The regression checks exercise local process creation without model requests.
Which model were you using?
Not recorded for the original incident. Some affected helpers run during startup, before a model request.
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64.
What terminal emulator and version are you using (if applicable)?
PowerShell on native Windows. Unexpected Windows Terminal windows were observed during process inspection; the terminal version was not captured.
Codex doctor report
Not captured before remediation. The source baseline, affected launch paths, reference patch, and validation results are included below.
What issue are you seeing?
Repeated external PowerShell, CMD, and Git console windows, focus stealing, and accumulated background processes made Codex CLI unusable on my workstation. Temporarily disabling MCP reduced the symptoms but did not eliminate them, because several non-MCP helpers also create processes directly.
Related reports: #48039, #48876, and #48601. This is a source-level follow-up with a tested reference patch for the remaining launch paths after the code-mode host, local MCP server, and shared pipe fixes in #48138, #48238, and #48483.
In the inspected upstream source, several helpers construct std::process::Command or tokio::process::Command directly and do not inherit the shared pipe launcher's CREATE_NO_WINDOW protection. Redirecting standard streams alone does not prevent Windows from allocating a console when the parent has no console.
What steps can reproduce the bug?
The original runtime sequence was:
- Start or resume Codex on native Windows using a detached app-server/managed daemon, from a Git working directory with MCP and plugin startup activity enabled.
- Observe startup and subsequent background activity, including PowerShell discovery/parsing and internal Git operations.
- Additional external console windows appear. Opening further sessions can trigger more windows; disabling MCP alone did not fully resolve this in my environment.
One specifically captured remaining launch was plugin marketplace synchronization:
git -c safe.bareRepository=explicit ls-remote https://github.com/openai/plugins.git HEAD
That direct plugin Git path produced a visible Windows Terminal window during local validation before it was patched. The same probe produced no new visible window after the local correction.
For a source-level reproduction/validation, the linked commit adds Windows tests that inspect the actual child console state for PowerShell probing/parsing, Git, plugins, hooks, and direct Job Object launches. They also check parser protocol, standard streams, or descendant containment as applicable. Run the scoped suite shown below on Windows after applying the reference commit.
What is the expected behavior?
Non-interactive background helpers should preserve their standard streams, exit behavior, and process-tree containment without opening visible consoles or stealing focus. Existing interactive terminals and the ConPTY execution path should retain their behavior.
Additional information
Root cause and proposed correction
The inspected baseline has three related gaps:
- Direct PowerShell discovery/availability probes, the persistent command-safety parser, Git helpers, plugin Git/npm commands, hooks, and hook cleanup do not consistently set
CREATE_NO_WINDOW. - Direct Job Object preparation sets
CREATE_SUSPENDED, replacing the command's creation flags without preservingCREATE_NO_WINDOW. - Git and hook fallback paths reset creation flags to zero when retrying without containment. They should clear suspension while retaining
CREATE_NO_WINDOW.
The reference patch adds the missing flag at these direct launch sites, uses CREATE_SUSPENDED | CREATE_NO_WINDOW for direct Job Object launches, and retains CREATE_NO_WINDOW on the fallback paths. The existing shared pipe fix is not duplicated.
Reference patch
- Commit: Cec1c@8b6d0ae
- Complete diff against the upstream baseline: 44fe510...Cec1c:fix/windows-background-console-windows
- Fork branch:
fix/windows-background-console-windows - Scope: one commit, 14 Rust source/test files, 202 additions and 8 deletions across
core-plugins,git-utils,hooks,shell-command, andutils/pty.
The branch starts directly from upstream main and includes only this fix and regression tests. It does not include fork localization/interface changes, launcher workarounds, dependency changes, configuration changes, or release workflows.
Validation
Tested on Windows x64 with Rust 1.95.0:
just test --locked -p codex-utils-pty -p codex-git-utils -p codex-hooks -p codex-shell-command -p codex-core-plugins --test-threads 2
- 860 distinct tests passed across the scoped run and targeted reruns.
- All five added console regression tests and the extended Job Object test passed.
- The parser test checks the live parser's console state and a real parsing request. The Job Object test retains descendant-containment coverage.
- Scoped
just fix --lockedpassed with no Clippy warnings or additional changes. Scoped Rust formatting andgit diff --checkpassed. - The full
just fmtRust invocation exceeds the Windows command-line length limit (os error 206), so formatting was checked for the five affected packages.
Three tests still fail locally, and all three were reproduced with the same errors on completely unmodified upstream 44fe510ce3ee61c8ef623adcbf89b901c73ddd61:
search_remote_plugins_redacts_sensitive_parameters_from_transport_errors:expected transport request error.conpty_ctrl_c_interrupts_powershell_foreground_childandconpty_delivers_input_to_foreground_children:CreateProcessWcannot launch the installed Microsoft Store PowerShell executable (os error -1073283067).
Python subprocess fixtures used a standard CPython installation after the Microsoft Store Python alias failed under ConPTY. These environment limitations and baseline failures are not presented as a passing full suite.
Why I am sharing this as an issue
The disruption was severe enough that I had to implement a local fix to resume working. Since that work was already done, I prepared an isolated upstream-based patch and regression tests to share the findings.
I initially attempted to submit a PR without prior maintainer approval because the issue prevented normal CLI use. GitHub rejected PR creation, and the repository currently restricts it to collaborators. I understand that the contribution guide does not accept external code PRs, so I am sharing the root-cause analysis and reference implementation through the issue tracker instead. I respect the maintainers' decision on whether and how to use it.
Activity
github-actions commentedon Sep 28, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etraut-openai commentedon Sep 29, 2026
We're tracking this issue in #48074, and we're working on a fix.