Bug Report: Image Loading Freezes Codex Desktop Conversation History

Open 💬 2 comments Opened Jun 4, 2026 by luoda2023

Bug Report: Image Loading Freezes Codex Desktop Conversation History

Contact: luoda2023@gmail.com
Environment:

  • Runtime: Codex Desktop (MSIX Packaged Electron)
  • Version: 26.601.2237.0
  • Platform: Windows x64

Symptom

When viewing conversation history containing images (screenshots, rendered charts, view_image results), the application becomes completely unresponsive. The UI thread blocks and the only recovery is killing the process via Task Manager.

Root Cause

The data-markdown-image-preview-trigger component's onError handler enters an infinite recursion loop when an image fails to load (cross-origin resource, blob URL expiration, or file path issues in the renderer context). Each error triggers:


re-render → load attempt → fail → onError → re-render → ...

This tight loop blocks the renderer process. Additionally, images embedded in conversation history use eager loading (loading=eager by default), causing all images in a long conversation to load simultaneously.

Expected Behavior

  1. Images use loading=lazy or intersection-observer-based loading
  2. onError handler has a guard (max retries / sentinel flag) to break infinite loops
  3. Failed images show a placeholder instead of retrying indefinitely
  4. Long image-heavy conversations use virtual scrolling

Reproduction

  1. Have a conversation with multiple iew_image calls or pasted images
  2. Scroll back through conversation history
  3. App freezes when encountering images
  4. Must kill via Task Manager to recover

Suggested Fix

  • CSS: img[data-markdown-image-preview-trigger] { loading: lazy !important; content-visibility: auto !important; contain: layout style paint !important; }
  • JavaScript: Add a sentinel guard to onError (max 1 retry, then show placeholder)
  • Virtual scrolling for conversation list items containing images

Workaround

If the app freezes, open DevTools (Ctrl+Shift+I) → Console and paste:

js
(function(){var n=0;document.querySelectorAll('img').forEach(function(i){i.loading='lazy';i.style.contentVisibility='auto';i.style.contain='layout style paint';var o=i.onerror;i.onerror=function(){if(++n>1){i.alt='[broken]';i.src='';return true}return o?o.apply(this,arguments):true}})}())

This stops the onError loop and enables lazy loading for all images.

---
This bug was identified through reverse engineering of the compiled Electron app. A monetary reward is respectfully requested for the discovery and detailed analysis.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗