Repository navigation
Windows 10 app 26.616.4196.0 repeatedly spawns Git root/metadata probes while idle #29110
Description
What version of the Codex App are you using?
OpenAI.Codex_26.616.4196.0_x64__2p2nqsd0c76g0
What platform are you using?
Windows 10 x64
Git for Windows:
git version 2.54.0.windows.1
What issue are you seeing?
With a local Git workspace open in the Codex Windows app, git.exe repeatedly appears in Sysinternals Process Explorer even when I have not explicitly asked Codex to run a Git command.
One repeatedly observed command is:
"C:\Program Files\Git\bin\git.exe" -c core.hooksPath=NUL -c core.fsmonitor=false rev-parse --show-toplevel
Other Git metadata commands observed in the same app session include:
git.exe config --null --get core.fsmonitor
git.exe -c core.hooksPath=NUL -c core.fsmonitor=false remote -v
git.exe -c core.hooksPath=NUL -c core.fsmonitor=false status --porcelain
I can provide a Process Explorer screenshot if useful. core.fsmonitor=false appears intentional; the problem is the repeated process creation, not that configuration override.
Why this may be distinct from existing reports
This resembles existing Windows issues, but the visible loop here is centered on root discovery and metadata refresh rather than the older snapshot/index commands:
- Codex Windows App keeps spawning
git.exe status --porcelain=v1 -zand leaves orphangit.exe/conhost.exeprocesses #17229: repeatedstatus --porcelainand orphaned Git/conhost processes - Codex Windows App keeps spawning about 1000 git command per minute NON STOP #20567: very high Git process creation rate
- Windows desktop app triggers multiple git.exe add -A processes when opening a project/chat, causing severe CPU and disk usage #20933:
add -A/ Git snapshot work when opening a project - ~40s hang on startup (Windows) #23207: startup
git-originsworker fan-out, includingrev-parse --show-toplevel - Windows Codex app repeatedly spawns git.exe/conhost.exe in Git workspaces, possibly contributing to Nonpaged Pool growth #26812: excessive Git/conhost creation in Git workspaces
The source path documented in #23207 identifies rev-parse --show-toplevel as part of the desktop git-origins worker. Current app-server source also creates Git enrichment per turn, concurrently collecting HEAD, remotes, and working-tree status. The status path probes core.fsmonitor for each metadata collection:
- https://github.com/openai/codex/blob/main/codex-rs/core/src/turn_metadata.rs
- https://github.com/openai/codex/blob/main/codex-rs/git-utils/src/fsmonitor.rs
This suggests that a workspace/turn-metadata invalidation may be continuously retriggering one or both Git metadata paths. That is a hypothesis, not a confirmed root cause.
Steps to reproduce
- Start Codex Windows App 26.616.4196.0.
- Open or select a local Git repository workspace.
- Leave the project open without manually running Git commands.
- Open Sysinternals Process Explorer and filter for
git.exe. - Observe repeated short-lived
git.exeprocesses, includingrev-parse --show-toplevel.
Expected behavior
Repository root and metadata should be cached, debounced, or refreshed only after a relevant workspace/Git-state event. An idle Codex project should not continuously create Git processes.
Actual behavior
Git metadata probes continue to be spawned repeatedly while the project is idle.
Suggested diagnostics / fix direction
Please add structured logging or counters containing:
- refresh reason / invalidating event
- workspace path hash
- Git command category
- whether an identical metadata request is already in flight
Then ensure that git-origins and turn-metadata enrichment are debounced and deduplicated per workspace, with no repeated refresh without a relevant state change.
Activity
github-actions commentedon Jun 19, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
privacyguy123 commentedon Jun 19, 2026
Caused by orphaned/broken
.gitfolder being in.codexfolder.privacyguy123 commentedon Jun 29, 2026
Bug is back in new build downloaded today - the "fix" I said worked before isn't applicable anymore, there is no orphaned
.gitfolder in.codexanymore.zhanghaonj-prog commentedon Jul 13, 2026
I can reproduce this on a newer Codex Desktop build, and in my case the workspace did not contain an invalid or empty
.gitdirectory.Environment
OpenAI.Codex_26.707.3748.0_x64__2p2nqsd0c76g026200.8524C:\Program Files\Git\cmd\git.exeReproduction and measurements
With a task bound to a normal directory that was not inside any Git repository, the Codex Electron main process repeatedly launched:
Each invocation correctly failed with:
A process monitor captured 20 top-level Git processes launched directly by
ChatGPT.exein 7.1 seconds, equivalent to approximately 169.1 launches per minute. Retry intervals were generally between 0.2 and 2.3 seconds. The parent was the Electron main process, not a renderer, GPU, or network-service process.The loop may be temporarily absent immediately after restarting Codex, then reappear following a workspace refresh or file change. This suggests that the failed repository-root lookup is being retriggered by workspace/filesystem invalidation rather than running only as a fixed startup timer.
Controlled comparison
I ran
git initin the exact same working directory without staging or committing any existing files.After the directory became a valid repository:
rev-parse --show-toplevelcalls stopped immediately;ls-filesagainst a continuously updated log file.This strongly suggests that a negative result from repository-root discovery is not being cached/debounced, and is repeatedly invalidated for non-Git workspaces.
Performance impact
During the active loop, battery discharge reached approximately 36.71 W. WPR/WPA analysis also showed increased Microsoft Defender activity (
WdFilter.sys/MsMpEng.exe) associated with the repeated process and filesystem activity. The loop correlated with occasional UI/mouse stuttering.I captured a pre-workaround WPR
GeneralProfile + FileIOtrace (approximately 1.8 GB) and can provide it if there is a secure upload location or if a smaller targeted trace is preferred.Suggested fix: cache the negative non-repository result and only invalidate it when the workspace path, a relevant parent path, or
.gitstate actually changes. Repeated failures should also be deduplicated and use retry backoff.zhanghaonj-prog commentedon Jul 13, 2026
Additional diagnostic reference: I submitted this through the Codex Desktop in-app feedback flow with the relevant conversation logs included.
Shared session ID:
019f54cf-377e-7d42-b4d1-e7fd62b234d6This is the original session in which the high-frequency Git process creation, power impact, WPR trace, and before/after
git initcomparison were investigated.artemrizhov commentedon Jul 13, 2026
Same problem with ChatGPT Codex for Windows on directory without
.git.Version 26.707.62119
rwang23 commentedon Jul 14, 2026
I maintain an open-source, reversible Windows workaround for the visible Git/conhost window side of this problem:
https://github.com/rwang23/codex-windows-console-guard
It uses process-local Git/PowerShell/CMD wrappers and, for MSIX activation paths that bypass that local
PATH, a narrowly scoped native guard. The guard hides only aConsoleWindowClasswindow whose ancestry contains Git plus either currentChatGPT.exeor legacyCodex.exe.Safety boundaries are intentional: it does not replace the installed Git executable, change persistent user/system
PATH, touch the registry, or hide unrelated terminals.Important limitation: this reduces the visible-window impact only. It does not reduce the underlying
rev-parse/Git polling rate, prevent an orphaned Git process, or resolve the CPU/memory cost reported here. The upstream debounce, cancellation, and no-window process-launch fixes are still needed.The README is portable (no machine-specific clone path), includes install/rollback steps for users and agents, and documents the trade-offs of the optional PowerShell mitigations. I will keep the workaround updated as Windows desktop package behavior changes; package-version reports with redacted status output are welcome.
suiyuebaobao commentedon Jul 22, 2026
The repeated Git root and metadata probes while idle here are the same class of Git-backed refresh workload I reproduced.
I published a single-file Windows launcher for the original Microsoft Store/MSIX Codex app:
It starts Codex with a process-scoped
GIT_DIR=NUL. On my machine, the stable trace changed from 247 newgit.exeand 137 newtaskkill.exeprocesses per 10 seconds to 0 and 0 over 15 seconds; WMI Provider Host fell from about 6.6% to 0.9%.Usage: fully exit Codex from the Windows system tray, then run the script.
This is an unofficial workaround, not an upstream fix. It deliberately disables or limits Review, Changes, branch detection, commit, and other Git-backed Codex features. It does not patch Codex, modify repositories or Git configuration, write system environment variables, require elevation, terminate processes, or remove chat history. Launching Codex normally restores Git integration.
Evan-Haug commentedon Aug 31, 2026
Two things to add here, one on the orphan sub-problem and one on the loop itself. I have filed the root cause separately as #41783 rather than repasting it, but the short version matters for this thread: the leftover
git.exeprocesses several people mention are frozen beforemain()runs, insidedetect_msys_tty()in git-for-windowscompat/winansi.c, in aNtQueryObject(ObjectNameInformation)call on a stdio pipe handle that never returns and is not alertable. I confirmed it with a non-invasivecdbattach to six of them at 6.8 hours old; all six had the identical stack. Such a process cannot exit, cannot be timed out, and hasKernelModeTime,UserModeTime,ReadOperationCountandWriteOperationCountall exactly0forever.On the producer, which is directly relevant to the hypothesis in the issue body.
The three metadata commands listed here (
remote -v,status --porcelain, and theconfig --null --get core.fsmonitorprobe in front of the status path) are launched together byTurnMetadata::fetch_workspace_git_metadataincodex-rs/core/src/turn_metadata.rs:called from
spawn_git_enrichment_task. So theturn_metadata.rslead in the issue body is right for that half of the observed traffic; it is one concurrent fan-out per enrichment round, not three independent pollers. On my host the orphans arrived as two bursts spaced about 5 seconds apart, which is consistent with repeated enrichment rounds, though I would not read the exact per-burst composition as proof of anything.A cancellation path worth checking alongside the debounce fix.
cancel_git_enrichment_taskdoestask.abort(). That drops the in-flight futures, and with them theKillGitProcessTreeOnDropguard incodex-rs/git-utils/src/git_process.rs. That guard has animpl Droponly under#[cfg(unix)], where it callskill_process_group. On Windows there is noDropimpl, so cancellation relies on theJobObjecthandle drop plus tokio'skill_on_drop(true).That distinction matters here because of something I do not think has been stated in these threads: on a stock Git for Windows install
gitresolves to thecmd\git.exeshim, which spawnsmingw64\bin\git.exeas a child. The process that wedges is therefore a grandchild, andkill_on_dropreaps only the direct child. I captured the two-level chain live:To be fair to the code:
spawn_git_commanddoes job-contain on the success path, so I am not claiming this is broken outright. The gaps I would check are the uncontainedErr(_)fallback (job: None, no WindowsDrop, so onlykill_on_dropis left), whether the app-serverWorkspaceCommandexec path job-contains at all, and now thisabort()-driven cancellation path. Details in #41783.Why the rate in this issue makes it worse rather than being a separate concern. A wedge only needs to happen occasionally to accumulate. At the ~169 launches/minute measured upthread, occasional is guaranteed. Fixing the debounce would cut the exposure even if the containment gap is fixed separately, so I do not think this issue is superseded by mine.
One thing only you can answer, and I would find it genuinely useful. You are on
git 2.54.0.windows.1; I am on2.39.2.windows.1. I could not determine whether current Git for Windows still has this hang, and I found no upstream fix for it. Next time you have leftovergit.exeprocesses, could you check whether they show the zero-work signature?All four columns zero on a process more than a couple of minutes old is the wedge. If yours instead show non-zero reads, then your leftovers are a different failure from mine and 2.54 may already be safe, which is worth knowing before anyone recommends a Git upgrade as a workaround. If you want to confirm the stack directly,
cdb.exe -p <pid> -pv -c "~*k; q"attaches without killing the process.