Bug Report: Image Loading Freezes Codex Desktop Conversation History
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
- Images use loading=lazy or intersection-observer-based loading
- onError handler has a guard (max retries / sentinel flag) to break infinite loops
- Failed images show a placeholder instead of retrying indefinitely
- Long image-heavy conversations use virtual scrolling
Reproduction
- Have a conversation with multiple iew_image calls or pasted images
- Scroll back through conversation history
- App freezes when encountering images
- 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.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗