Skip to content

fix(windows): Engram Git subprocesses open transient terminal windows #599

Description

@MarsSall

Pre-flight Checks

Bug Description

Starting Pi causes several transient console or Windows Terminal windows to appear. The same behavior occurs when Pi launches subagents.

Process monitoring identified Git commands spawned by engram serve as the primary source. These subprocesses create conhost.exe, which can subsequently activate OpenConsole.exe or WindowsTerminal.exe.

Steps to Reproduce

  1. Install and enable gentle-engram in Pi on native Windows.
  2. Ensure no Engram daemon is currently running.
  3. Start a new Pi session.
  4. Observe several transient terminal windows.
  5. Launch a Pi subagent.
  6. Observe the windows appearing again.

Expected Behavior

Engram and its Git subprocesses should run silently in the background without creating or activating visible terminal windows.

Actual Behavior

Engram executes repository-discovery commands such as:

git rev-parse --show-toplevel
git remote get-url origin

The observed process chain was:

engram serve
└─ git.exe
   └─ conhost.exe
      └─ OpenConsole.exe / WindowsTerminal.exe

This caused multiple terminal windows to appear briefly during Pi startup and subagent creation.

Operating System

Windows

Engram Version

  • Engram binary: 1.19.0
  • gentle-engram Pi plugin: reproduced on 0.1.8 and still present on 0.1.10

Agent / Client

Other: Pi Coding Agent 0.80.6

The session runs on native Windows using Nushell inside WezTerm.

Relevant Logs

engram.exe
Command line: engram serve

git.exe
Parent: engram.exe
Command line:
git -C "<project>" rev-parse --show-toplevel

conhost.exe
Parent: git.exe
Command line:
\??\C:\WINDOWS\system32\conhost.exe 0x4

git.exe
Parent: engram.exe
Command line:
git -C "<project>" remote get-url origin

OpenConsole.exe
Command line:
WindowsTerminal\OpenConsole.exe -Embedding

Additional Context

Relationship to #536

#536 reports the same startup and subagent console-flash symptom and proposes a Windows-specific hidden launcher plus a cross-process startup lock. This issue adds process-monitor evidence that traces the visible windows to engram serve Git subprocesses and confirms that adding windowsHide: true to the existing detached spawn path eliminates the observed windows.

The minimal PR for this issue addresses process visibility only. If maintainers consider the startup race a separate concern, it can remain tracked in #536; otherwise, these issues can be consolidated.

Verified workaround

A local workaround was applied in:

gentle-engram/index.ts

The detached process configuration was changed to:

proc = spawn(command, [...args], {
  cwd,
  detached: true,
  stdio: "ignore",
  windowsHide: true,
});

The existing Engram daemon was then stopped and restarted so it inherited the corrected process configuration.

After applying the workaround:

  • no Engram-owned Git processes produced visible consoles;
  • no OpenConsole.exe or WindowsTerminal.exe processes appeared during startup;
  • the user confirmed that no windows appeared visually.

Pi also runs multiple package update checks through:

pnpm view <package> version --json

Those checks were observed using cmd.exe, but they did not produce visible windows during the final verification.

The workaround currently modifies node_modules directly and is therefore overwritten by package upgrades or reinstalls. The fix should be incorporated into gentle-engram itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions