Skip to content

Windows: codex exec spawns 16–22 redundant read-only git processes per turn (×3 processes each with Git for Windows) #54439

Open

Description

@mywondvision

What version of Codex CLI is running?

codex-cli 0.162.1 (npm, win32-x64)

What subscription do you have?

ChatGPT subscription (not plan-dependent)

Which model were you using?

gpt-6-luna (default; behaviour is model-independent — no tool calls involved)

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64 (Windows 11), Git for Windows on PATH as C:\Program Files\Git\cmd\git.exe

What terminal emulator and version are you using (if applicable)?

Non-interactive PowerShell 7 host (scripted codex exec)

Codex doctor report

not included

What issue are you seeing?

A single codex exec turn that makes no tool calls spawns 16–22 read-only git processes, mostly the same probes repeated. Traced with GIT_TRACE2_EVENT (set only for the codex process), in an ordinary repo with commits and an origin remote:

git command (all prefixed -c safe.bareRepository=explicit -c core.hooksPath=NUL -c core.fsmonitor=false) count per turn
rev-parse HEAD 5
rev-parse --git-dir 3
rev-parse --abbrev-ref HEAD 3
remote get-url origin 3
remote -v 2
config --null --get core.fsmonitor 1
status --porcelain 1

HEAD, branch and origin URL are queried 3–5 times each per turn, in waves at session start and turn start (and sometimes at turn end). In an empty repo (git init, no commits) it was 22 calls, most rev-parse failing with exit 128. A separate process monitor saw up to 27 git invocations in one turn.

On Windows each call goes through the Git for Windows launcher (cmd\git.exe → mingw64\bin\git.exe) and gets its own conhost.exe, so one turn creates ~50–80 short-lived processes (bursts of ~27 process starts within one second). No windows become visible, but it shows up as a process storm in monitoring tools and costs ~2 s of git time per turn.

Disabling worktrees, workspace_dependencies, memories and goals via -c features.<name>=false changed the count only marginally (18 → 16). There is no documented setting to turn these probes off.

What steps can reproduce the bug?

$env:GIT_TRACE2_EVENT = "$PWD\trace2.jsonl"
codex exec --sandbox read-only --cd <any git repo> "Reply only OK. Do not call tools."
# count git invocations and their argv
Get-Content trace2.jsonl | ConvertFrom-Json | Where-Object event -eq 'start' |
  Group-Object { ($_.argv | Select-Object -Skip 1) -join ' ' } | Sort-Object Count -Descending |
  Format-Table Count, Name -AutoSize

What is the expected behavior?

Git context (HEAD, branch, origin, dirty state) is collected once per turn, or cached per session with invalidation, so a no-tool turn costs a handful of git calls rather than ~20. Optionally, a config switch to disable git context collection.

Additional information

Possibly related, but not the same: #30635 (app-server loops on rev-parse --show-toplevel with an invalid .git), #33165 (VS Code extension repeatedly spawning rev-parse --show-toplevel in multi-repo workspaces). undo/ghost snapshots are already removed in 0.162.1 (codex features list), so they are not the source.

Activity

  1. added
    bug
    CLI
    windows-os
    exec
    on Oct 15, 2026
  2. removed
    exec
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugperformancewindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions