diff --git a/agent/coding_context.py b/agent/coding_context.py index 78229bc4f5542..4f2e02779974e 100644 --- a/agent/coding_context.py +++ b/agent/coding_context.py @@ -653,6 +653,7 @@ def _git(cwd: Path, *args: str) -> str: capture_output=True, text=True, timeout=_GIT_TIMEOUT, + creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), ) except (OSError, subprocess.SubprocessError): return "" diff --git a/tools/checkpoint_manager.py b/tools/checkpoint_manager.py index 720973b67e0be..ffbe716e7d1e0 100644 --- a/tools/checkpoint_manager.py +++ b/tools/checkpoint_manager.py @@ -330,6 +330,7 @@ def _run_git( env=env, cwd=str(normalized_working_dir), stdin=subprocess.DEVNULL, + creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), ) ok = result.returncode == 0 stdout = result.stdout.strip() @@ -450,6 +451,7 @@ def _init_store(store: Path, working_dir: str) -> Optional[str]: capture_output=True, text=True, env=init_env, timeout=_GIT_TIMEOUT, stdin=subprocess.DEVNULL, + creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), ) if result.returncode != 0: return f"Shadow store init failed: {result.stderr.strip()}" diff --git a/tui_gateway/git_probe.py b/tui_gateway/git_probe.py index 01b7998ad1422..469db559394bf 100644 --- a/tui_gateway/git_probe.py +++ b/tui_gateway/git_probe.py @@ -26,12 +26,16 @@ import os import subprocess +import sys import threading import time from collections.abc import Iterable from concurrent.futures import ThreadPoolExecutor _GIT_TIMEOUT = 1.5 + +# Windows: suppress conhost.exe window flashes from git subprocess calls +_CREATE_NO_WINDOW = 0x08000000 if sys.platform == "win32" else 0 _WARM_WORKERS = 8 # How long a "not a git repo" answer stays cached before it's re-probed. Short @@ -53,6 +57,7 @@ def run_git(cwd: str, *args: str) -> str: timeout=_GIT_TIMEOUT, check=False, stdin=subprocess.DEVNULL, + creationflags=_CREATE_NO_WINDOW, ) return result.stdout.strip() if result.returncode == 0 else "" except Exception: diff --git a/tui_gateway/server.py b/tui_gateway/server.py index 21590a5158214..07102c493942a 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -289,6 +289,7 @@ def __init__(self, session_key: str, model: str): # slash_worker runs the Hermes agent → needs provider credentials. # Tier-1 secrets (gateway/GitHub/infra) are still stripped (#29157). env=hermes_subprocess_env(inherit_credentials=True), + creationflags=git_probe._CREATE_NO_WINDOW, ) threading.Thread(target=self._drain_stdout, daemon=True).start() threading.Thread(target=self._drain_stderr, daemon=True).start() @@ -9124,7 +9125,7 @@ def _(rid, params: dict) -> dict: str(pdf_path), str(out_prefix), ] try: - res = subprocess.run(argv, capture_output=True, text=True, timeout=120, stdin=subprocess.DEVNULL) + res = subprocess.run(argv, capture_output=True, text=True, timeout=120, stdin=subprocess.DEVNULL, creationflags=git_probe._CREATE_NO_WINDOW) except subprocess.TimeoutExpired: return _err(rid, 5028, "pdftoppm timed out (>120s)") if res.returncode != 0: @@ -11155,6 +11156,7 @@ def _(rid, params: dict) -> dict: # needs provider credentials. Tier-1 secrets still stripped (#29157). env=hermes_subprocess_env(inherit_credentials=True), stdin=subprocess.DEVNULL, + creationflags=git_probe._CREATE_NO_WINDOW, ) parts = [r.stdout or "", r.stderr or ""] out = "\n".join(p for p in parts if p).strip() or "(no output)" @@ -11216,6 +11218,7 @@ def _(rid, params: dict) -> dict: text=True, timeout=30, stdin=subprocess.DEVNULL, + creationflags=git_probe._CREATE_NO_WINDOW, ) output = ( (r.stdout or "") @@ -11675,6 +11678,7 @@ def _list_repo_files(root: str) -> list[str]: timeout=2.0, check=False, stdin=subprocess.DEVNULL, + creationflags=git_probe._CREATE_NO_WINDOW, ) if top_result.returncode == 0: top = top_result.stdout.decode("utf-8", "replace").strip() @@ -11693,6 +11697,7 @@ def _list_repo_files(root: str) -> list[str]: timeout=2.0, check=False, stdin=subprocess.DEVNULL, + creationflags=git_probe._CREATE_NO_WINDOW, ) if list_result.returncode == 0: for p in list_result.stdout.decode("utf-8", "replace").split("\0"): @@ -13552,6 +13557,7 @@ def _(rid, params: dict) -> dict: r = subprocess.run( cmd, shell=True, capture_output=True, text=True, timeout=30, cwd=os.getcwd(), stdin=subprocess.DEVNULL, + creationflags=git_probe._CREATE_NO_WINDOW, ) return _ok( rid,