[Windows Desktop] Antivirus scanning of bundled rg.exe may amplify multi-session app-server CPU and tool-result stalls
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of the Codex App are you using (From “About Codex” dialog)?
26.825.6671.0 (from the installed Microsoft Store package path)
Related local components:
codex-cli 0.151.0- bundled
ripgrep 15.2.0 - the bundled
rg.exehas a valid OpenAI Authenticode signature
What subscription do you have?
ChatGPT subscription (exact tier omitted because this is a local Windows performance issue)
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
16 logical processors
What issue are you seeing?
When several local Codex Desktop tasks are active, the bundled codex.exe app-server can consume several CPU cores and make the desktop/tool channel feel stalled. Antivirus real-time scanning of Codex helper executables, especially the bundled rg.exe, appears to amplify the contention.
This report separates three different effects that can otherwise be conflated:
- CPU used by the Codex app-server itself;
- CPU used by productive unrelated child workloads;
- wall-clock delay after a child command has already finished, likely in app-server scheduling or IPC.
During one real incident with three active local Codex tasks, CPU-delta sampling showed:
10-second window:
codex.exe app-server: 28.7% of the whole 16-thread machine
20-second window:
codex.exe app-server: 23.3%
unrelated productive Python workload: 6.3%
ChatGPT.exe renderer: 0.3%
The hottest app-server threads used approximately 98.9%, 97.3%, 73.9%, 58.2%, and 31.7% of one logical core during the same 20-second window. This was multi-core backend activity, not a single renderer thread and not solely the unrelated Python workload.
The antivirus UI showed Codex-related executables being intercepted/scanned. The bundled search helper was located under a version/hash-specific path equivalent to:
%LOCALAPPDATA%\OpenAI\Codex\bin\<hash>\rg.exe
After temporarily disabling Microsoft Defender real-time protection and allowlisting several exact Codex helper executables in Huorong, a later observation with three active Codex tasks showed:
20 seconds, two consecutive 10-second samples:
total observed process CPU: 2.9% -> 8.0%
codex.exe app-server: 1.7% -> 4.0%
ChatGPT.exe renderer: 0.0% -> 0.1%
Huorong processes: approximately 0%
A narrow rg query over a 101,558-byte text file completed internally in 40.1 ms.
However, antivirus scanning is not a complete explanation. In an earlier measurement with Defender real-time protection off, the same class of narrow rg query completed internally in 49.9 ms while the Codex tool result did not return to the task for roughly 42 seconds. That suggests a separate app-server scheduling/IPC delay can remain after rg.exe itself has exited.
Important limitation: this was a real incident, not a clean laboratory A/B test. Two antivirus-related settings changed, and the active task count was the same but the exact task workload was not identical. The evidence supports “antivirus scanning can be an amplifier,” not “antivirus is the sole root cause.”
What steps can reproduce the bug?
The issue is intermittent, but the observed pattern was:
- Run Codex Desktop on Windows with multiple local tasks active in one or more repositories.
- Let the tasks perform frequent file/history searches and shell tool calls.
- Sample per-PID CPU deltas rather than cumulative CPU time.
- Observe
codex.exe app-serverconsuming multiple logical cores whileChatGPT.exeremains comparatively low. - Check whether the local antivirus is repeatedly scanning the signed bundled
rg.exeor other short-lived Codex helper executables. - Separately measure the child command's own elapsed time and the time until its result appears in Codex. In the incident above, these differed by tens of seconds.
A minimal Windows CPU-delta sampler:
$seconds = 10
$logical = [Environment]::ProcessorCount
$before = @{}
Get-Process | ForEach-Object {
if ($null -ne $_.CPU) { $before[$_.Id] = [double]$_.CPU }
}
Start-Sleep -Seconds $seconds
Get-Process | ForEach-Object {
if ($before.ContainsKey($_.Id) -and $null -ne $_.CPU) {
$delta = [double]$_.CPU - $before[$_.Id]
if ($delta -gt 0.01) {
[pscustomobject]@{
PID = $_.Id
Name = $_.ProcessName
WholeMachineCpuPct = [math]::Round(100 * $delta / $seconds / $logical, 2)
WorkingSetMB = [math]::Round($_.WorkingSet64 / 1MB, 1)
Threads = $_.Threads.Count
}
}
}
} | Sort-Object WholeMachineCpuPct -Descending | Select-Object -First 20
I am not recommending that other users disable antivirus protection as a workaround. Exact exclusions also become brittle if helper binaries live under hash/version-specific directories.
What is the expected behavior?
- Multiple local tasks should have bounded aggregate CPU use for search and tool orchestration.
- Search concurrency should be capped and cancellation should promptly stop queued work.
- Codex diagnostics should expose child-process runtime separately from app-server queue/IPC time.
- The app should avoid unnecessary rapid process churn that causes repeated antivirus inspection.
- If antivirus interoperability is a known issue, provide a security-conscious diagnostic or stable signed-helper strategy rather than requiring broad folder/process exclusions.
Additional information
Potentially related, but not duplicates of this antivirus/IPC observation:
- #40251 — concurrent full-session
rgsearches saturate CPU on Linux - #24510 — active thread metadata/history-list processing keeps app-server hot
- #38583 — Windows desktop idle CPU and system-wide input lag
Raw session files and repository contents cannot be shared because they contain private work. Sanitized CPU samples, timestamps, executable hashes, or a short ETW/Defender performance recording can be provided if maintainers specify what would be most useful.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Windows codex.exe app-server and bundled rg.exe workflow, using the issue's PowerShell CPU-delta sampler while several local tasks run. Compare child-process runtime with the delay before tool results return, and check antivirus scanning during repeated helper launches. Done means the app-server, search concurrency, cancellation, and queue/IPC behavior have measurable bounded behavior, or diagnostics clearly separate these costs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, rust
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100