Environment
- OS: Windows
- codegraph version: 0.9.6 (installed via
npm install -g @colbymchenry/codegraph)
- Trigger scenario: Running codegraph as MCP server (
codegraph serve --mcp) alongside AI coding assistant (OpenCode)
Description
When codegraph MCP server is running, every file save triggers a black console window to flash briefly. This is particularly disruptive during typing — the flashing window steals keyboard focus and interrupts input.
Steps to Reproduce
- Configure codegraph MCP server in project (
codegraph serve --mcp)
- Start the AI coding assistant (e.g. OpenCode)
- Edit and save any file
- Observe a black console window flashing momentarily
Investigation
1. Running processes
After codegraph serve --mcp, multiple related processes are visible:
ProcessId CommandLine
71136 "node" codegraph\npm-shim.js "serve" "--mcp"
31024 codegraph\node.exe (daemon)
83384 codegraph\node.exe (daemon)
38888 codegraph\node.exe (daemon)
2. --no-watch does not help
Added --no-watch to disable the file watcher:
"command": ["codegraph", "serve", "--mcp", "--no-watch"]
The black console windows still appear. This confirms the issue is not caused by the file watcher, but by the daemon process itself spawning child processes without windowsHide.
3. Uninstalling eliminates the issue
After uninstalling codegraph, removing MCP config, and killing related processes, the flashing stops completely — confirming the issue originates from codegraph.
Root Cause
The shared daemon mode introduced in v0.9.5 creates background daemon processes (codegraph\node.exe) for file watching and indexing. On Windows, Node.js child_process.spawn() defaults to creating a new console window for child processes (CREATE_NEW_CONSOLE) unless windowsHide: true is explicitly set.
The daemon spawns child processes for:
- Incremental indexing on file changes
- Tree-sitter parser invocations
- Other background maintenance tasks
These child processes exist briefly, causing the console window to flash.
Suggested Fix
Add windowsHide: true to all child_process.spawn() calls on Windows:
// Before
spawn(process, args, { /* missing windowsHide */ });
// After
spawn(process, args, {
windowsHide: true,
// ...other options
});
If using execa or another wrapper library, ensure windowsHide is enabled on Windows.
References
Environment
npm install -g @colbymchenry/codegraph)codegraph serve --mcp) alongside AI coding assistant (OpenCode)Description
When codegraph MCP server is running, every file save triggers a black console window to flash briefly. This is particularly disruptive during typing — the flashing window steals keyboard focus and interrupts input.
Steps to Reproduce
codegraph serve --mcp)Investigation
1. Running processes
After
codegraph serve --mcp, multiple related processes are visible:2.
--no-watchdoes not helpAdded
--no-watchto disable the file watcher:The black console windows still appear. This confirms the issue is not caused by the file watcher, but by the daemon process itself spawning child processes without
windowsHide.3. Uninstalling eliminates the issue
After uninstalling codegraph, removing MCP config, and killing related processes, the flashing stops completely — confirming the issue originates from codegraph.
Root Cause
The shared daemon mode introduced in v0.9.5 creates background daemon processes (
codegraph\node.exe) for file watching and indexing. On Windows, Node.jschild_process.spawn()defaults to creating a new console window for child processes (CREATE_NEW_CONSOLE) unlesswindowsHide: trueis explicitly set.The daemon spawns child processes for:
These child processes exist briefly, causing the console window to flash.
Suggested Fix
Add
windowsHide: trueto allchild_process.spawn()calls on Windows:If using
execaor another wrapper library, ensurewindowsHideis enabled on Windows.References
child_process.spawndocs: https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_optionswindowsHideoption: https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows