fix(windows): hide console window for git child processes#505
Closed
yushengruohui wants to merge 2 commits into
Closed
fix(windows): hide console window for git child processes#505yushengruohui wants to merge 2 commits into
yushengruohui wants to merge 2 commits into
Conversation
The codegraph daemon shells out to git via execFileSync without
windowsHide:true. Because the daemon is launched with detached:true
(no parent console), Windows allocates a fresh console window for
every git child. Each short-lived git invocation makes that window
flash on screen — very visible during auto-sync, where many file
writes can trigger several git calls per second.
This sets windowsHide:true on all 7 git call sites:
- src/extraction/index.ts: shared gitOpts (covers ls-files
--cached and -o), plus 3 inline opts for rev-parse,
check-ignore, and status --porcelain
- src/sync/worktree.ts: rev-parse --show-toplevel
- src/sync/git-hooks.ts: rev-parse --is-inside-work-tree,
rev-parse --git-path hooks
mcp/index.ts already passes windowsHide:true when spawning the
detached daemon — these git call sites were missed.
windowsHide:true is a no-op on macOS and Linux.
Fixes colbymchenry#485
Add windowsHide:true to the 4 execFileSync call sites in src/extraction/index.ts (1 shared gitOpts plus 3 inline option objects for rev-parse --show-toplevel, check-ignore -q, and status --porcelain --no-renames). Companion to the previous commit on this branch which covered the sync/ module. See colbymchenry#485 for context.
ZyphrZero
added a commit
to ZyphrZero/codegraph
that referenced
this pull request
May 28, 2026
…de-git-spawn fix(windows): hide console window for git child processes
ZyphrZero
added a commit
to ZyphrZero/codegraph
that referenced
this pull request
May 28, 2026
fix(windows): suppress console popup on child_process calls Resolves overlap with PR colbymchenry#505 (which already added windowsHide to the 7 git child-process call sites). Keeps PR colbymchenry#498's additional coverage: - WASM relaunch in extraction/wasm-runtime-flags.ts - npm install -g in installer/index.ts (preserving the fork's @changqiu/codegraph package name) - Antigravity codegraph-path resolution - mcp/engine.ts comment cleanup Verified: - tsc --noEmit clean - sync, git-hooks, installer-targets, wasm-runtime-flags tests: 160 passed, 0 failed
ZyphrZero
added a commit
to ZyphrZero/codegraph
that referenced
this pull request
May 28, 2026
Includes Windows console-popup fixes from PR colbymchenry#498 on top of the existing 0.9.6 fork (PR colbymchenry#415 drive-root path, PR colbymchenry#505 git windowsHide). Republished under @changqiu/codegraph.
colbymchenry
pushed a commit
that referenced
this pull request
May 28, 2026
On Windows, v0.9.5's detached shared daemon (#411) has no inherited console, so any console-subsystem child it spawns gets a fresh visible console window unless the spawn passes `windowsHide: true`. The fix adds the flag to all ten `spawnSync` / `execFileSync` / `execSync` call sites across extraction, sync, installer, and the WASM-flags relaunch. macOS/Linux ignore the option, so this is a no-op elsewhere. Fixes #485, #510, #530. Co-authored work: - #498 (csw-chen) — full sweep across extraction, sync, installer, and wasm-runtime. **This is the change being merged.** - #505 (yushengruohui) — independently identified and fixed the 7 git execFileSync sites. Superseded by #498's broader sweep; same diagnosis. - #521 (JirA44) — independently identified and fixed the WASM-runtime spawnSync re-exec. Superseded by #498's broader sweep; same diagnosis. Validated on Windows 11 ARM64 (Parallels): a detached parent's 15 git spawns produce 15 visible black flash-windows without the fix and 0 with it.
Owner
|
Thanks for the precise diagnosis and the careful per-call-site breakdown — your investigation matched the root cause exactly. Closing as superseded by #498, which lands the same Validated on Windows 11 ARM64 (Parallels): a detached parent's 15 git spawns produce 15 visible black flash-windows without the fix and 0 with it. Fixes #485, #510, #530. |
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.
Fixes #485.
Summary
On Windows, the daemon flashes a black
git.execonsole window on every auto-sync. The cause isexecFileSync('git', …)call sites in the daemon's code paths missingwindowsHide: true. This PR adds the option to all 7 sites; the change is a one-liner per call site and a no-op on macOS/Linux.Root cause
The daemon is launched with
detached: true(mcp/index.ts, the existingspawn(process.execPath, …)call), which deliberately leaves it without a parent console. On Windows, when a Console-subsystem child (git.exe) is started from a console-less parent, Windows allocates a fresh console window for it unlessCREATE_NO_WINDOWis set. Node mapswindowsHide: truetoCREATE_NO_WINDOW. Without it, every short-livedgitinvocation flashes its own window. The daemon launcher itself already passeswindowsHide: true— it's the git call sites that were missed.Call sites changed (7 total)
src/extraction/index.tscollectGitFilessharedgitOptsls-files -c --recurse-submodules,ls-files -o --exclude-standardsrc/extraction/index.tsgetGitVisibleFilesrev-parse --show-toplevelsrc/extraction/index.tsgetGitVisibleFilescheck-ignore -qsrc/extraction/index.tsgetGitChangedFilesstatus --porcelain --no-renamessrc/sync/worktree.tsgitWorktreeRootrev-parse --show-toplevelsrc/sync/git-hooks.tsisGitReporev-parse --is-inside-work-treesrc/sync/git-hooks.tsgitHooksDirrev-parse --git-path hooksThe fix is the same one-line addition (
windowsHide: true) on each options object.Verification
npm run build)..codegraph/daemon.pid, then trigger any CodeGraph CLI/MCP call so it respawns.git.execonsole window should no longer flash..codegraph/daemon.logstill shows the[CodeGraph MCP] Auto-synced N file(s) in <ms>mslines — i.e. the sync still runs, just hidden.windowsHideis ignored, behavior unchanged.Notes for reviewers
extraction/wasm-runtime-flags.tsusesspawnSync(process.execPath, …, { stdio: 'inherit' })— the relaunch shim spawns Node from a Node parent that already owns a console, so no new window is allocated and no change is needed.runGit(args, opts)helper that injectswindowsHide: trueso this can't regress.