Skip to content

[Bug][Windows] Visible console window pops up when the proxy starts/restarts from a headless parent (npm launcher spawn missing windowsHide) #1236

Description

@wade19990814-hue

Client or integration

OpenCodex dashboard (also ocx CLI / npm launcher)

Area

Platform (Windows / macOS / Linux)

Summary

On Windows, a visible console (terminal) window pops up every time the proxy starts or restarts from a headless parent — for example the dashboard "Drain & restart" action, a Task Scheduler / desktop-shortcut launch, or a GUI update restart. The window belongs to the Bun child process and stays open while the proxy runs, which is confusing and makes users think the proxy is a terminal app (or they close it and kill the proxy).

Root cause: the npm bin launcher bin/ocx.mjs spawns the Bun runtime with stdio: "inherit" but omits windowsHide: true. When the launcher itself has no console window (detached spawn, scheduler, shortcut), Node's spawn with stdio: "inherit" causes Windows to allocate a brand-new visible console for the Bun child. Running ocx from an existing terminal hides the problem because the child inherits that console. All other detached spawns in the codebase already set windowsHide: true (e.g. src/cli/index.ts, system-restart.ts); only the launcher's final spawn is missing it.

Reproduction

  1. Install the published npm package on Windows: npm install -g @bitkyc08/opencodex
  2. Start the proxy from a headless context, e.g. open the Web UI and trigger "Drain & restart" (POST /api/system/restart), or launch ocx from a Task Scheduler task / desktop shortcut.
  3. Observe a new visible console window appearing, running ...\bun.exe ...\src\cli\index.ts start --port 10100.
  4. Closing that window terminates the proxy (all routed models disconnect).

Expected: no window appears for background launches; the proxy keeps running with windowsHide: true.

Version

2.10.2 (reproduced on 2.10.2-preview.20260806; source on main and dev has the same omission)

Operating system

Windows 11 (any Windows version with a console host)

Provider and model

Not provider-specific.

Logs or error output

No logs needed; the running process is visible via Task Manager as bun.exe with a console window.

Screenshots and supporting files

n/a

Redacted configuration

{}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginstallInstallation or packagingplatformOS/service/tray/ACL (Windows-heavy, not Windows-only)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions