Repository navigation
fix(spawn): hide Windows console windows on the remaining child launches - #679
Merged
jeff-r2026 merged 1 commit intoSep 20, 2026
Conversation
#672 lists three async spawn sites that still omit windowsHide, so a child of a process with no console of its own - an editor, or the hook dispatcher - is handed a fresh console window by Windows. #506 covered the two detached hook children and #559 the updater; these are the rest: src/utils/exec.ts execCommand, which also backs probeBinary src/utils/ai-client.ts the AI CLI, a .cmd shim on Windows src/utils/clone.ts runCommand, which starts git Option only: stdio, timeouts and error propagation are unchanged, and windowsHide is ignored on POSIX. CI has no Windows runner, so the spawn options are the only thing a test can pin. The three new guards assert exactly that, and each one fails when its option is removed. Fixes #672
CarlosWonMore
force-pushed
the
fix/windowshide-remaining-spawn-points
branch
from
September 20, 2026 14:24
50c7015 to
d0c9165
Compare
|
This was referenced Sep 20, 2026
7 tasks done
Walternater
pushed a commit
to Walternater/teamai-cli
that referenced
this pull request
Nov 2, 2026
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.
Summary
spawn()defaultswindowsHidetofalse, so a child of a process that has no console of its own — an editor, or the hook dispatcher — is handed a fresh console window by Windows. #506 fixed that for the two detached hook children and #559 for the updater; three asyncspawncall sites were still missing it:src/utils/exec.ts:29(execCommand)probeBinaryprobes<cli> --version(a.cmdshim on Windows), and the plugin lifecycle runs install / update / uninstall commandssrc/utils/ai-client.ts:121(callClaude)claude/codebuddy/ …), also a.cmdshimsrc/utils/clone.ts:92(runCommand)gitThis sets
windowsHide: trueon all three, matchingsrc/update.ts:141andsrc/hook-dispatch-cli.ts:103. No other behaviour change: same stdio configuration, same timeout handling, same error propagation. The option is ignored on POSIX.Type of Change
Test Plan
npx tsc --noEmitpassesnpx vitest run --coveragepassesCI runs only
ubuntu-latest/macos-latest, so a test cannot observe a Windows console — the spawn options are the only thing it can pin, and that is what the three guards assert:src/__tests__/exec.test.ts(new) —execCommandstill resolves stdout / stderr / exit code and still spawns withshell: false; plus thewindowsHideguard.src/__tests__/clone.test.ts(new) — drivesshallowCloneagainst a mockedgitand asserts every child it starts carries the flag.src/__tests__/ai-client.test.ts— the same guard for the CLI child incallClaude.The guards were verified to actually fail without the fix: stripping the three
windowsHide: truelines makes exactly those three tests fail (expected undefined to be true) while the other 19 in those files keep passing.Related Issues
Fixes #672
Notes for Reviewers
Two corrections to #672, found while sweeping the repo for this class.
windowsHideis also already set insrc/builtin-hooks.ts:172. The issue's table listed three files carrying it and missed this one, so "only three source files" was wrong even though the three gaps it named are real.src/post-pull.tsdoes not go throughexecCommandas the issue claims. It imports onlycaptureTail/detachChildfromutils/exec.tsand spawnsnode:child_processdirectly, and its header (lines 13–18) states that it deliberately inherits the already-hidden console of the pull process. It is therefore intentionally left alone here.One remaining site I did not touch — worth a second opinion.
src/openclaw-hooks.ts:87builds the OpenClaw-familyhandler.ts, and the handler it generates spawnsteamai hook-dispatchwithoutwindowsHide. Same class of gap, but it differs in two ways: it is a generated artefact written into the user's workspace, so the fix only reaches existing installs on the nexthooks inject/pull, and the file header notes the claw engines' console behaviour is still unconfirmed (WorkBuddy itself turned out to use the CodeBuddy engine). I left it out to keep this PR to the sites #672 named — say the word and I will send it as a follow-up.Deliberately not covered: the synchronous launches (
spawnSync/execFileSync— roughly twenty call sites across the providers,ci/,machine-id.ts,utils/cli-path.ts, …). They also defaultwindowsHidetofalse, so they are plausibly the same class, but #672 did not report them and I have not verified reachability for each, so this PR does not touch them.Docs: I did not add a usage-guide line. The one Windows-console sentence that exists (
docs/usage-guide.md:1561and itszh-CNtwin) sits in the auto-update section and is about the updater; these three launches belong to no single documented feature, so a sentence there would have been misplaced. Happy to add one elsewhere if you would rather have it written down.Why this keeps recurring: the CI matrix is
ubuntu-latest/macos-latestonly, so this whole family of defects is invisible to automation and can only be caught by review — which is why it keeps arriving a few call sites at a time. Awindows-latestjob running the unit suite would close that gap for good. Out of scope here, but I can draft it separately if it is welcome.