Possible infinite disk write / storage corruption behavior in Windows Codex app

Open 💬 3 comments Opened May 20, 2026 by junsulee119
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the Codex App are you using (From “About Codex” dialog)?

Codex 26.513.40821

What subscription do you have?

Plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Environment:

  • OS: Windows 11
  • Codex Windows app (GUI version)
  • Local development environment with Git LFS and Python tooling installed

What steps can reproduce the bug?

What happened:
While using Codex for a coding task, I observed extremely heavy disk write activity that rapidly filled my C: drive.

At the time:

  • Git LFS processes appeared active
  • Disk usage increased continuously
  • Network usage was minimal or near zero
  • This suggests the issue may not have been normal downloading behavior

Later, after deleting the related project folder, disk space usage still did not match expectations.

I investigated further and found:

  • C:\$Extend\$Deleted appeared to consume hundreds of GB
  • The folder was inaccessible normally
  • After rebooting Windows, the storage usage suddenly disappeared/reset

This makes me suspect:

  • Possible runaway temporary writes
  • Infinite/repeated write loop
  • NTFS metadata or deleted-file handling interaction
  • Background Codex/runtime process not releasing handles correctly
  • Git LFS interaction bug
  • Possible sandbox/runtime cleanup failure

Additional observation:
During another task, Codex appeared to hang indefinitely while running a DuckDB/parquet-related Python command.

The command was similar to:

import duckdb, tempfile, pathlib
d=tempfile.TemporaryDirectory(dir=r'C:\tmp')
p=pathlib.Path(d.name)/'x.parquet'
con=duckdb.connect(':memory:')
con.execute('create table t as select 1 as a')
con.execute('copy t to ? (format parquet)', [str(p)])
print(p.exists(), con.execute('select count(*) from read_parquet(?)', [str(p)]).fetchone())
con.close()
d.cleanup()

Actual behavior:

  • Massive unexplained disk usage growth
  • Extremely heavy disk writes
  • Storage not reclaimed immediately even after deleting project files
  • NTFS $Extend\$Deleted growth
  • Required reboot before storage recovered

What is the expected behavior?

Expected behavior:

  • Temporary/runtime files should be cleaned correctly
  • Disk usage should remain bounded
  • Background processes should not continuously write data indefinitely
  • Failed/hung tasks should not leave massive hidden filesystem artifacts

Additional information

Possible areas worth investigating:

  • Runtime sandbox cleanup
  • Git LFS integration
  • Logging/tracing loops
  • Temporary file lifecycle
  • Windows NTFS interaction
  • Background worker shutdown behavior

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 3 months ago

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

  • #22151
  • #22444

Powered by Codex Action

jshaofa-ui · 3 months ago

Solution: Codex #23681 — Infinite Disk Write / Storage Corruption on Windows

Issue: https://github.com/openai/codex/issues/23681
Labels: bug, windows-os, sandbox, app, performance
Competition: 1 comment
Quote: $2,000–$3,000 (data loss risk, P0)

---

Problem Summary

Reproduction: User observed massive disk writes during a coding task with Git LFS and Python tooling. Disk usage grew continuously with minimal network activity.

---

Root Cause Analysis

Likely Cause 1: Runaway Temp File Creation

The sandbox/runtime creates temporary files faster than they're cleaned up:

  • Each tool call or subprocess may create temp files
  • If cleanup fails (handle leak, exception, process crash), files accumulate
  • NTFS marks deleted files as $Deleted until handles are released

Likely Cause 2: Logging/Tracing Loop

A logging or tracing mechanism enters an infinite loop:

  • Error → log → error in logging → log error → infinite loop
  • Particularly likely with DuckDB/parquet operations that may trigger repeated retries

Likely Cause 3: Git LFS Interaction Bug

Git LFS processes may conflict with the sandbox:

  • LFS downloads files to a temp location
  • Sandbox intercepts or duplicates the writes
  • Cleanup fails due to handle conflicts between sandbox and LFS

Likely Cause 4: Background Worker Not Shutting Down

A background worker continues writing after the main task completes:

  • Worker loop doesn't check for termination signal
  • Continues writing to temp files indefinitely
  • Files accumulate until disk is full

---

Proposed Solution

Phase 1: Disk Usage Monitoring (Immediate Mitigation)

Add a background monitor that tracks disk usage and triggers cleanup:

// disk-monitor.ts
import * as os from 'os';
import * as fs from 'fs/promises';
import * as path from 'path';

interface DiskMonitorConfig {
  checkIntervalMs: number;      // 30_000 (30s)
  warningThresholdGB: number;   // 1
  criticalThresholdGB: number;  // 5
  tempDir: string;
}

class DiskMonitor {
  private config: DiskMonitorConfig;
  private intervalId: NodeJS.Timer | null = null;
  private writeRateHistory: number[] = [];

  constructor(config: Partial<DiskMonitorConfig> = {}) {
    this.config = {
      checkIntervalMs: config.checkIntervalMs ?? 30_000,
      warningThresholdGB: config.warningThresholdGB ?? 1,
      criticalThresholdGB: config.criticalThresholdGB ?? 5,
      tempDir: config.tempDir ?? os.tmpdir(),
    };
  }

  start() {

(Full solution available in linked solution file)

xszaryx · 2 months ago

I may have hit the same issue, with extra Git LFS evidence. I added details here: https://github.com/openai/codex/issues/22151

In short: Windows Codex Desktop + huge Git LFS Unreal repo + UE 5.8 MCP/Toolsets workflow caused multiple git-lfs processes to write 140-220 MB/s, disk usage ballooned into $Extend\$Deleted around 770.8 GB, and closing Codex stopped the activity.

<img width="879" height="526" alt="Image" src="https://github.com/user-attachments/assets/e5d6790d-7213-4922-9942-ff47a5d398ae" />
<img width="1125" height="518" alt="Image" src="https://github.com/user-attachments/assets/1fcdeceb-e3a0-4e8d-944b-da042e4a03ba" />