Question: Codex Desktop outputs thousands of .tmp.js Vite chunk files to Temp directory
Question: Codex Desktop outputs thousands of .tmp.js Vite chunk files to Temp directory
Issue Description
I'm using Codex Desktop (version 26.616.10790.0, MSIX installation) and discovered a large number of .tmp.js files accumulating in the Windows Temp directory.
I'm not sure if this is a Codex bug or a local issue, so I'm posting to ask if anyone else has experienced this.
Observed Behavior
- Location:
C:\Users\<username>\AppData\Local\Temp\{UUID}.tmp.js - File count: 27,315+ files (continuously growing)
- Total size: 486.87 MB
- Write speed: ~20 files/second
- Pattern: ~634 files generated in batch within 20 seconds of starting Codex, then stops
Sample file content:
import{s as e}from"./chunk-Cq_f4orQ.js";import{n as t,t as n}from"./jsx-runtime-DXKlqYIQ.js";
// ... Vite-built ES module code ...
//# sourceMappingURL=format-relative-date-time-DLmXX0fU.js.map
Technical Analysis
Key findings:
- Chunk names match exactly with
app.asar\webview\assets\(chunk-Cq_f4orQ.js, jsx-runtime-DXKlqYIQ.js, etc.) - This suggests Codex is repeatedly writing frontend modules to Temp at runtime
Ruled out causes:
- ❌ Localization config snapshots (Lr function)
- ❌ Webpack filesystem cache (Codex uses Vite)
- ❌ Monaco Editor workers
- ❌ tmp npm package
Investigation progress:
- Unpacked app.asar (159MB), found multiple Temp write logic in main-CMg-5md_.js, but all are for config files/plugin caches/clipboard images - normal用途
- The chunk generation logic is likely in the 286MB codex binary or other native modules
Most likely root cause:
Codex's integrated Vite dev server or frontend HMR mechanism outputs compiled chunks to Temp when the webview refreshes/rebuilds, and never cleans them up.
Output Pattern
| Stage | File Growth | Notes |
|-------|-------------|-------|
| Codex not running | +0 | No output |
| Codex startup | +634 | Batch Vite chunk output |
| Codex running | occasional +少量 | webview refresh output |
| Codex closed | +0 | Output stops |
Timeline:
| Date | File Count | Notes |
|------|------------|-------|
| 06-23 | 2,589 | First time using Codex |
| 06-24 | 21,466 | Restarted Codex ~30 times for debugging |
| 06-25 | 1,943 | Normal usage |
Possible Causes
- Vite HMR mechanism: Codex uses Vite dev server for webview, HMR needs temporary chunk files
- Cache directory misconfiguration: May point to system Temp instead of app cache directory
- Missing file cleanup: Files created but never referenced or cleaned
- Windows-specific issue: MSIX installation path or permission issues
Questions
- Is this by design (temp files for caching) or a potential bug?
- Has anyone else encountered this?
- Are these files automatically cleaned up eventually?
- Is there a configuration option to control this behavior?
Environment
- OS: Windows 10/11 (64-bit)
- Codex version: 26.616.10790.0 (MSIX installation)
- Temp directory:
C:\Users\30632\AppData\Local\Temp
Thanks for any help or information!
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗