Skip to content

Windows: CLI flashes a Windows Terminal window for every spawned command (regression, app-server daemon) #49264

Closed

Description

@JohnWayneeee

What version of Codex is running?

codex-cli 0.159.0 (npm, @openai/codex), Windows 11 Pro 26200

What happened?

Since updating (~2026-09-28), running codex from Windows Terminal briefly opens and closes a
new Windows Terminal window on startup and for every command the agent runs. The VS Code
extension does not have this problem, and older CLI versions didn't either.

Diagnosis (process monitor)

Commands are no longer spawned by the foreground CLI but by a background codex.exe
(app-server daemon) that has no console attached. Each child therefore gets a fresh console,
which Windows hands off to the default terminal app:

git.exe <- codex.exe (daemon) "git ... rev-parse --git-dir"
WindowsTerminal.exe <- svchost.exe
OpenConsole.exe -Embedding <- svchost.exe
conhost.exe <- git.exe

Same for the notify program (codex-computer-use.exe turn-ended) at the end of each turn.

Expected

Child processes spawned with CREATE_NO_WINDOW / hidden window (as the VS Code extension does),
or inherit the foreground CLI's console.

Workaround

Settings > System > For developers > Terminal = "Windows Console Host" stops the flashing.

Config

sandbox_mode = "danger-full-access", [windows] sandbox = "elevated" (flash also occurs with "unelevated")

Activity

  1. added
    bug
    CLI
    windows-os
    app-server
    on Sep 29, 2026
  2. nos1609 commented on Sep 29, 2026

    @nos1609

    Additional reproduction on Windows 11 ARM64 (2026-09-29). The foreground Codex CLI is 0.159.0; the managed app-server daemon executable is 0.157.0. Windows Terminal is the configured default terminal.

    I captured the live process tree without launching another Codex instance:

    • codex.exe app-server --listen unix:// --managed-daemon spawned node_repl.exe, several node.exe stdio MCP processes, and cmd.exe for the codex-security MCP launcher.
    • There were two startup bursts, around 21:38:51 and 21:39:01 local time. Each child had a conhost.exe; Windows Terminal's OpenConsole.exe processes appeared in matching bursts under svchost.exe (roughly nine new instances across the two bursts).
    • codex-code-mode-host.exe spawned later and was accompanied by another conhost.exe / OpenConsole.exe pair.
    • The resulting terminal windows steal focus. This affects MCP/tool-runtime startup as well as the command and notify cases already reported above.

    This is process-tree/timing evidence; I did not capture the exact Windows process creation flags. Expected: background app-server children with stdio pipes should not create visible terminal windows.

  3. RubenEspadaEs commented on Sep 29, 2026

    @RubenEspadaEs

    It's the same for me.

  4. RubenEspadaEs commented on Sep 29, 2026

    @RubenEspadaEs

    You can fix temporaly with:
    codex --no-daemon

    And you can make a alias for CMD making this:
    C:\Users\YOUR_USER\cmd-aliases.txt
    put this:
    codex=codex --no-daemon $*

    reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "doskey /macrofile="C:\Users\YOUR_USER\cmd-aliases.txt"" /f

    reset the CMD.

  5. simplerandomuser commented on Sep 29, 2026

    @simplerandomuser

    I can reproduce this on Windows as well.

    What I observed:

    • The issue happens when running Codex CLI directly, so it is not specific to JetBrains/IntelliJ.
    • My config.toml no longer contains a notify = ... entry.
    • The Codex runtime still contains codex-computer-use.exe under both @oai/cua and @oai/sky.
    • Searching the runtime shows turn_ended / "Notify trusted libraries that a Codex turn ended" strings in the bundled runtime, and references to resolving/writing the Windows Computer Use notify configuration.
    • If I temporarily rename the bundled codex-computer-use.exe files, the flashing CMD windows stop completely.
    • However, after doing that Codex eventually reports No active thread is available.
    • Restoring codex-computer-use.exe makes Codex work normally again, but the CMD windows return.

    This strongly suggests the visible console window is tied to the Windows Computer Use helper / turn-ended path, rather than a user-defined notify hook.

    A no-window spawn (CREATE_NO_WINDOW / equivalent) for that helper would likely avoid the flash without breaking the turn lifecycle.

  6. laxika commented on Sep 29, 2026

    @laxika

    I can verify this. I run 16 instances of Luna, and since the update, terminal windows keep appearing every couple of seconds on my screen. I'm using Windows 11 with 0.159.1. Not just CMD commands, but git commands do this as well (they are running the git shell, installed with Git for Windows).

  7. karl-ravnjak-ctg commented on Sep 30, 2026

    @karl-ravnjak-ctg

    I have the same issue especially with the hooks, i get 10 CLI flashes as once

  8. avabbbb commented on Sep 30, 2026

    @avabbbb

    Additional diagnostics from another Windows 0.159.0 installation, especially concerning the Console Host workaround and already-running daemon processes.

    While preparing this report, I found that 0.159.2 was released with the Windows console suppression fix in #49385. The observations below are from 0.159.0; 0.159.2 has not yet been tested on this machine. This is additional evidence for the existing regression, not a claim that the new release is still affected.

    Environment

    • Windows 11 Pro for Workstations, build 26200, x64.
    • Codex CLI 0.159.0, installed globally using npm.
    • A custom CODEX_HOME containing the managed daemon package packages/app-server-daemon/releases/0.159.0-x86_64-pc-windows-msvc/bin/codex.exe.
    • Codex Desktop Microsoft Store package 26.901.6511.0 is also installed.
    • Windows Terminal Stable 1.24 and Canary 1.26 installed; PowerShell used for CLI sessions.
    • Configuration: approval_policy = "never", sandbox_mode = "danger-full-access", [windows] sandbox = "elevated".
    • Pebrel command hooks and a notify chain ending in codex-computer-use.exe turn-ended are configured. They were retained during the observations below, so this is not a hooks/notify-free minimal reproduction.

    Symptoms and direct observations

    Windows repeatedly appear and disappear during startup and command execution.

    An initial attempt to change the default terminal was incomplete: only DelegationTerminal was changed to the Console Host GUID, while DelegationConsole still selected Windows Terminal. This should not be treated as a failed test of the correctly configured workaround.

    Both values were subsequently set and read back under HKCU\Console\%%Startup:

    DelegationTerminal = {B23D10C0-E52E-411E-9D5B-C09FDF709C7D}
    DelegationConsole  = {B23D10C0-E52E-411E-9D5B-C09FDF709C7D}
    

    After correcting both values, an out-of-process observer using SetWinEventHook(EVENT_OBJECT_SHOW) and IsWindowVisible recorded three visible ConsoleWindowClass windows in a 12-second observation:

    2026-09-30T11:49:47.1097097Z ConsoleWindowClass pwsh.exe(14740) <- codex.exe(23404)
    2026-09-30T11:49:52.8216508Z ConsoleWindowClass pwsh.exe(32940) <- codex.exe(23404)
    2026-09-30T11:49:54.4048304Z ConsoleWindowClass pwsh.exe(6344)  <- codex.exe(23404)
    

    PID 23404 was verified as codex.exe app-server --listen unix:// --managed-daemon, started before the registry change and still running during this observation. PID 32448 was a separate app-server daemon pid-update-loop helper, not a second command-serving daemon. The managed daemon ran under the desktop user's account.

    These observations establish that visible windows were created by children of the old managed daemon. They do not establish registry/delegation caching, or identify whether each individual PowerShell spawn originated from a tool call, a command hook, or another background operation. No reboot or controlled daemon-restart test was performed.

    Mitigation and validation limits

    • A new interactive TUI was observed starting with --no-daemon while the existing daemon remained alive.
    • That TUI actually executed Write-Output CODEX_CONSOLE_PROBE_A and git --version, returning the marker and Git 2.45.2.windows.1 respectively.
    • This demonstrates that the bypassed execution path remains functional; it is not a completed human confirmation of zero flashing across all operations.
    • features.daemon_auto_start = false was also applied, but --no-daemon was used explicitly to avoid reusing an existing daemon.
    • Existing sessions were kept running. As an interim measure, a narrowly scoped window helper hid only console windows whose process ancestry included the verified managed daemon PID. It recorded five matching windows being hidden. Event-based hiding may still allow a brief flash and is not a substitute for suppression at process creation.

    Related: #48074. Microsoft documents that both delegation values must be changed together: https://learn.microsoft.com/en-us/windows/terminal/group-policy#registry-information-2.

  9. Burjuy commented on Sep 30, 2026

    @Burjuy

    Settings > System > For developers > Terminal = "Windows Console Host" stops the flashing.

    dont work

  10. mynameistito commented on Oct 3, 2026

    @mynameistito

    Automatically submitted on behalf of the user by an AI agent.

    I'm seeing the same repeated terminal-window flashing described here during normal Codex use on Windows.

    I checked the versions currently in use:

    codex --version: codex-cli 0.160.0
    managedCodexVersion: 0.159.1
    cliVersion: 0.160.0
    appServerVersion: 0.159.1
    

    So the CLI is newer than the running managed app-server daemon. A process snapshot also showed the managed app-server --managed-daemon and its codex-code-mode-host.exe child running while Codex was open. The user-provided screenshot shows the terminal windows appearing and disappearing during the session.

    I haven't yet tested after updating/restarting the daemon, or compared against codex --no-daemon, and I didn't capture a window/process trace tying an individual popup to a specific child process. This looks consistent with the daemon child-process console-window regression already reported here; sharing the version mismatch in case it helps narrow down why the issue is still visible on a newer CLI.

    Expected: background commands and helper processes should not open visible terminal windows or steal focus.

  11. pingg241 commented on Oct 3, 2026

    @pingg241

    OpenAI is absolute trash. Codex has been completely bug-ridden ever since version 0.157. Weren't you bragging about how amazing your Astra model is? How come the PowerShell pop-up issue still hasn't been fixed after so many versions? You should really learn a thing or two from Claude Code.

  12. etraut-openai commented on Oct 3, 2026

    @etraut-openai
    Contributor

    This is fixed in 0.159.2.

  13. nos1609 commented on Oct 3, 2026

    @nos1609

    This is fixed in 0.159.2.

    @etraut-openai still occuring to me in 0.160.0

    CLI totally unusable for now, spawning
    C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd\git.exe all around, likely some git access trying to complete at session start.

  14. shushu789 commented on Oct 4, 2026

    @shushu789

    still occuring to me in 0.160.0

  15. LukaszWizla commented on Oct 4, 2026

    @LukaszWizla

    @nos1609 @shushu789 @etraut-openai It is indeed fixed but you need to update daemon with codex app-server daemon update --from-cli -y, it updates separately from the cli.

  16. mynameistito commented on Oct 4, 2026

    @mynameistito

    still cooked @etraut-openai

    Cap.2026-10-05.at.11.59.36.mp4
    codex app-server daemon update --from-cli -y

    fixed it ty ty @LukaszWizla

    EDIT: added fix

  17. Mike-Kite commented on Oct 12, 2026

    @Mike-Kite

    Its still happening, its ridiculous because it breaks your workflow and stops you from typing - how did this pass QA?

  18. nos1609 commented on Oct 13, 2026

    @nos1609

    @Mike-Kite looks like they don't care about Windows at all.

  19. Mike-Kite commented on Oct 13, 2026

    @Mike-Kite

    26. @Mike-Kite looks like they don't care about Windows at all.

    It just spawned 104 terminal windows.... asking to simply build a bundle and move some files...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIapp-serverbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions