fix(win): hide the console window for background child processes - #116
Open
Aikiooo wants to merge 1 commit into
Open
fix(win): hide the console window for background child processes#116Aikiooo wants to merge 1 commit into
Aikiooo wants to merge 1 commit into
Conversation
On Windows, Node allocates a console window for a child process unless `windowsHide` is set. The window flashes on screen and can take focus away from whatever the user is doing — for the agent processes, which live for the whole session, on every start. `process-scanner.ts` already passed the option; the other background call sites did not. Set it on the ones whose output is captured, so the flag is consistent across the CLI. Left alone on purpose: - `daemon.ts` and `update-and-start.ts` when spawning with `stdio: "inherit"` — `pm2 startup` prints the `sudo` command the user has to read and re-run, so those windows must stay visible. - POSIX-only branches (`lsof`, `/bin/sh`, a login shell for `command -v`) and macOS `caffeinate`, where the option does nothing. - `terminal/index.ts` uses node-pty, which has no such option. `windowsHide` maps to CREATE_NO_WINDOW and is ignored off Windows.
Aikiooo
force-pushed
the
fix/windows-hide-agent-console
branch
from
September 10, 2026 15:32
21ee8df to
76adc26
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows, Node allocates a console window for a child process unless
windowsHideis set. That window flashes on screen and can take focus away from whatever the user is doing. For the agent processes, which live for the whole session, it happens on every start.process-scanner.tsalready passes the option. The other background call sites did not, so this sets it on the ones whose output is captured:agents/base.tsagents/codex-readonly.tsapp-server --stdiofilesystem/index.tsgit show HEAD:<path>for diffsnotify.tsports.tsnetstat,findstr,taskkill(the win32 branches)update-and-start.tsnpm list -g shellularupdate-runner.tsutils.tswhereincommandExistsLeft alone on purpose
stdio: "inherit"spawns indaemon.tsandupdate-and-start.ts.pm2 startupprints thesudocommand the user has to read and re-run, so those windows must stay visible. Hiding them would hide output the user needs.lsof,/bin/sh, and the login shell used forcommand -vÔÇö plus macOScaffeinate. The option does nothing there, so adding it would be noise.terminal/index.tsspawns through node-pty, which exposes no option for this on Windows. Worth knowing: node-pty's ownkill()forks a helper to enumerate the console process list withoutwindowsHide, so closing a terminal can flash a window regardless of this change. That one belongs upstream inmicrosoft/node-pty, not here.Risk
None off Windows:
windowsHidemaps toCREATE_NO_WINDOWand Node ignores it on other platforms. Every site changed here has its output captured, so nothing that a caller reads goes away.Tests
The
clipackage has no test setup, and this is a spawn-option change, so I did not add a test rather than introduce a framework here.tscandbiome checkare clean.Note
I cannot verify the window behaviour itself from this machine beyond the reasoning above; the option's semantics are documented, but I did not observe a console window with and without it.