Skip to content

Codex Desktop on Windows triggers kernel Token/Toke growth via repeated git.exe process creation #30926

Description

@antonnevm-cloud

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:

  • Token objects around 1.25M to 1.29M
  • Token handles only around 2.1K
  • Paged Pool around 6.9 GB
  • Nonpaged Pool around 2.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:38 to 2026-07-02T16:52:39
  • CodexProcesses=0 throughout
  • Token objects: 1,289,018 -> 1,288,882
  • Delta: -136 over 15 minutes

After reopening Codex Desktop:

  • Observation window: 60 seconds
  • CodexProcesses=9
  • Token objects: 1,289,270 -> 1,289,550
  • Delta: +280 in 60 seconds

ETW/WPR evidence

Two local WPR pool traces were captured and analyzed with TraceEvent.

First trace:

  • Events read: 126,078,389
  • Toke allocations: 42,299
  • Toke frees: 41,848
  • Net Toke count: 451
  • Net Toke bytes: 812,544
  • Largest outstanding Toke stack: first process Codex.exe, Count=420, Bytes=752,448

Second mostly-idle trace:

  • Events read: 131,809,943
  • Toke allocations: 36,605
  • Toke frees: 36,415
  • Net Toke count: 190
  • Net Toke bytes: 355,200
  • Largest outstanding Toke stack: first process Codex.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, PID 18932
  • Child: git.exe
  • Count: 263 starts in approximately 54.6 seconds

Command-line grouping:

  • 225 starts:
"C:\Program Files\Git\cmd\git.exe" -c core.hooksPath=NUL -c core.fsmonitor= rev-parse --show-toplevel
  • 38 starts:
"C:\Program Files\Git\cmd\git.exe" config --null --get core.fsmonitor

Additional direct child starts from Codex.exe:

  • powershell.exe: 55 starts, mostly process inventory via Get-CimInstance Win32_Process

Local app inspection

Read-only inspection of the installed app.asar showed code paths using:

  • gitManager.getWorktreeRepository(...)
  • git rev-parse --show-toplevel
  • core.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

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:

The current local evidence adds ETW/WPR stack-level data and close/reopen token-object deltas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    appIssues related to the Codex desktop appbugSomething isn't workingperformancewindows-osIssues related to Codex on Windows systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions