Skip to content

[Windows][CLI 0.157.1] Background CMD/PowerShell windows steal focus and interrupt typing #48859

Closed as duplicate

Description

@MasterLKH180cm

Summary

After updating Codex CLI to 0.157.1 on Windows today, background command execution repeatedly opens visible CMD and/or PowerShell windows.

These windows do not just flash: they frequently steal foreground focus, which interrupts normal desktop use and can even break active typing/input in another window.

This appears related to #48540, #48440, #48356, and #48074, but I am opening this report because the focus-stealing / keyboard interruption is severe enough to make normal use difficult after the 0.157.1 update.

Environment

  • OS: Windows
  • Codex CLI: 0.157.1
  • Shells observed: cmd.exe / PowerShell
  • Regression noticed immediately after updating to 0.157.1

Steps to reproduce

  1. Update/install Codex CLI 0.157.1 on Windows.
  2. Start a normal Codex session.
  3. Ask Codex to perform work that executes background commands/tool calls.
  4. Continue using another application or typing while Codex works.
  5. Observe separate CMD/PowerShell windows repeatedly appear and disappear.
  6. The spawned window can take foreground focus, interrupting typing and normal interaction with the currently active application.

Actual behavior

  • Background commands spawn visible console/PowerShell windows.
  • Windows repeatedly flash/open and close during agent work.
  • The spawned window can steal foreground focus.
  • Keyboard input/typing in the user's current application is interrupted or redirected.
  • This makes background execution intrusive and significantly disrupts normal desktop use.

Expected behavior

Background/non-interactive commands should run without creating visible foreground windows.

On Windows, child processes used for internal/background work should be launched in a way that prevents console-window creation or activation (for example, using the appropriate Windows process creation flags / hidden-window behavior where applicable).

Codex background work should never steal focus from the user's active application.

中文說明

今天將 Codex CLI 更新到 0.157.1 後,在 Windows 上發現明顯的 regression。

Codex 在執行各種 background command / tool call 時,會不斷額外開啟 CMD 或 PowerShell 視窗。這些視窗不只是短暫閃爍,還會頻繁搶走目前視窗的 focus,導致正在其他程式中的正常操作被中斷,甚至連正在輸入的文字都會被打斷或輸入到錯誤的視窗。

重現方式

  1. Windows 上更新 Codex CLI 至 0.157.1。
  2. 啟動 Codex CLI。
  3. 執行會觸發 background command / shell tool call 的一般任務。
  4. Codex 工作期間切換到其他程式並正常打字。
  5. 可以看到 CMD / PowerShell 視窗反覆跳出、消失。
  6. 這些視窗有時會搶走前景 focus,直接干擾鍵盤輸入。

預期行為

Codex 的 background / non-interactive command 應該在背景執行,不應產生可見的 CMD/PowerShell 視窗,更不應搶走使用者正在操作的前景視窗 focus。

希望 Windows 上的 background child process 能以不建立可見 console window、也不 activate foreground window 的方式啟動。

Related reports

Activity

  1. added
    bug
    CLI
    windows-os
    tool-calls
    on Sep 28, 2026
  2. vjaygiri46 commented on Sep 28, 2026

    @vjaygiri46

    Independent reproduction on Codex CLI 0.158.0 for Windows, installed through npm. I began seeing this after updating to 0.158.0; the prior version seemed quiet, but I have not verified the exact last good version.

    Impact: Starting a normal CLI session can open roughly 20–30 short-lived PowerShell, CMD, or Windows Terminal windows. More appear during local tool calls. They take foreground focus and interrupt typing in Microsoft Word. Claude CLI on the same machine runs shell commands without this behavior (user observation).

    Read-only checks on 2026-09-28:

    • The npm Codex CLI executable is under %APPDATA%\npm\node_modules\@openai\codex\...\bin\codex.exe; the CLI displayed v0.158.0, and the session reported CODEX_VERSION=0.158.0.
    • This session's tool PowerShell process had as its direct parent the 0.158.0 managed server under %USERPROFILE%\.codex\packages\app-server-daemon\releases\0.158.0-x86_64-pc-windows-msvc\bin\codex.exe, running app-server --listen unix:// --managed-daemon.
    • The managed server also directly owned multiple cmd.exe processes launching configured .cmd MCP scripts. Separate Codex desktop and VS Code app-server processes were also present.
    • I did not capture window handles at the moment of focus theft, so I cannot assign every visible window to a specific child process. The daemon child-spawn path is the leading explanation, not a proven exclusive cause on this machine.

    --no-daemon control: A separate v0.158.0 CLI session launched with --no-daemon and successfully ran one read-only PowerShell command (Write-Output NO_DAEMON_TEST_OK). Its observed cmd.exe helpers were children of that CLI process rather than the managed server. The visual comparison was inconclusive because the original managed session remained active and the user could not confidently attribute popups to one session. No daemon was stopped and no configuration or version was changed.

    Expected: background commands and helpers should never create foreground windows or take focus from Word. This also appears related to #48422. Posted by Codex at the user's request; usernames, full local paths, and session contents are omitted.

  3. etraut-openai commented on Sep 29, 2026

    @etraut-openai
    Contributor

    We're tracking this in #48074, and we're working on a fix.

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

    CLIbugtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions