Suppress Windows console windows for console-subsystem children (#9430) #9435
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #9435"
general
weight: 0.35
BigDataDZ
Fixes #9430
Problem
On Windows,
loopxflashes black console windows while running, and the detached usage observer intermittently fails witherror 2147942632 (0x800700E8)(Win32 232,ERROR_NO_DATA, "The pipe is being closed") when launchingpython.exe -P -m loopx.usage_goal.Windows allocates a visible conhost window for every console-subsystem child (
node.exe,python.exe,git.exe) whose parent has no console. A single goal start from a console-less host (bootstrap, agent registration, requirement/todo writes, quota guards) runs dozens of such children. The0x800700E8failure is the detached-observer pipe race: a child that exits before reading (for example a suppressed observer) closes its stdin pipe first, and the parent's write then fails with ERROR_NO_DATA.Affected sites enumerated on current main
Reporter's v2.4.1 list, verified against this main:
| Site | Child | Change |
| --- | --- | --- |
|
loopx/control_plane/runtime/node_probe.pyprobe_node| node |CREATE_NO_WINDOWvia shared helper ||
loopx/control_plane/effect_runtime.py_start_runtimePopen | node (long-lived runtime host) |CREATE_NO_WINDOWvia shared helper ||
loopx/usage_ping.pycontrol()| node |CREATE_NO_WINDOWvia shared helper ||
loopx/usage_ping.py_detach()| node /loopx.usage_goal| Flags already correct (DETACHED_PROCESS \| CREATE_NEW_PROCESS_GROUP, no console); the stdin write/close is now tolerant of the child-closed pipe (the 0x800700E8 race) |Cross-check additions in the same goal-start/turn/quota flow on current main:
| Site | Child | Change |
| --- | --- | --- |
|
loopx/registry.pyrun_git(todo/status readback probes) | git |CREATE_NEW_PROCESS_GROUP \| CREATE_NO_WINDOW(group flag kept for tree termination) ||
loopx/control_plane/agents/workspace_guard.py(2 git probes, agent registration) | git |CREATE_NO_WINDOW||
loopx/control_plane/todos/completion_validation.py_git_workspace_is_clean| git |CREATE_NO_WINDOW||
loopx/control_plane/goals/planning_batch.pyCliPlanningBatchBackend._call| loopx CLI |CREATE_NO_WINDOW||
loopx/control_plane/status/goal_source.py_run| declared source command / ssh |CREATE_NO_WINDOW||
loopx/control_plane/runtime/validation_command.py_direct_validation| caller-declared validator |CREATE_NO_WINDOW(the supervised POSIX flock path is POSIX-only by design and untouched) ||
loopx/control_plane/quota/scheduler_ack.py_run_native_followup| node (heartbeat follow-up) |CREATE_NO_WINDOW||
loopx/entrypoint.pyWindows native follow-up re-exec | node |CREATE_NO_WINDOW(Windows-only branch) ||
loopx/control_plane/heartbeat/installed_prompt_update.pyprompt sync | loopx CLI |CREATE_NO_WINDOW||
loopx/control_plane/turn_driver/host_process_transport.pybridge Popen | node |CREATE_NO_WINDOW||
loopx/control_plane/turn_driver/codex_stdio.pyStdioNativeGoalTransport.spawn| host process |CREATE_NO_WINDOW||
loopx/control_plane/turn_driver/command_validation.pyturn validator | validator command |CREATE_NO_WINDOW||
loopx/control_plane/turn_driver/codex_execution_preparation.py_default_runner| launcher |CREATE_NO_WINDOW||
loopx/control_plane/state_recovery_io.py_audit_owners| node recovery worker |CREATE_NO_WINDOW|TypeScript hosts that spawn console children and were missing the existing
windowsHideprecedent (host_process.ts,zcode_goal_mode/*,effect_runtime_snapshot.tsalready had it):| Site | Child | Change |
| --- | --- | --- |
|
loopx/pi_goal_mode/loopx-goal.ts(2execFilesites) | loopx CLI |windowsHide: true||
loopx/control_plane/coordination/shadow_drain_files.ts| python shadow-lock host |windowsHide: true||
loopx/control_plane/capabilities/explore_research_terminal.ts| python snapshot host |windowsHide: true||
loopx/control_plane/coordination/nokv_jsonl_transport.tsdefault factory | NoKV helper |windowsHide: true|Implementation
no_console_creationflags()inloopx/extensions/process_runtime.py: returnssubprocess.CREATE_NO_WINDOWonly on Windows and only when the parent has no console, which is the one case in which Windows allocates a new console for a child. It returns0(subprocess's default) for an attached parent, on every other platform, and when the console query cannot be answered. A child of an attached parent inherits its console and opens no window, so every site keeps exactly its previous behavior there; passing the flag to an attached parent would instead detach the child from the console its output is read on. Non-Windows behavior is byte-for-byte unchanged.GetConsoleCP()orGetConsoleWindow()succeeds (a console-less process fails both). Any success counting as attached is the safe direction — the only cost of a wrong "attached" is an unsuppressed window, never a lost receipt._PROCESS_RUNTIME_EXPORTSlazy reexport invalidation_command.py) so the repo's cold-import contracts (tests/test_process_runtime_loading.py:loopx.contract,loopx.doctor_git,validation_command,host_bridge_transportmust not load the process transport at import) keep holding._detach()keepsDETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP(the observer is deliberately console-free) with fully redirected stdio (PIPE/DEVNULL/DEVNULL); the fix makes the parent's write-and-close non-fatal when the child wins the race, matching the documented best-effort telemetry contract. This one change is not Windows-only: on POSIX the same early child exit previously surfaced asBrokenPipeErrorfrom the write-and-close; it now returns normally (verified with real child processes on macOS: normal reads pass before and after; an early-closing child raised on the previous behavior and returns cleanly now).DETACHED_PROCESSandCREATE_NO_WINDOWare mutually exclusive creation flags; no site combines them.Windows-only default-behavior disclosure
The console-suppression change is Windows-only, and on Windows it is confined to a console-less parent (apart from the
_detach()write-and-close behavior above, which applies everywhere): children spawned by the listed sites no longer allocate a console host window there, and the detached observer's early-exit race no longer surfaces as an error. A parent attached to a console (a user runningloopxin PowerShell or cmd) and all other platforms passcreationflags=0/ omit the option, which is identical to the previous behavior.Windows verification status: the reviewer ran the previous head on a real Windows 10 host and measured that the suppression works (the child gets no console) and that the flag, applied unconditionally, silently removed the foreground receipt of the one site that does not redirect its streams (
loopx/entrypoint.py:155). That finding is what the attached-parent rule above fixes. The fix itself has not been run on Windows — I have no Windows host. It rests on the reviewer's two measured cells (attached without the flag keeps the receipt; console-less with the flag opens no window); a two-line check for both branches is in the review reply. The visible window and pipe behavior is otherwise owned by CI's Windows lanes; the host-agnostic tests below prove the flags are computed and passed on the spawn-option objects.Out of scope (follow-up candidates using the same helper)
Dev/CI tooling (
loopx/canary/,loopx/control_plane/testing/,benchmark_toolkit,experiments), capability adapters wrapping interactive external CLIs, MCP/collaboration daemon spawns (operation_wake,collaboration_mcp,remote_authority_gateway,delegation_preview_transport), SSH lifecycle transports, self-update/installer flows (already detached where relevant), andstdio_transport.py(POSIX-only by design).Test evidence (all on macOS)
tests/test_child_console_suppression.py(30 tests): each site's spawn options (creationflags equals the helper value on POSIX; equalsCREATE_NO_WINDOWunder an emulated Windowsos.nameon a console-less parent, via a module-scoped proxy that also answers the console query), the registry's composedCREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW, the detached observer's Windows flags, and the pipe-closed write race staying non-fatal. Added for the attached-parent rule: the helper across three hosts (POSIX → 0, Windows console-less →CREATE_NO_WINDOW, Windows attached → 0); the_console_attachedtruth table (both queries failing → not attached, either succeeding → attached); the reported site with an attached parent passingcreationflags == 0and redirecting nothing, and with a console-less parent passing the flag; a redirected receipt on a console-less host still arriving throughcapture_output=True.tests/extensions/test_process_runtime.py: helper computation (0 off Windows,0x08000000emulated on a console-less parent, 0 without the constant, 0 on an attached parent, 0 and no exception when the console query is unanswerable).npm run typecheck:control-planeclean; node test suites for the touched TS modules (nokv transport, shadow drain, explore research execution): 421 passed.loopx/pi_goal_mode/loopx-goal.tsis outside the repo's tsconfig (host-provided dependencies); a direct tsc comparison shows the identical pre-existing error set before/after, i.e. no new type errors.ruff checkon all touched files: clean.811c1a1f6(74a33c350; all six files touched by both sides merged cleanly): the two test files above 95 passed / 1 skipped; the 51 test files of every touched module 1355 passed / 0 failed / 8 skipped (twotest_effect_runtime_equivalence.pycases first failed only because this worktree's localorigin/mainref was eight days stale — they loadorigin/main:…effect_runtime.pyas their baseline and pass 10/10 once the ref is refreshed;_uses_stdio_runtimecomes from main's #9140, not from this PR).uv run --extra test loopx canary premerge --from-git-diff --git-diff-base 811c1a1f6: 18 checks passed, 0 failures.tests/control_plane/test_native_user_completion_update.py(12 parametrizations, HTTP 404s) fail identically on pristinemainat the merge base (verified in a throwaway worktree).