codex - 💡(How to fix) Fix @openai/codex-sdk opens a visible codex.exe console window on Windows

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

@openai/codex-sdk is useful from Electron apps, editor integrations, background workers, and daemons. In those hosts, SDK calls should be able to run non-interactively without flashing or leaving a visible terminal window on the user's desktop.

Code Example

E:\git\github\..\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\codex\codex.exe

---

const child = spawn(this.executablePath, commandArgs, {
  env,
  signal: args.signal
});
RAW_BUFFERClick to expand / collapse

What is the problem?

When using @openai/codex-sdk from a GUI/background app on Windows, starting a Codex task opens a visible black console window. The window title is the bundled native Codex binary path, for example:

E:\git\github\..\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\codex\codex.exe

This appears to be the TypeScript SDK's direct codex.exe child process, not the separate PowerShell helper window tracked in other Windows issues.

Why this matters

@openai/codex-sdk is useful from Electron apps, editor integrations, background workers, and daemons. In those hosts, SDK calls should be able to run non-interactively without flashing or leaving a visible terminal window on the user's desktop.

Environment

  • OS: Windows 10
  • Host: Node/Electron background worker
  • Observed with: @openai/[email protected]
  • Latest checked: @openai/[email protected]
  • Native binary package: @openai/codex-win32-x64

Evidence

The latest published @openai/[email protected] still spawns the native binary without windowsHide:

const child = spawn(this.executablePath, commandArgs, {
  env,
  signal: args.signal
});

The command is the SDK's JSON exec path, so it is already non-interactive/stdin-stdout based. On Windows, Node will create a visible console window for a console subsystem executable unless the parent passes windowsHide: true.

Expected behavior

When the TypeScript SDK launches Codex in its non-interactive JSON exec mode on Windows, it should not create a visible console window.

Actual behavior

A visible black console window titled with the bundled codex.exe path appears while the task is running.

Suggested fix

Set windowsHide: true on the SDK's child_process.spawn call that launches this.executablePath, or expose a SDK option that allows hosts to pass it through. Since this SDK path uses exec --experimental-json with piped stdio, hiding the console seems like the expected default on Windows.

Related but distinct issues

  • #18984 tracks PowerShell parser child windows spawned by native codex.exe.
  • #20510 tracks long-lived PowerShell helper windows spawned by codex.exe even when the parent launches Codex hidden.

This issue is one level earlier: the TypeScript SDK currently launches codex.exe itself without windowsHide.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When the TypeScript SDK launches Codex in its non-interactive JSON exec mode on Windows, it should not create a visible console window.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING