Skip to content

[Bug] Windows: console window flashes + steals keyboard focus — 2 PRs waiting on review #20492

Closed

Description

@orca-discord-issues

HumanRobot HumanRobot via Discord

Reposting since these have gone quiet. On Windows, Orca's main process is GUI-subsystem and owns no console, so every console-subsystem child it spawns (ssh.exe, agent-browser-win32-x64.exe, powershell.exe) gets a brand-new visible conhost. It flashes on screen and takes foreground — keystrokes typed into an Orca terminal at that moment go into the black box instead. Fix is windowsHide: true at each spawn site, matching the idiom already used across src/main/ssh/.

Issue: #10488 — SSH workspace connect/reconnect flashes a console window (spawn sites missing windowsHide)

PR 1 — SSH spawn sites: #10497
Covers the ssh -G config probe, the ProxyJump ssh -W tunnel, and the ProxyCommand cmd.exe wrapper. 4 files, +38/-3. Closes #10488.

PR 2 — agent-browser spawn sites: #10636
Covers the agent-browser binary spawn and the previously-uncovered DPAPI cookie-import PowerShell spawn. 4 files, +59/-2.

Both are small, independent, and non-draft. Both have tests that fail on main and pass on the branch, plus a real Windows 11 capture showing GetConsoleWindow() go from a visible handle to 0 under the flag — and a check that the shell: true / .cmd-shim caveat (where windowsHide is a silent no-op) doesn't apply to either path.

Last activity on both was Aug 10, no review decision yet. Anything I can do to help move them?

Activity

  1. mmarabel commented on Sep 15, 2026

    @mmarabel
    Contributor

    Info from a local code read at main — not asking for anything, just leaving what I found while triaging, in case it saves someone a step.

    The three spawn families named in this repost look covered at HEAD. src/shared/child-process/spawn-resolution.ts:34 sets windowsHide: true unconditionally for the shared spawn path, and src/shared/child-process/run-process.ts:52 routes spawnProcess / runProcess / runProcessSync through it:

    • ssh — system-ssh-command.ts:46,68, system-ssh-forward-process.ts:55, system-ssh-file-transfer.ts:61,69, system-ssh-dynamic-forward-process.ts:42, ssh-proxy-command.ts:123
    • agent-browser — agent-browser-bridge-execution.ts:215, agent-browser-bridge-raw-process.ts:34, orcad/external-chromium-browser-session.ts:168
    • DPAPI cookie probe — browser-cookie-key.ts:146 (via runProcessSync)

    That landed in #17869 (c252d855ac, 2026-09-05) and first shipped in v1.4.199. One thing that may matter for the two PRs this repost is waiting on: #10497 and #10636 were both closed unmerged on 2026-08-15, so as far as I can tell they are superseded rather than pending review. If windows-console-visibility.test.ts does not already pin the same spawn sites, their test cases might still be worth salvaging.

    Residual I did not chase: forks that do not go through the shared helper — src/main/daemon/daemon-init.ts and src/main/plugins/plugin-host-process.ts are still listed in src/shared/child-process/__fixtures__/windows-console-visibility-allowlist.txt.

  2. AmethystLiang commented on Sep 16, 2026

    @AmethystLiang
    Contributor

    Thanks! PR #10497 is in review to resolve conhost flashing and focus stealing on Windows.

  3. added theissue type on Sep 19, 2026
  4. LotusRenge commented on Sep 23, 2026

    @LotusRenge

    Confirming the residual @mmarabel flagged — src/main/daemon/daemon-init.ts is reproducible on a current install, and it's the highest-volume offender I could measure.

    Environment: Orca 1.4.207, Windows 11, no WSL.

    Repro: Open any project in Orca and start an agent (codex) in a terminal. A black console window appears roughly every 2 seconds and closes immediately.

    Measured: 81 powershell.exe spawns in 3 minutes (~1 per 2.2s), all from the daemon process:

    parent: C:\Users\...\AppData\Local\Orca\daemon-host\1.4.207\Orca.exe
            ...\resources\app.asar.unpacked\out\main\daemon-entry.js --socket \\.\pipe\orca-terminal-...
    

    Spawn:

    powershell.exe -NoProfile -NonInteractive -Command
      "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
       Get-CimInstance -ClassName Win32_Process -Property CommandLine,Name,ParentProcessId,ProcessId |
       Select-Object CommandLine,Name,ParentProcessId,ProcessId | ConvertTo-Json -Compress"
    

    That is the Windows process-table scan used for agent session tracking.

    Why it only shows up sometimes: the scan appears to run while an agent session is active. With Orca open but no agent running I measured 0 spawns over 20s; the moment a codex session starts it goes to roughly one every 2 seconds.

    Two related notes:

    1. This spawn does not go through src/shared/child-process/spawn-resolution.ts, so it does not inherit the unconditional windowsHide: true that fixed the ssh / agent-browser families.

    2. There is a second visible window on agent launch: Orca runs

      cmd.exe /K "chcp 65001 > nul & if defined ORCA_CODEX_LAUNCH_PREFLIGHT call %ORCA_CODEX_LAUNCH_PREFLIGHT_CMD_QUOTE%%ORCA_CODEX_LAUNCH_PREFLIGHT%%ORCA_CODEX_LAUNCH_PREFLIGHT_CMD_QUOTE% agent hooks prepare-codex > nul 2>&1"
      

      which is also spawned un-hidden. Note the shell: true / .cmd-shim caveat from the original report applies here — windowsHide may be a no-op for the cmd.exe path, so it may need the Invoke-CimMethod Win32_Process Create route or similar.

    Happy to test a patch against this path if someone points me at a branch.

  5. LotusRenge commented on Sep 23, 2026

    @LotusRenge

    Separate from the flashing issue, and in my experience more severe: closing Orca leaks the daemon and the running agent session, and the orphaned session keeps firing the Orca agent hooks indefinitely. Console windows keep appearing and never stop.

    Repro (Windows 11, Orca 1.4.207, no WSL):

    1. Open a project in Orca and start an agent (codex) in a terminal.
    2. Close Orca.
    3. Observe: powershell.exe windows keep appearing every few seconds, indefinitely.

    Measured: with Orca already closed, 8 powershell.exe spawns in a 15-second sample, and the count was still climbing — hundreds had accumulated by the time I killed it by hand. It did not stop on its own.

    Orphans left behind after the UI exited:

    PID 6416  C:\Users\...\AppData\Local\Orca\daemon-host\1.4.207\Orca.exe
              ...\out\main\daemon-entry.js --socket \\.\pipe\orca-terminal-...
    
    PID 9740  C:\Users\...\AppData\Roaming\orca\codex-runtime-home\...\codex.exe
    

    Both remained after the main Orca.exe (and its crashpad handler) were gone.

    What the orphaned codex spawns (both parented by PID 9740):

    powershell.exe -NoProfile -Command C:\Users\...\.orca\agent-hooks\codex-hook.cmd
    powershell.exe -NoProfile -Command "C:/Users/.../.orca/agent-hooks/claude-hook.cmd || echo {}"
    

    Related: the hooks look registered twice per event. In Orca's managed codex home (%APPDATA%\orca\codex-runtime-home\home\hooks.json) every event lists two Orca hook scripts:

    "PreToolUse": [
      "C:\\Users\\...\\.orca\\agent-hooks\\codex-hook.cmd",
      "C:/Users/.../.orca/agent-hooks/claude-hook.cmd || echo {}"
    ]

    The same pair repeats for PermissionRequest, PostToolUse, PostCompact, SessionStart, UserPromptSubmit, SubagentStart, SubagentStop and Stop. That doubles the consoles spawned per event. The user-level ~/.codex/hooks.json has only one entry per event, so this looks like a duplicate or legacy entry that a reconcile pass isn't removing.

    Impact: after Orca exits, the leaked session keeps hitting a hook endpoint that no longer exists, and it never self-terminates. Fixing windowsHide would hide the flash but would not fix the leak — the orphaned process and the duplicated hook registrations are worth addressing on their own.

    Workaround: manually kill the Orca.exe under AppData\Local\Orca\daemon-host\ and the codex.exe under AppData\Roaming\orca\codex-runtime-home\.

  6. wwenrr commented on Sep 26, 2026

    @wwenrr

    Hitting this too on Windows 11, Orca 1.4.212. Confirmed via process tracing (Get-CimInstance Win32_Process on the flashed cmd.exe/conhost.exe, walking ParentProcessId) that the visible console is spawned under Orca's daemon-host process tree, matching the "console-subsystem child gets a brand-new visible conhost" pattern described above.

    One additional data point that might be relevant: app.asar ships a vendored/patched node-pty@1.1.0 with two custom patch files — node-pty-1.1.0-console-list-agent-patch.cjs and node-pty-1.1.0-windows-pty-teardown-patch.cjs. All the regular spawn/execFile/fork call sites I could find in app.asar do set windowsHide: true correctly, so the gap seems narrower than "windowsHide missing everywhere" — consistent with this issue's specific spawn sites (ssh/agent-browser/powershell) rather than a systemic problem. Flagging the node-pty patches here in case the PTY create/teardown path is a separate/additional source of the same symptom worth covering in the same pass.

    +1 for getting #10497 and #10636 reviewed — both look like clean, well-tested fixes for the exact spawn sites causing this.

  7. AmethystLiang commented on Sep 29, 2026

    @AmethystLiang
    Contributor

    Thanks for the debug info. Will get this resolved in the next release.

  8. spock-wen commented on Sep 29, 2026

    @spock-wen

    Additional reproduction details from my Windows setup:

    • Active agent: Grok. A console window flashes repeatedly and steals focus when Grok runs commands/tools.
    • Orca daemon-host version observed in the process trace: 1.4.215.
    • Codex desktop installed on the same PC: 26.924.22138 (build 11645, production channel). This is the desktop app version, not a measured Codex CLI version; Codex was not the active agent for this reproduction.

    The ProcMon capture includes an Orca grok-hook.cmd invocation and many conhost.exe starts. It does not record foreground-window changes, so I cannot attribute every individual flash to one spawn site.

  9. brennanb2025 commented on Sep 29, 2026

    @brennanb2025
    Contributor

    Status update from the Orca team, for everyone watching this issue.

    What's causing the windows we can still reproduce. Since Codex 0.156, the first codex you open starts a shared background server, and later Codex sessions connect to it. On Windows that server runs without a console of its own, so every command it runs for Codex (the shell tool, git, and agent hooks) gets a brand-new visible terminal window, which also takes keyboard focus. On a Windows 11 test machine, one short Codex turn attached to that server opened 23 windows in about 10 seconds. This is Codex's own process launching, tracked upstream at openai/codex#44768.

    What's changing in the next release (1.4.217). Orca now starts Codex in its terminals with --no-daemon (#23900), so each Codex tab runs its own server inside the terminal and those commands stay hidden. On the release candidate, Codex opened no windows in PowerShell and Git Bash terminals.

    Not covered yet: Command Prompt (cmd.exe) terminals. The launch change is added through each shell's startup, and cmd.exe doesn't have that hook yet, so Codex in a Command Prompt tab still connects to the shared server and still flashes windows. Until that's fixed, switching the terminal shell to PowerShell or Git Bash avoids it. We're looking at covering Command Prompt next.

    When we expect the rest to be fixed. Codex has fixed this on its side: its background server now starts those commands hidden (openai/codex#48483, openai/codex#49164 and openai/codex#49308, merged September 26–29). Codex 0.159.0 only has part of that, and it still opens windows (confirmed by another user in openai/codex#44768). The complete fix is in the 0.160 and 0.161 prereleases, so we expect the first stable Codex release after 0.159.0 to stop the windows in every terminal, Command Prompt included. After updating Codex, close all Codex sessions once so its background server restarts on the new version. We'll confirm here once that release is out and we've re-tested it.

    Other sources reported in this thread:

    We'll update here when Command Prompt is covered.

  10. LotusRenge commented on Sep 30, 2026

    @LotusRenge

    Independent verification on a real user environment (Orca 1.4.209, Windows 11, no WSL), plus one data point relevant to the cmd.exe gap.

    1. The daemon PowerShell process-table scan is gone — confirmed.

    Measured 0 powershell.exe process-table scans in a 60-second window.

    For comparison, on 1.4.207 this same install produced 81 spawns in a 3-minute window (~1 every 2.2s), all parented by:

    C:\Users\...\AppData\Local\Orca\daemon-host\1.4.207\Orca.exe
      ...\resources\app.asar.unpacked\out\main\daemon-entry.js --socket \\.\pipe\orca-terminal-...
    

    with the spawn being the Get-CimInstance -ClassName Win32_Process ... | ConvertTo-Json scan. So #15749 is working here.

    2. This install falls in the "Command Prompt not covered" bucket.

    Orca launches Codex tabs here through cmd.exe (3 such processes observed simultaneously):

    cmd.exe /K "chcp 65001 > nul & if defined ORCA_CODEX_LAUNCH_PREFLIGHT call %ORCA_CODEX_LAUNCH_PREFLIGHT_CMD_QUOTE%%ORCA_CODEX_LAUNCH_PREFLIGHT%%ORCA_CODEX_LAUNCH_PREFLIGHT_CMD_QUOTE% agent hooks prepare-codex > nul 2>&1"
    

    So the --no-daemon change in 1.4.217 will not change anything for this configuration — the fix here has to come from the Codex 0.160+ release, as the status update describes. Worth knowing that the "switch your terminal shell to PowerShell or Git Bash" workaround is not just a niche case: this is a default-looking setup.

    3. Minor, possibly related — a separate spawn at Codex launch.

    The same cmd.exe /K "... agent hooks prepare-codex ..." line above is itself spawned by Orca.exe at Codex launch (visible in the process trace alongside the Codex background server spawns). I did not confirm whether it renders a visible window, so I am flagging it only in case it is a second spawn site on the same path. If it is already covered, please ignore.

    Thanks for the detailed status update — the breakdown of what is fixed vs. pending was easy to follow.

  11. AmethystLiang commented on Sep 30, 2026

    @AmethystLiang
    Contributor

    This seems to be a codex CLI upstream issue openai/codex#48074, openai/codex#44768

    Fixes from Codex CLI are supposed to land in their next 1-2 versions

  12. brennanb2025 commented on Sep 30, 2026

    @brennanb2025
    Contributor

    Hey all, good news, they fixed this upstream.

    As they said in the post, you'll need to update the codex daemon. Thank you!

  13. brennanb2025 commented on Sep 30, 2026

    @brennanb2025
    Contributor

    Quick clarification for the original report: the ssh, agent-browser and cookie-import windows from the first post were fixed on Orca's side in #15746 and #15887 (both shipped in 1.4.190). Those replaced #10497 and #10636. The Codex windows discussed later in the thread are the ones fixed upstream in Codex 0.159.2.

    If you still see windows on current Orca, with your Codex background server on 0.159.2 or later, please open a new issue with your Orca and agent versions. That especially applies to Grok, which we weren't able to verify. @LotusRenge, we couldn't reproduce the duplicate claude-hook.cmd entry in Orca's managed Codex home. If you still have it, a new issue with your %APPDATA%\orca\codex-runtime-home\home\hooks.json would help. The daemon keeping terminals (and agents in them) running after Orca closes is intentional, so they're still there when you reopen Orca.

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions