Skip to content

[Windows ARM64 / Desktop] Root-Cause Analysis & Verified Fixes for 6 Severe UI Freeze, CPU, and Memory Bottlenecks (26.1023.x) #58009

Open

Description

@Joyridr

Environment

  • Codex Desktop Version: OpenAI.Codex 26.1023.6123.0 / 26.1023.6621.0 (Windows Store MSIX)
  • Hardware: Surface Laptop 7 (Snapdragon X Elite X1E80100 12-core, Qualcomm Adreno X1-85 GPU, 64 GB RAM)
  • OS: Windows 11 ARM64 (26200)

Summary

While investigating severe UI freezes (5–11s main-thread stalls when switching threads, laggy scrolling, high background CPU/disk I/O, and multi-GB memory growth) on Windows 11 ARM64, I profiled the Electron renderer/main processes, codex.exe app-server, SQLite databases, and bundled runtime scripts.

I identified 6 distinct root causes and verified surgical fixes locally across 26.1023.6123.0 and 26.1023.6621.0. Since docs/contributing.md notes that external PRs are not accepted and asks for root-cause analyses in issues, here are the exact root causes and fixes for the Codex Desktop team:


1. @oai/artifact-tool host-daemon.mjs crashes every 5 seconds on Windows due to Unix 0o077n permission check (Related: #42669, #55194)

  • Root Cause: dependencies/node/node_modules/@oai/artifact-tool/dist/artifact-session/host-daemon.mjs validates the runtime directory and socket file permissions using (stat.mode & 0o077n) !== 0n (expecting Unix 0700/0600). On Windows NTFS, fs.stat() always returns 0o666 (rw-rw-rw-) for group/other bits. As a result, host-daemon.mjs throws "Artifact runtime directory has insecure permissions", deletes its state, exits, and is respawned every ~5 seconds indefinitely. Furthermore, it attempts to bind a filesystem .sock path instead of a Windows Named Pipe.
  • Verified Fix:
    1. Bypass the (n.mode & 0o077n) !== 0n check when process.platform === "win32".
    2. On win32, bind net.createServer to a Windows Named Pipe (\\.\pipe\codex-artifact-daemon-<hash>) instead of a filesystem .sock file, while writing the pipe endpoint metadata so the client can connect cleanly.

2. Forced WARP CPU Software Rasterization (--disable-gpu-compositing --use-angle=d3d11-warp-webgl) cripples Windows ARM64 / Adreno X1-85 (Related: #20413, #13749)

  • Root Cause: Launching ChatGPT.exe on Windows ARM64 passes --disable-gpu-compositing and --use-angle=d3d11-warp-webgl, forcing Microsoft WARP CPU software rendering across 4 CPU threads. On high-DPI multi-monitor setups, scrolling long code blocks or moving the window across monitors causes severe frame drops.
  • Verified Fix:
    • Enable hardware acceleration ("hardware_acceleration_mode": { "enabled": true } in Local State) and disable DWM window transparency (opaqueWindows = true in config.toml). This completely eliminates 120Hz sidebar ghosting while restoring full Direct3D11 hardware compositing on Adreno X1-85.

3. [primary-runtime-installer] repeatedly unpacks 1.2 GB (358 MB archive) due to Windows EPERM directory rename & stale runtime.json (Related: #40182)

  • Root Cause: When unpacking codex-primary-runtime into %USERPROFILE%\.cache\codex-runtimes\codex-primary-runtime\.staging-*, if any child process (node.exe / helper) holds an open handle in the target directory on Windows, the final atomic rename fails with EPERM. runtime.json remains stuck on the old bundleVersion (e.g., 26.909.12148), causing the installer to re-unpack 1.2 GB on every launch/hourly check.
  • Verified Fix:
    • Before final activation rename on Windows, terminate lingering processes holding handles inside codex-primary-runtime, use retry with exponential backoff on EPERM/EACCES, clean up orphaned .staging-* folders, and ensure runtime.json bundleVersion stays synchronized once the unpacked payload is valid.

4. thread_history_1.sqlite grows to 5.3+ GB, pre-hydrates all pinned threads on startup, and re-parses multi-hundred-MB .jsonl from byte 0 if thread_history_projection_state is missing (Related: #33996, #44888)

  • Root Cause:
    1. thread_history_1.sqlite accumulates unbounded intermediate commentary items and tool outputs across long sessions (reaching 5.32 GB locally).
    2. On startup, the app pre-loads all pinned-thread-ids.
    3. If thread_history_projection_state (next_rollout_byte_offset) is missing or out of sync with the .jsonl rollout file size, codex.exe app-server re-projects the entire .jsonl file from byte 0 on the main RPC path, freezing the UI for 5–11 seconds.
  • Verified Fix:
    • Cap projected/hydrated turns per thread (e.g., latest 8 turns in hot projection cache), prune intermediate commentary blocks from older turns, and always preserve/advance thread_history_projection_state.next_rollout_byte_offset to the .jsonl EOF so historical rollouts are never re-parsed from byte 0.

5. Bundled [plugins."visualize@openai-bundled"] <webview> triggers ResizeObserver loop completed with undelivered notifications during streaming (Related: #33996, #33782, #57062)

  • Root Cause: When visualize@openai-bundled is enabled, embedded <webview> containers inside streaming turns trigger hundreds of ResizeObserver loop completed with undelivered notifications layout thrashing events per second.
  • Verified Fix: Disabling visualize@openai-bundled by default (or deferring <webview> height measurement until streaming settles) eliminates the ResizeObserver freeze.

6. Orphaned MCP stdio & shell child processes on Windows (360+ leaked processes / 9.4 GB RAM) (Related: #26984, #33776)

  • Root Cause: On Windows, terminating a parent stdio session or timing out a tool call does not automatically kill grandchild processes (node.exe, python.exe, powershell.exe, conhost.exe) unless bound to a Win32 Job Object.
  • Verified Fix: Assign spawned MCP stdio servers and tool subprocesses on cfg(windows) to a Win32 Job Object configured with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.

Activity

  1. added
    bug
    app
    windows-os
    on Oct 29, 2026
  2. github-actions commented on Oct 29, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appbugperformancewindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions