Skip to content

Windows: black console windows flash during goal start (console children launched without CREATE_NO_WINDOW) #9430

Backlog

Description

@zczsyqxl

Summary

On Windows, loopx intermittently flashes one or more black console windows while running, and occasionally a detached launch fails with:

error 2147942632 (0x800700e8) when launching 'C:\...\uv\tools\loopx\Scripts\python.exe -P -m loopx.usage_goal'

(0x800700e8 = Win32 error 232, ERROR_NO_DATA / "The pipe is being closed".)

Root cause: most child-process launch sites spawn console-subsystem executables (node.exe, python.exe) without CREATE_NO_WINDOW / DETACHED_PROCESS. When the parent process has no console (e.g. loopx is invoked from a console-less host such as an embedded agent harness session), Windows allocates a visible console host window for every short-lived console child, which appears as a briefly flashing black window.

Environment

  • loopx 2.4.1 (installed via uv tool)
  • Windows 11 x64, Python 3.12 (uv tool venv)
  • Host: OpenCode CLI session (pwsh spawned with piped stdio, no attached visible console)

Reproduction

  1. Run a goal-start flow (/loopx <goal text>) from a console-less host.
  2. During the first minute (bootstrap → agent registration → requirement/todo writes → quota guards), several black console windows flash briefly.
  3. Occasionally the detached usage observer itself fails to launch with the 0x800700e8 error above.

Cause (loopx 2.4.1 line references)

Windows rule: a console-subsystem child started by a console-less parent gets its own conhost window unless created with DETACHED_PROCESS / CREATE_NO_WINDOW.

Affected launch sites in the installed v2.4.1 (matches the current v2.4.1 tag):

  • loopx/control_plane/runtime/node_probe.py:121 — subprocess.run([node, "--version"], ..., capture_output=True): no creationflags. Node is probed on nearly every CLI invocation.
  • loopx/control_plane/effect_runtime.py:1365 — subprocess.Popen([... node ...]): sets start_new_session=os.name != "nt" (a no-op on Windows) but no Windows creationflags; the long-lived Node effect-runtime host is launched without CREATE_NO_WINDOW.
  • loopx/usage_ping.py:136 (control()) — subprocess.run(_command(), ...) spawning Node: no creationflags.
  • loopx/usage_ping.py:263 (_detach) correctly uses DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP for the observer itself, so it does not flash — but that console-less observer then spawns further console children via control() / _command() without flags, which allocate visible consoles. This is also the process whose launch intermittently fails with ERROR_NO_DATA (232).

A single /loopx goal start runs dozens of short CLI invocations in sequence (bootstrap, agent registration, acceptance refine, todo add/list readbacks, refresh-state, heartbeat-prompt, multiple quota should-run), each of which may probe Node or start/reuse the effect runtime — producing a burst of flashing windows up front. The same happens for every quota-guarded turn.

Suggested fix

On os.name == "nt", pass creationflags=subprocess.CREATE_NO_WINDOW at all child-spawn sites that launch console executables (a shared spawn helper would keep this consistent):

  • node_probe.py probe_node
  • effect_runtime.py runtime-host Popen
  • usage_ping.py control() and anything else spawned from the detached observer

DETACHED_PROCESS-style detachment can stay as-is for the long-lived observer; the fix only ensures no console window is ever allocated for console children.

Happy to provide more details or test a patched wheel if helpful.

Activity

  1. LIHUA919 commented on Nov 25, 2026

    @LIHUA919
    Contributor

    Claiming this issue: PR #9435 adds a shared no_console_creationflags() helper (CREATE_NO_WINDOW on Windows, 0 elsewhere) at the reporter's launch sites (node probe, effect-runtime host Popen, usage_ping.control()), keeps the detached observer's DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP and makes its stdin write tolerant of the child-closed pipe race behind the intermittent 0x800700E8 / ERROR_NO_DATA failure, and covers the additional spawn sites the goal-start/turn/quota flow executes on current main (registry git probes, validation commands, scheduler follow-up, turn-driver host spawns) plus the TS hosts missing windowsHide: true. Non-Windows behavior is unchanged; Windows visual/pipe behavior is disclosed to CI Windows lanes in the PR body. Happy to iterate on the review.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions