DEV Community

Michael Smith
Michael Smith

Posted on

Codex Logging Bug May Write TBs to Local SSDs

Codex Logging Bug May Write TBs to Local SSDs

Meta Description: A critical Codex logging bug may write TBs to local SSDs, silently filling drives. Learn what's affected, how to check your system, and how to fix it now.


TL;DR: A confirmed bug in OpenAI's Codex CLI and related tooling can cause runaway logging processes that write terabytes of data to local SSDs, potentially filling drives, degrading performance, and shortening SSD lifespan. If you're running Codex locally, you need to audit your log directories today. This article walks you through what happened, who's affected, how to diagnose the problem, and what to do about it.


What Is the Codex Logging Bug and Why Should You Care?

If you've been running OpenAI's Codex CLI or any of the local agent frameworks built on top of it, there's a serious issue you may not even know is happening in the background. The Codex logging bug may write TBs to local SSDs — and unlike a crash or an obvious error, this one is silent. Your system keeps running. Your drive keeps filling. And by the time you notice, you might be looking at a drive that's 90% full, a degraded NVMe, or worse, corrupted system files.

This isn't a theoretical edge case. Developers running agentic Codex workflows — particularly those using long-running sessions, automated pipelines, or local inference loops — have reported log directories ballooning to hundreds of gigabytes within hours and, in some cases, multiple terabytes over days.

Let's break down exactly what's happening, who's at risk, and what you can do right now.


Understanding the Root Cause

What's Actually Happening Under the Hood

The bug stems from a combination of verbose debug logging being left enabled in certain Codex build configurations and a missing log rotation or size-cap mechanism. In normal operation, Codex writes structured logs to track agent decisions, tool calls, API responses, and internal state transitions. This is useful for debugging but should be bounded.

In affected versions, two things go wrong simultaneously:

  • Log verbosity is set to DEBUG by default in certain deployment configurations, capturing far more data than necessary for production use
  • No log rotation policy is enforced, meaning the log file (or files) grow indefinitely without being truncated, compressed, or archived

The result is that every token processed, every tool invocation, and every intermediate reasoning step gets written to disk in full. For agentic workflows that run thousands of iterations — think automated code review pipelines, continuous refactoring agents, or long-horizon planning tasks — this can translate to gigabytes per hour of log data.

Why SSDs Are Particularly at Risk

This matters more for SSDs than traditional hard drives for two key reasons:

  1. Write endurance limits: SSDs have a finite number of write cycles (measured in TBW — terabytes written). Consumer NVMe drives typically have TBW ratings between 300–600TB. A runaway logging process burning through 1–2TB per day can meaningfully chew through that budget in weeks.
  2. Silent performance degradation: As SSDs approach capacity, write speeds can drop dramatically. A drive at 95% capacity can see write speeds fall by 50% or more, affecting your entire system — not just Codex.

[INTERNAL_LINK: SSD write endurance explained]


Who Is Affected?

Affected Versions and Configurations

Based on community reports and the GitHub issue tracker, the bug appears most prominently in:

Configuration Risk Level Notes
Codex CLI v0.x (local agent mode) High Default debug logging enabled
Codex integrated in VS Code extensions Medium Depends on extension version
Self-hosted Codex via API + local logging High Custom pipelines often miss log caps
Cloud-only API usage (no local agent) Low Logs stay server-side
Codex in containerized environments Medium Risk contained to volume, but still real

Workloads Most at Risk

Not all Codex usage is equally affected. You're most at risk if you're running:

  • Agentic loops — automated agents that run for hours or days without human checkpoints
  • CI/CD pipelines with Codex integration for automated code generation or review
  • Local inference + Codex hybrid setups where both model logs and Codex logs accumulate
  • Development environments where debug mode was never explicitly turned off

If you're just making occasional API calls via a web interface or a simple script, your risk is significantly lower.


How to Check If You're Affected Right Now

Step 1: Find Your Codex Log Directory

The default log locations vary by OS:

Linux/macOS:

~/.codex/logs/
~/.local/share/codex/logs/
/tmp/codex-*/
Enter fullscreen mode Exit fullscreen mode

Windows:

%APPDATA%\Codex\logs\
%LOCALAPPDATA%\Codex\logs\
Enter fullscreen mode Exit fullscreen mode

Step 2: Check Directory Size

Linux/macOS:

du -sh ~/.codex/logs/
du -sh ~/.local/share/codex/logs/
Enter fullscreen mode Exit fullscreen mode

Windows (PowerShell):

Get-ChildItem "$env:APPDATA\Codex\logs" -Recurse | 
  Measure-Object -Property Length -Sum | 
  Select-Object @{N="Size (GB)";E={[math]::Round($_.Sum/1GB,2)}}
Enter fullscreen mode Exit fullscreen mode

If you're seeing gigabytes of logs from recent sessions, you're affected.

Step 3: Check Your SSD Health

Before anything else, verify your drive hasn't taken meaningful wear damage. Use a tool like CrystalDiskInfo on Windows or smartctl on Linux to check:

  • Percentage Used (NVMe attribute): Should be well under 10% for a relatively new drive
  • Data Units Written: Cross-reference with your drive's TBW rating
  • Reallocated Sectors: Any non-zero value warrants attention
# Linux - check NVMe health
sudo nvme smart-log /dev/nvme0 | grep -E "percentage_used|data_units_written"
Enter fullscreen mode Exit fullscreen mode

How to Fix the Codex Logging Bug

Immediate Mitigation: Clear Existing Logs

First, reclaim your disk space. Before deleting anything, make sure Codex isn't currently running.

Linux/macOS:

# Stop any running Codex processes first
pkill -f codex

# Remove logs (adjust path as needed)
rm -rf ~/.codex/logs/*
Enter fullscreen mode Exit fullscreen mode

Windows (PowerShell, run as Administrator):

Stop-Process -Name "codex" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:APPDATA\Codex\logs\*" -Recurse -Force
Enter fullscreen mode Exit fullscreen mode

Reduce Log Verbosity

Edit your Codex configuration file (typically ~/.codex/config.json or codex.config.yaml) and set the log level explicitly:

{
  "logging": {
    "level": "warn",
    "maxFileSizeMB": 100,
    "maxFiles": 5
  }
}
Enter fullscreen mode Exit fullscreen mode

If your version doesn't support these fields yet (pre-patch), you can set an environment variable before launching:

export CODEX_LOG_LEVEL=warn
export CODEX_LOG_MAX_SIZE=104857600  # 100MB in bytes
Enter fullscreen mode Exit fullscreen mode

Apply the Official Patch

OpenAI has acknowledged the issue and released patches. Update to the latest version immediately:

# npm-based install
npm update -g @openai/codex

# If using pip
pip install --upgrade openai-codex

# Verify your version
codex --version
Enter fullscreen mode Exit fullscreen mode

Check the official Codex changelog to confirm you're on a version that includes the logging fix. Look for release notes mentioning "log rotation," "log size limits," or "debug verbosity fix."

Set Up Log Rotation as a Safety Net

Even after patching, it's good practice to enforce log rotation at the OS level. This is your backstop if a future bug or misconfiguration causes runaway logging again.

Linux (using logrotate):

Create /etc/logrotate.d/codex:

/home/*/.codex/logs/*.log {
    daily
    rotate 7
    compress
    missingok
    notifempty
    maxsize 500M
}
Enter fullscreen mode Exit fullscreen mode

macOS (using newsyslog or a cron job):

# Add to crontab: runs daily at 2am
0 2 * * * find ~/.codex/logs -name "*.log" -size +100M -delete
Enter fullscreen mode Exit fullscreen mode

Longer-Term: Protecting Your SSD from Runaway Processes

This bug is a good reminder that developer tools — especially AI-powered ones that run agentic loops — can have outsized impacts on hardware. Here are tools and practices worth adopting:

Disk Usage Monitoring Tools

Tool Platform Best For Cost
WizTree Windows Visual disk space analysis Free
DaisyDisk macOS Beautiful visual disk map $9.99
ncdu Linux/macOS Terminal-based disk usage Free
TreeSize Free Windows Folder size visualization Free

Honest assessment: WizTree is genuinely faster than most alternatives on Windows for scanning large drives. DaisyDisk is worth the $10 on macOS if you regularly audit disk usage — the sunburst visualization makes it immediately obvious when something is anomalously large.

Set Up Disk Space Alerts

Don't wait until your drive is full to notice a problem. DiskSavvy on Windows and simple cron-based scripts on Linux/macOS can alert you when any directory exceeds a threshold.

Quick Linux/macOS alert script:

#!/bin/bash
LOG_DIR="$HOME/.codex/logs"
MAX_SIZE_GB=5
CURRENT_SIZE=$(du -s "$LOG_DIR" 2>/dev/null | awk '{print $1}')
MAX_SIZE_KB=$((MAX_SIZE_GB * 1024 * 1024))

if [ "$CURRENT_SIZE" -gt "$MAX_SIZE_KB" ]; then
  echo "WARNING: Codex logs exceed ${MAX_SIZE_GB}GB" | mail -s "Disk Alert" you@example.com
fi
Enter fullscreen mode Exit fullscreen mode

[INTERNAL_LINK: How to monitor disk health on Linux]


The Broader Lesson: AI Tooling and Infrastructure Hygiene

The Codex logging bug is symptomatic of a wider pattern in the rapid deployment of AI developer tools. When teams ship fast — and AI tooling has been moving extraordinarily fast since 2024 — infrastructure concerns like log management, resource limits, and graceful degradation sometimes get deprioritized.

This isn't unique to OpenAI. Similar issues have appeared in:

  • Local LLM runners that cache model outputs without size limits
  • AI coding assistants that maintain rolling context files that grow without bound
  • Agent frameworks that log every intermediate step for "observability" without actually rotating those logs

As a developer, the practical takeaway is this: treat any AI tool that runs continuously or in loops as a potential resource hog until proven otherwise. Audit disk usage after the first few runs. Set resource limits before deploying to production. Check the logs directory before you check the output.

[INTERNAL_LINK: Best practices for running AI agents locally]


Key Takeaways

  • ✅ The Codex logging bug may write TBs to local SSDs due to uncapped debug logging in certain versions
  • ✅ Agentic workflows, CI/CD pipelines, and long-running sessions are at highest risk
  • ✅ Check your ~/.codex/logs/ directory size immediately — gigabytes of recent logs is a red flag
  • ✅ Update to the latest patched version via npm update -g @openai/codex or pip install --upgrade openai-codex
  • ✅ Set log level to warn in your config and enforce maxFileSizeMB limits
  • ✅ Add OS-level log rotation as a safety net against future issues
  • ✅ Use SSD health monitoring tools to verify your drive hasn't taken significant wear damage
  • ✅ Adopt disk usage alerts for any AI tool running in continuous or automated modes

Take Action Now

Don't wait on this one. Open your terminal right now and run du -sh ~/.codex/logs/ (or the Windows equivalent). If you see more than a few hundred megabytes of recent logs, you're affected and you need to patch, clean, and configure log limits today.

If you found this guide helpful, consider sharing it with your team — especially anyone running automated Codex pipelines. And if you've encountered a different version of this issue or found a fix that worked for your setup, drop a comment below. The developer community benefits when we share this stuff quickly.

Want to stay ahead of issues like this? Subscribe to our newsletter for weekly roundups of critical bugs, patches, and best practices in AI developer tooling. [INTERNAL_LINK: newsletter signup]


Frequently Asked Questions

Q1: How do I know if the Codex logging bug has already damaged my SSD?

Check your SSD's SMART data using a tool like CrystalDiskInfo (Windows) or nvme smart-log (Linux). Look at the "Percentage Used" attribute — if it's jumped significantly in a short time, or if your "Data Units Written" count seems unusually high relative to your normal usage, the bug may have contributed. Most consumer SSDs can handle hundreds of TBs of writes over their lifetime, so unless the bug ran for weeks unchecked, permanent damage is unlikely but not impossible.

Q2: Does this bug affect cloud-based Codex usage (API only)?

If you're using the Codex API without any local agent framework or CLI tooling, your risk is very low. The runaway logging happens in the local client-side components, not on OpenAI's servers. That said, if you've built a custom wrapper that logs API responses locally, audit that logging setup as well.

Q3: Is there a version of Codex that's definitively safe from this bug?

Check the official GitHub releases page for a version that explicitly mentions log rotation or verbosity fixes in its changelog. As of mid-2026, the patched versions include the fix, but always verify by checking your log directory size after a few hours of normal use — it should stay flat or grow very slowly.

Q4: Can this bug cause data loss beyond just filling up the disk?

Directly, no — the bug writes log data, it doesn't delete your files. Indirectly, yes: if your SSD fills to 100% capacity, your operating system may become unstable, writes may fail, and in worst cases you can experience filesystem corruption. The more immediate risk is performance degradation and accelerated SSD wear. Treat a full drive as a data loss risk and address it quickly.

Q5: Should I be worried about this if I'm using Codex inside a Docker container?

It's lower risk because the logs are contained within the container's filesystem or a mounted volume rather than your host SSD. However, if you've mounted a host directory as the log volume, the bug can absolutely affect your host drive. Check your Docker volume mounts and apply the same log rotation best practices inside your container configuration.

Top comments (0)