codex - 💡(How to fix) Fix macOS Desktop UI lag with excessive codex disk writes despite low system resource pressure [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#21007Fetched 2026-05-05 05:54:37
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1cross-referenced ×1subscribed ×1

Codex Desktop on macOS becomes noticeably sluggish even when the Mac itself is not under CPU or memory pressure. The lag affects basic UI interactions: scrolling, typing in the input box, and pasting images.

Local diagnostics suggest this is not caused by insufficient hardware resources. A macOS diagnostic report captured the Codex native process doing sustained disk writes: about 2.1 GB over ~648 seconds, with the heaviest sampled stack ending in pwrite.

This looks related to other Desktop performance reports, but I wanted to add concrete local diagnostic data because the symptom is severe enough to make input and scrolling feel blocked.

Root Cause

Local diagnostics suggest this is not caused by insufficient hardware resources. A macOS diagnostic report captured the Codex native process doing sustained disk writes: about 2.1 GB over ~648 seconds, with the heaviest sampled stack ending in pwrite.

Code Example

Command:          codex
Path:             /Applications/Codex.app/Contents/Resources/codex
Event:            disk writes
Writes:           2147.48 MB of file backed memory dirtied over 648 seconds
Average:          3315.48 KB/s
Limit:            24.86 KB/s over 86400 seconds
Heaviest stack:   ... pwrite

---

713M  ~/.codex/sessions
195M  ~/.codex/archived_sessions
176M  ~/.codex/logs_2.sqlite
15M   ~/.codex/state_5.sqlite
3.0M  ~/.codex/log/codex-tui.log

---

rows: 59106
estimated log bytes: 122.4 MB
TRACE: 34159 rows / 95.5 MB
INFO: 18537 rows / 21.9 MB
DEBUG: 6088 rows / 4.4 MB

---

codex_client::transport                  66.4 MB
codex_api::endpoint::responses_websocket 14.8 MB
codex_otel.log_only                      11.4 MB
codex_otel.trace_safe                     9.0 MB

---

failed to load discoverable tool suggestions: request failed with status 403 Forbidden
RAW_BUFFERClick to expand / collapse

Summary

Codex Desktop on macOS becomes noticeably sluggish even when the Mac itself is not under CPU or memory pressure. The lag affects basic UI interactions: scrolling, typing in the input box, and pasting images.

Local diagnostics suggest this is not caused by insufficient hardware resources. A macOS diagnostic report captured the Codex native process doing sustained disk writes: about 2.1 GB over ~648 seconds, with the heaviest sampled stack ending in pwrite.

This looks related to other Desktop performance reports, but I wanted to add concrete local diagnostic data because the symptom is severe enough to make input and scrolling feel blocked.

Environment

  • App: Codex Desktop for macOS
  • Codex app version: 26.429.30905
  • App build: 2345
  • Electron version shown in process args: 41.2.0
  • macOS: 26.3 (25D125)
  • Hardware: MacBook Pro Mac16,7, Apple M4 Pro, 48 GB RAM
  • Sensitive identifiers such as serial number, hardware UUID, and hostname omitted.

Symptoms

  • UI scrolling stutters or freezes briefly.
  • Typing in the prompt box lags.
  • Pasting images into the input box lags.
  • The issue is visible while overall system resources look healthy.

Local resource checks

At the time of investigation:

  • memory_pressure reported very low pressure, with free percentage around 91%.
  • vm_stat showed Swapins: 0 and Swapouts: 0.
  • Data volume had about 183 GiB free.
  • Load average was around 3 on a 14-core M4 Pro machine.
  • Codex processes were not consistently pegging CPU in ps snapshots.

Representative Codex process memory at one snapshot:

  • Codex Helper (Renderer): ~529 MB RSS
  • Codex main process: ~414 MB RSS
  • codex app-server --analytics-default-enabled: ~180 MB RSS

Strongest diagnostic evidence

macOS generated a diagnostic report for:

Command:          codex
Path:             /Applications/Codex.app/Contents/Resources/codex
Event:            disk writes
Writes:           2147.48 MB of file backed memory dirtied over 648 seconds
Average:          3315.48 KB/s
Limit:            24.86 KB/s over 86400 seconds
Heaviest stack:   ... pwrite

The stack was not symbolicated locally, but the sampled hot path repeatedly ended in pwrite, which matches the observed UI stalls better than CPU or memory pressure.

Local Codex state size

~/.codex was about 1.3 GB total:

713M  ~/.codex/sessions
195M  ~/.codex/archived_sessions
176M  ~/.codex/logs_2.sqlite
15M   ~/.codex/state_5.sqlite
3.0M  ~/.codex/log/codex-tui.log

The local SQLite log database contained:

rows: 59106
estimated log bytes: 122.4 MB
TRACE: 34159 rows / 95.5 MB
INFO: 18537 rows / 21.9 MB
DEBUG: 6088 rows / 4.4 MB

Largest log targets by estimated bytes included:

codex_client::transport                  66.4 MB
codex_api::endpoint::responses_websocket 14.8 MB
codex_otel.log_only                      11.4 MB
codex_otel.trace_safe                     9.0 MB

There were also repeated warnings like:

failed to load discoverable tool suggestions: request failed with status 403 Forbidden

In the local log file, these warnings included a very large Cloudflare/HTML challenge response body. That may be amplifying disk writes if retried or logged repeatedly.

Possible causes to investigate

  • Excessive TRACE/transport logging in Desktop sessions.
  • Large response bodies, especially 403/Cloudflare HTML pages, being logged without truncation.
  • Log database writes causing UI stalls or contention with the Desktop app-server.
  • Long session history / archived session replay making renderer or app-server work scale with total local state.
  • Similar interaction with MCP/browser/computer-use sessions, since this setup also had browser/computer-use related subprocesses running.

Related issues

This may overlap with:

  • #12709
  • #11984
  • #16158
  • #18467
  • #18333

I am opening a separate issue because the macOS diagnostic report provides a concrete disk writes event and local log database evidence.

Expected behavior

Typing, scrolling, and pasting images in Codex Desktop should remain responsive even after long sessions. Logging or local persistence should not generate multi-GB write bursts or block UI responsiveness.

Actual behavior

Codex Desktop becomes sluggish in basic UI interactions while macOS reports sustained disk writes from the Codex native process, despite the Mac having low memory pressure, no swap activity, and plenty of free disk space.

extent analysis

TL;DR

The most likely fix is to reduce excessive logging, particularly TRACE-level logs and large response bodies, to prevent disk writes from causing UI stalls in Codex Desktop.

Guidance

  • Investigate and adjust logging configurations to reduce the volume of logs, especially TRACE-level logs, which account for a significant portion of the log database size.
  • Consider implementing log truncation or filtering for large response bodies, such as the Cloudflare/HTML challenge response body, to prevent them from being logged repeatedly and causing disk writes.
  • Monitor the log database size and adjust the logging strategy accordingly to prevent it from growing too large and causing UI stalls.
  • Review the session history and archived session replay mechanisms to ensure they are not causing the renderer or app-server to work excessively, leading to UI stalls.

Example

No specific code snippet is provided, but an example of adjusting logging configurations could involve modifying the logging level or implementing a custom logging filter to reduce the volume of logs.

Notes

The issue may be related to other performance reports, and addressing the excessive logging and disk writes may not completely resolve the issue. Further investigation and monitoring may be necessary to identify and address other potential causes.

Recommendation

Apply a workaround by reducing excessive logging and implementing log truncation or filtering to prevent disk writes from causing UI stalls. This is a temporary solution until a more permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Typing, scrolling, and pasting images in Codex Desktop should remain responsive even after long sessions. Logging or local persistence should not generate multi-GB write bursts or block UI responsiveness.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING