Repository navigation
Description
Windows Codex Desktop triggers kernel Token/Toke object growth via repeated git.exe process creation
Summary
On Windows 11, Codex Desktop appears to trigger sustained growth of Windows kernel Token objects / pool tag Toke.
The local ETW evidence points to the Codex Desktop GUI process repeatedly launching git.exe for repository/root detection. Closing Codex stops the Token object growth; reopening Codex starts it again.
This does not look like a normal Codex.exe user-space memory leak. The missing RAM is mostly kernel/system memory: Paged Pool, Nonpaged Pool, Page Table, and very high kernel object counts.
Environment
- OS: Windows 11 Pro, build
28000 - RAM:
63.38 GB - Codex package:
OpenAI.Codex_26.623.11225.0_x64__2p2nqsd0c76g0 - Codex executable/product version observed locally:
149.0.7827.197 - Git path used by Codex:
C:\Program Files\Git\cmd\git.exe
High-level symptom
Task Manager/RAMMap showed high used RAM that was not attributable to normal user processes.
Local counters showed:
Tokenobjects around1.25Mto1.29MTokenhandles only around2.1KPaged Poolaround6.9 GBNonpaged Poolaround2.55 GB- User-mode Codex working set was much smaller than the missing RAM.
The Token objects vs Token handles mismatch suggests kernel-held references, not visible user handles.
Close/reopen confirmation
After closing Codex Desktop:
- Observation window:
2026-07-02T16:37:38to2026-07-02T16:52:39 CodexProcesses=0throughoutToken objects:1,289,018 -> 1,288,882- Delta:
-136over 15 minutes
After reopening Codex Desktop:
- Observation window: 60 seconds
CodexProcesses=9Token objects:1,289,270 -> 1,289,550- Delta:
+280in 60 seconds
ETW/WPR evidence
Two local WPR pool traces were captured and analyzed with TraceEvent.
First trace:
- Events read:
126,078,389 Tokeallocations:42,299Tokefrees:41,848- Net
Tokecount:451 - Net
Tokebytes:812,544 - Largest outstanding
Tokestack: first processCodex.exe,Count=420,Bytes=752,448
Second mostly-idle trace:
- Events read:
131,809,943 Tokeallocations:36,605Tokefrees:36,415- Net
Tokecount:190 - Net
Tokebytes:355,200 - Largest outstanding
Tokestack: first processCodex.exe,Count=272,Bytes=487,488
Symbolized kernel stack:
NtCreateUserProcess
PspAllocateProcess
PspInitializeProcessSecurity
SeSubProcessToken
SepDuplicateToken
ObCreateObjectEx
ObpAllocateObject
ExAllocatePoolWithTag
This is the Windows process creation / security token duplication path.
Process-start evidence
The second trace contained 1,264 process start events.
Largest direct parent group:
- Parent:
Codex.exe, PID18932 - Child:
git.exe - Count:
263starts in approximately54.6seconds
Command-line grouping:
225starts:
"C:\Program Files\Git\cmd\git.exe" -c core.hooksPath=NUL -c core.fsmonitor= rev-parse --show-toplevel
38starts:
"C:\Program Files\Git\cmd\git.exe" config --null --get core.fsmonitor
Additional direct child starts from Codex.exe:
powershell.exe:55starts, mostly process inventory viaGet-CimInstance Win32_Process
Local app inspection
Read-only inspection of the installed app.asar showed code paths using:
gitManager.getWorktreeRepository(...)git rev-parse --show-toplevelcore.fsmonitor
I did not find a user-facing setting in this build to disable the Git polling / review Git query behavior.
Expected behavior
Codex Desktop should not create hundreds of git.exe child processes per minute for stable workspace root detection, and should not cause unreclaimable Windows kernel Token/Toke object growth during long-running sessions.
Actual behavior
Codex Desktop repeatedly launches git.exe from the GUI process. On this system, that process churn correlates with Token/Toke growth in the Windows kernel. Closing Codex stops new growth; reopening Codex resumes growth.
Related public issues
- Codex Windows App keeps spawning
git.exe status --porcelain=v1 -zand leaves orphangit.exe/conhost.exeprocesses #17229 - Memory leak #29700
- Windows Codex app may leave large numbers of stale git.exe process/token objects #29729
- Codex Desktop memory leak / Windows kernel memory retention #30389
Privacy / attachments
I have local ETW traces and CSV summaries, but the raw ETL files are very large and may contain local paths/process details. I would prefer not to attach full logs or ETL files publicly. I can provide sanitized summaries or share raw traces privately if requested by OpenAI maintainers.
Additional issue-age context checked on 2026-07-02
Related Windows Git/process and memory-retention reports are not isolated:
- Windows app repeatedly spawns \git ls-files --others --exclude-standard -z
;ntfs.sysNtFCnonpaged pool grows continuously#16786 opened 2026-04-04, still open: repeated git.exe on Windows. - Codex Windows App keeps spawning
git.exe status --porcelain=v1 -zand leaves orphangit.exe/conhost.exeprocesses #17229 opened 2026-04-09, still open: Codex Windows App repeatedly starts git.exe. - Codex Windows App keeps spawning about 1000 git command per minute NON STOP #20567 opened 2026-05-01, still open: git.exe/conhost.exe remain after app close.
- Memory leak #29700 opened 2026-06-23, still open: memory leak / kernel memory symptoms.
- Windows Codex app may leave large numbers of stale git.exe process/token objects #29729 opened 2026-06-23, closed as duplicate: stale git.exe process/token objects.
- Codex Desktop memory leak / Windows kernel memory retention #30389 opened 2026-06-28, closed as completed: Windows kernel memory retention.
The current local evidence adds ETW/WPR stack-level data and close/reopen token-object deltas.
Activity
github-actions commentedon Jul 2, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
antonnevm-cloud commentedon Jul 2, 2026
Post-reboot update: I found a much more specific local trigger.
After a fresh Windows reboot, the active Codex workspace contained an empty
.gitdirectory. It was not a valid Git repository:Even though this
.gitwas invalid,Codex.exerepeatedly launched:10-minute measurement before removing the empty
.gittrigger:9,937 -> 24,321+14,384, about+1,424/min0.763 GB -> 0.823 GB0.642 GB -> 0.659 GBgit.exeprocesses were present and parented byCodex.exeI then renamed the empty
.gitdirectory out of the workspace path, without deleting it.10-minute measurement after removing the empty
.gittrigger:26,734 -> 27,112+378, about+37.7/min1,597 -> 1,597git.exeprocesses:0 -> 0So the strongest minimal repro candidate is:
.gitdirectory, not a valid Git repo.git.exe rev-parse --show-toplevelcalls fromCodex.exe..gitdirectory and observe that repeatedgit.execalls stop and Token growth drops sharply.This points specifically to invalid/empty
.githandling causing a repeated Git probing loop, rather than normal Git repo activity.antonnevm-cloud commentedon Jul 2, 2026
Follow-up valid Git repo test:
I tested whether the same
git.exechurn reproduces with a valid Git repository and clean status. It did not reproduce the massive loop seen with an empty/invalid.git.Setup:
.gitcreated withgit init.git rev-parse --show-toplevelsucceeded.git rev-parse --is-inside-work-treereturnedtrue.git status --porcelain=v1 -zwas empty before and after the measurement..git/info/excludeso the repo status stayed clean.10-minute measurement:
27,333 -> 28,404+1,071, about+106.7/min1,660 -> 1,656git.exeprocesses:0 -> 0git.exeprocess count:2git.exe > 0:1 / 1211.130 GB -> 1.171 GB0.970 GB -> 0.997 GBComparison:
.git:+14,384Token objects in 606 seconds, about+1,424/min, repeatedgit.exe rev-parse --show-toplevel.+1,071Token objects in 602 seconds, about+106.7/min,git.exeobserved in only one sampled interval.Limitations:
Conclusion: the rapid
git.exeprobing loop appears specific to empty/invalid.githandling. A valid Git repository with clean status did not reproduce the same churn in this test.antonnevm-cloud commentedon Jul 2, 2026
Additional minimal workspace repro requested through OpenAI Support case
10865001.Git version/source
git --version:git version 2.54.0.windows.1C:\Program Files\Git\cmd\git.exeObserved repeated commands:
Minimal projectless Codex workspace repro
I attempted to pre-create an empty folder with an empty
.gitand open that exact folder through a Codex projectless thread. The available thread API created a fresh workspace with a-2suffix instead, so I could not force the exact pre-existing-folder-open sequence through that API.I then tested in that brand-new projectless Codex workspace by creating an empty
.gitwhile the workspace was open in Codex. The workspace was otherwise empty except for Codex'soutputsdirectory.Setup:
.gitentry count:0git rev-parse --show-toplevel:fatal: not a git repository, exit code128Phase A, empty
.gitpresent while Codex was open:2026-07-02 20:09:12to2026-07-02 20:19:53local time,641seconds27130,592 -> 46,559+15,967, about+1,494.57/min1,684 -> 1,685git.exeprocesses:2 -> 2git.exeprocess count:4git.exe > 0:244 / 271,90.04%1.540 GB -> 1.685 GB, delta+0.145 GB1.414 GB -> 1.461 GB, delta+0.047 GBRemove
.gitwhile Codex remains openI renamed/removed
.gitfrom the workspace path while Codex was still open and did not restart Codex before the next measurement.Phase B, after renaming/removing the empty
.git, no Codex restart:2026-07-02 20:21:16to2026-07-02 20:31:56local time,640seconds12147,660 -> 47,561-99, about-9.28/min1,696 -> 1,683git.exeprocesses:0 -> 0git.exeprocess count:0git.exe > 0:01.743 GB -> 1.770 GB, delta+0.027 GB1.492 GB -> 1.496 GB, delta+0.004 GBConclusion: the empty/invalid
.gittrigger reproduces strongly in a minimal projectless Codex workspace. Removing/renaming the empty.gitwhile Codex remains open stops thegit.exeloop and Token object growth without requiring a Codex restart. This lines up with the earlier valid-repo test: a valid clean Git repo did not reproduce the massivegit.exeloop.janijokinen commentedon Jul 13, 2026
I am seeing what appears to be the same issue on Windows 11.
In-app Codex feedback session ID:
019ee25c-ca99-7c93-b434-1997d09c7386
Environment:
Observed behavior:
Controlled observations:
Example measurement with Codex active and OneDrive closed:
Example measurement after stopping Codex / ChatGPT / OneDrive:
This looks consistent with the issue described here: Codex appears to trigger Windows kernel memory / pool growth. In my case OneDrive and endpoint protection may amplify the issue, but Codex appears to be the repeatable trigger.
RonnieBalle commentedon Jul 16, 2026
Independent reproduction on two Windows PCs (desktop app and native PowerShell CLI)
I independently reproduced the same progressive whole-system slowdown on two different, high-end Windows computers. This is not ordinary CPU or RAM exhaustion: after Codex has run long goals for hours to days, mouse/keyboard input, window dragging, video playback, and Windows generally become increasingly stuttery. Closing task/UI windows does not restore responsiveness; a Windows Restart restores it immediately for another few hours.
Environment for the measured reproduction
OpenAI.Codex_26.707.9981.00.144.20.144.4[windows] sandbox = "elevated"Live measurements while Windows was severely degraded
The machine still had about 139 GB available RAM. Total CPU was only about 18–22%, with no meaningful processor queue, paging, disk, GPU, DPC, or thermal pressure.
Instead, the abnormal state was:
lsass.exehad roughly 82,000–90,000 handles and often consumed close to one logical CPU core.82,584 -> 82,669in 30 seconds (+85)82,847 -> 83,002in about 57 seconds (+155)dwm.exewas consuming roughly 1.2–1.6 CPU cores, matching the visible whole-desktop/window-dragging stutter despite low GPU activity.git.exeprocesses. At least one observedgit.exewas directly parented by the desktop host process.After one of the two goals entered the paused state, Git concurrency fell to approximately 4–6 processes, and one LSASS sample changed from
89,971 -> 89,949over 30 seconds. This suggests pausing/stopping the workload reduces new churn, but the accumulated Windows state does not materially recover.Native Windows sandbox churn
A read-only count of one day's Codex Windows sandbox log showed approximately:
setup refresh: spawningentriesThe log shows
codex-windows-sandbox-setup.exebeing spawned and ACL setup being applied for nearly every shell command. This is consistent with the process/security-token churn described in this issue.Other observations
config.toml, but temporarily disabling Defender as a diagnostic test had zero visible effect on the system lag. This makes Defender an unlikely primary cause in this reproduction.Interpretation / request
This independently supports the mechanism in this issue: high-frequency Codex Git and native Windows sandbox process creation appears to cause sustained security-token/kernel-object retention, eventually overloading LSASS/DWM and degrading the entire desktop. It also overlaps with the kernel-pool evidence in #31212.
Please investigate:
git.exeprocesses.Related reports: #31212, #17229, #16374, #28855, #16786 and discussion #14758.
Raw session databases, source paths, repositories, and unredacted logs are intentionally not attached publicly. Sanitized samples or private diagnostics can be provided to OpenAI maintainers if requested.
RonnieBalle commentedon Jul 17, 2026
Controlled post-restart A/B: leak resumes after goals restart with invalid
.gittrigger removedFollowing the earlier report, I ran this controlled sequence on native Windows:
.gitdirectories implicated by the minimal reproduction, and verified that neither original.gitpath existed.A 46-second active measurement after resuming showed:
git.exe: 15-24 throughout the interval.gitpaths remained absentDuring the corresponding roughly two-minute sandbox-log interval, I counted:
setup refresh: spawningeventsInterpretation: an empty/invalid
.gitdirectory appears to be a real amplifier/minimal trigger, but it is not the root cause in this reproduction. Resuming native-Windows goals restored LSASS handle growth plus sustained Git and sandbox setup/ACL churn after that trigger was removed. This points toward a broader repeated process-creation / Windows sandbox setup / ACL or security-token cleanup problem.No raw logs, private paths, repository source, or session content are attached.
RonnieBalle commentedon Jul 17, 2026
One-hour unattended measurement: sustained LSASS handle growth
I followed the short measurement with an uninterrupted one-hour test. The computer was left untouched, with only the same two native-Windows Codex goals running as active workloads.
To minimize observer effect, one persistent read-only PowerShell process sampled LSASS once per minute. No repeated Codex diagnostic commands were issued during the interval.
Measurement period: July 17, 2026, 11:59:50–12:59:50 CEST
Duration: 60.0153 minutes
Samples: 61
Results:
The regression slope closely matches the end-to-end average, demonstrating sustained growth rather than the result being caused by a single spike.
The previous 46-second measurement showed approximately +163 handles/minute during a burst of activity. This longer unattended measurement indicates that approximately +40 handles/minute is a more representative sustained rate under these two goals.
For additional context, the clean post-restart LSASS count was approximately 1,986 handles. It has now reached 5,145, an increase of 3,159 handles. If the measured hourly rate remained constant, reaching approximately 100,000 handles from the current state would take roughly 39 hours. This is an extrapolation, not a prediction, because workload intensity and cleanup activity vary.
No raw logs, private paths, repository source, or session content are attached.
suiyuebaobao commentedon Jul 22, 2026
The repeated
git.execreation and downstream kernel object growth here closely match the process churn 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.
antonnevm-cloud commentedon Aug 3, 2026
Status request — 2026-08-03
This issue remains open and unassigned more than one month after the original report. OpenAI Support case lineage
10865001 → 11803343has also produced no substantive engineering response since the July 20 escalation.Since the original report, multiple independent Windows users have added corroborating evidence covering:
git.exeprocesses on newer Codex App builds;.gitamplifier;26.707.xapplication builds.Related issue #17229 also remains open with extensive independent reproductions. An unofficial
GIT_DIR=NULlauncher workaround has been posted, but it disables or limits normal Git-backed Codex functionality and is not an upstream resolution.Could an OpenAI maintainer please confirm:
git.exe status --porcelain=v1 -zand leaves orphangit.exe/conhost.exeprocesses #17229 and related Windows process-lifecycle/kernel-memory reports;Please do not close this as a duplicate without preserving the ETW/WPR evidence and the specific Token/Toke, LSASS, and invalid
.gitreproduction data already documented here.Sceleratis commentedon Aug 6, 2026
Well good news, OpenAI at least seems to be looking into it now:
#36176 (comment)
shugo5kurogochih-hub commentedon Aug 10, 2026
Independent reproduction: 15 GB paged pool dominated by
Toke/SeAt/SeTd/SeDtI observed the same Windows kernel paged-pool signature on a second machine. This capture was taken on 2026-07-14, so it predates later Codex process-management/Git-scan changes. It is useful as an independent baseline, not evidence that the newest build is still affected.
Environment
26200.8737codex.execodex-code-mode-host.execodex-command-runner-0.144.0-alpha.4.exeSystem symptom
Task Manager showed:
26.2 / 31.9 GB(82%)35.2 / 43.4 GB5.0 GB14.3 GB1.6 GBThe visible user-process working sets did not account for the missing memory.
During the incident, Task Manager also showed four simultaneous
git.exeentries, multipleconhost.exeentries, and the Codex processes listed above. I did not capture an ETW process-start trace, so this does not independently establish the parent/causal chain; it is a matching pool-signature observation.PoolMon capture
PoolMon header:
Top paged-pool tags:
TokeSeAtSeTdSeDtThe top four tags total approximately 12.19 GiB.
TokeandSeTdhad the exact same outstanding allocation count (5,313,672), which is consistent with linked token/security structures accumulating together.At the instant of this PoolMon snapshot,
Tokewas slightly decreasing over the refresh interval (Bytes -27,456), suggesting the capture primarily showed already accumulated retention rather than a live spike at that exact moment.Limits of this report
0.144.0-alpha.4was visible.Av*pool tags were only tens of MB and did not explain the 12+ GiB token/security allocation cluster.I retained the full PoolMon text and screenshots and can provide sanitized excerpts if useful.
bentoner commentedon Sep 8, 2026
I see what looks like the same leak on 26200.9106 (same allocation stack,
git.exe-heavy spawns from Git for Windows), and on my machine it traces to a Windows kernel bug rather than anything Codex does:win32kfull!CForegroundLaunch::_CheckAllowForegroundreferences the parent's primary token and never releases it, so each process that creates a process leaves aTokeobject behind. That is from kernel object reference tracing on one box; whether the reports here share the path I can't tell without the same trace, though the numbers look alike.What stopped it here: setting
ForegroundLockTimeoutto 0 (per-user, no elevation). The check only runs while the foreground lock is armed, so with 0 it never reaches the token; the cost is that any app can take the foreground. Write-up, a nine-minute repro and the script, if anyone wants to check their machine against it: https://github.com/bentoner/windows-token-leakfix(claude-ops): correct the Token-leak runbook's poolmon call and it…
railapex commentedon Oct 1, 2026
Independent confirmation of bentoner's diagnosis and workaround, on Windows 11 Pro 25H2 build 26200.9278, which is newer than the builds reported above.
The test: a hidden
cmdloop runscmd /d /c cmd /d /c exit500 times, so each iteration starts one process that itself starts a process. I counted Token objects (NtQueryObjecttype info, no elevation) before the loop and again after a 45 s settle. All runs were in the same boot, a few minutes apart:ForegroundLockTimeout200000 (default)ForegroundLockTimeout0The machine had 4.5M Token objects (about 12.6 GB of pool) after 16 days of uptime with several coding agents running.
The latest cumulative update does not fix it. On build 26200.9550 (
win32kfull.sys10.0.26100.9549), 2,000 creators left +719 tokens with the lock armed and +125 with the timeout at 0. After a later reboot on that build, with the workaround not reapplied, the machine reached 1.2M Token objects in 3.1 days.Why it looks constant during normal use: Windows 11 sets the live
ForegroundLockTimeoutto 2147483647 at every logon and ignores the registry value. OpenText documented this for ZENworks. This machine reads 2147483647 after every reboot while the registry holds 200000. At that value, any input arms the lock for 24.9 days, so the leak never switches off while someone is using the machine. bentoner's "something sets the live value after logon" is probably Windows itself.Three observations:
Workaround as bentoner describes: set
ForegroundLockTimeoutto 0 withSystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT). The call is refused while the lock is armed, and at 2147483647 it stays armed, so waiting 200 s doesn't help. Launching the script from Win+R works, because Explorer is the foreground process. It has to be redone after every logon.gunrgbcr commentedon Oct 4, 2026
Root cause and a workaround that survives restarts, in case it helps others here: the leak is a missing
PsDereferencePrimaryTokeninwin32kfull!CForegroundLaunch::_CheckAllowForeground(one token per process that creates a child, which is why git-heavy tools show it). It is skipped when the liveForegroundLockTimeoutis 0, but Windows overwrites that value with 2147483647 at every logon, so setting it in the registry does not stick. Setting the live value from a foreground terminal after each logon (e.g. from the PowerShell profile) stops it: 100,000 parent+child process pairs afterwards left +176 tokens. Details, disassembly and a check/fix script: https://github.com/gunrgbcr/windows-token-leak-logon-fixTechnicWhite commentedon Oct 13, 2026
Additional local observation (2026-10-13)
A Windows 11 Handler sampler recorded aggregate token and pool counters rising during route churn. In the sampler’s
toke_mbcolumn, readings were 935.6 MB at 2026-10-12 00:33:47, 2,180.3 MB at 2026-10-13 00:13:47, and 2,243.4 MB at 2026-10-13 04:31:43. At those same samples,nonpaged_mbwas 1,318.0, 1,945.7, and 2,095.9 MB. These aggregate counters do not identify the leaking component or establish causation.This is an aggregate observation only. No private paths, account identifiers, repository names, raw ETL, or credentials are attached. A bounded Windows Performance Recorder kernel-pool trace would be needed to identify the leaking process and stack; any trace shared publicly would be redacted first.
The behavior overlaps this issue's token/process-creation symptoms, but this observation does not by itself establish the exact leaking component. The useful next diagnostic would be a bounded WPR pool trace correlated with process-create/retire events.
Heighte commentedon Oct 25, 2026
Another Windows data point (2026-10-25): Windows 11 Home 25H2 build 26200.9711, OpenAI.Codex 26.1021.3705.0, 63.82 GiB RAM, about 11 days since boot, with heavy Codex desktop use. A pool-tag snapshot showed Toke at 2.50 GiB paged (SeAt 453 MiB; SeTd 170 MiB; SeDt 94 MiB paged / 29 MiB nonpaged; SeTl 151 MiB nonpaged). A one-minute sample earlier on this boot showed Toke +358 outstanding allocations / about +0.74 MiB. I have not captured process-start ETW or established a repeated git.exe probe loop on this machine, so I cannot attribute the growth to Git. I also observed two ChatGPT/Codex desktop crashes in the preceding two hours; Windows Application log had no matching 1000/1001/1002 events, and I have no Crashpad signature to correlate.