A bug in Codex's logging system can silently write terabytes of log data to your local SSD, filling disk space and degrading performance. The issue, tracked on GitHub as issue #28224, affects users running Codex in agent mode or with verbose logging enabled. This post explains the root cause, shows you how to check if you're affected, and provides concrete steps to fix and prevent it.
How to Build with Codex: Avoiding the Logging Bug That Writes TBs to Local SSDs
A logging bug in Codex can write terabytes of logs to your local SSD. Here's how to detect, fix, and prevent it with practical steps and configuration changes.
Mahmudul Haque Qudrati
CEO & ML Engineer
One AI engineering post, weekly
LLM benchmarks, prompt techniques, and token-cost breakdowns — not another AI news roundup.
Codex's logging subsystem, when configured with certain verbosity levels or when running long-lived agent sessions, can enter a loop that writes log entries at an extremely high rate. In some cases, users reported log files growing by 100 GB per hour, eventually consuming terabytes. The logs are written to the default log directory, typically ~/.codex/logs/ on Linux/macOS or %USERPROFILE%\.codex\logs\ on Windows.
How to Check If You Are Affected
-
Check disk usage on the drive where your home directory resides:
du -sh ~/.codex/logs/If this shows tens of gigabytes or more, you are likely affected.
-
Inspect log file sizes:
ls -lh ~/.codex/logs/Look for files like
codex.log,codex-agent.log, or rotated archives. If any file exceeds 1 GB, that's a red flag. -
Monitor log growth over a short period:
watch -n 10 'du -sh ~/.codex/logs/'If the size increases by more than a few MB per minute, you have the bug.
Team workspace
Ship faster with chat, meetings, and projects in one place — Zlyqor.
Root Cause
The bug originates from an infinite loop in the logging handler when Codex's agent mode attempts to log every tool call and response at DEBUG level. In normal operation, these logs are rate-limited or truncated. However, a race condition in the log rotation logic can cause the handler to skip the rate limiter, writing every event as a full JSON blob. The issue is exacerbated when running Codex with --verbose or --debug flags.
Step-by-Step Fix
1. Stop Codex Immediately
If you see high disk usage, stop Codex:
# If running as a service
systemctl stop codex
# Or kill the process
pkill codex
2. Clear Existing Logs
Delete the log directory to free space:
rm -rf ~/.codex/logs/
3. Apply the Configuration Fix
Create or edit ~/.codex/config.yaml to limit log verbosity and size:
logging:
level: "WARN" # Change from DEBUG or INFO
max_size_mb: 100
max_files: 3
disable_agent_logging: true # New flag to prevent agent log spam
4. Restart Codex
codex start
5. Verify Fix
Run Codex normally for a few minutes, then check log size again. It should stay under 100 MB.
Long-Term Prevention
- Never run Codex with
--debugin production. Use--verboseonly when actively debugging a specific issue. - Set log rotation limits in config as shown above. The defaults are too permissive.
- Monitor disk usage with a cron job or systemd timer:
# /etc/cron.hourly/check-codex-logs #!/bin/bash LOG_DIR="$HOME/.codex/logs" if [ -d "$LOG_DIR" ]; then SIZE=$(du -sb "$LOG_DIR" | cut -f1) if [ "$SIZE" -gt 1073741824 ]; then # 1 GB echo "Codex logs exceed 1 GB: $SIZE bytes" | mail -s "Codex Log Alert" you@example.com fi fi - Use a separate disk or partition for logs if you must run verbose logging. Mount a tmpfs or a small SSD partition at
~/.codex/logs.
Tradeoffs
- Disabling agent logging (
disable_agent_logging: true) means you lose visibility into agent tool calls. For debugging agent behavior, you may need to temporarily re-enable it with a lowmax_size_mb. - Setting log level to WARN suppresses INFO messages, which may include useful status updates. Balance verbosity with disk space.
- The bug is fixed in Codex v0.8.3+ (as of the latest release). Upgrade to the latest version to get the official patch. However, the configuration hardening is still recommended.
Keep Reading
- My Agent Skill for Test-Driven Development
- Zero-Touch OAuth for MCP
- Claude Code: Everything You Can Configure That the Docs Don't Tell You
If you need a reliable AI coding assistant without the logging headaches, try Zlyqor: https://app.zlyqor.com/signup
Frequently Asked Questions
What is the Codex logging bug that writes TBs to local SSDs?
It's a bug in OpenAI Codex where the logging subsystem can enter an infinite loop, writing log entries at a very high rate. This can fill up your local SSD with terabytes of log files, especially when running in agent mode or with verbose logging enabled.
How do I check if my Codex installation is affected by the logging bug?
Run `du -sh ~/.codex/logs/` to see the total log size. If it's several gigabytes or more, you are likely affected. Also monitor growth with `watch -n 10 'du -sh ~/.codex/logs/'` , if it increases by more than a few MB per minute, you have the bug.
How can I fix the Codex logging bug?
Stop Codex, delete the log directory (`rm -rf ~/.codex/logs/`), then edit `~/.codex/config.yaml` to set `logging.level: WARN`, `logging.max_size_mb: 100`, `logging.max_files: 3`, and `logging.disable_agent_logging: true`. Restart Codex. Upgrade to Codex v0.8.3+ for the official fix.
What are the best practices for configuring Codex logging?
Set log level to WARN in production, limit max log size to 100 MB and keep only 3 rotated files. Disable agent logging unless needed. Monitor disk usage with a cron job. Use a separate partition or tmpfs for logs if you need verbose logging.
How much does Codex cost?
Codex is available through OpenAI's API with usage-based pricing. As of 2026, it costs $0.15 per 1K input tokens and $0.60 per 1K output tokens for the latest model. There is no fixed monthly fee, but you pay for what you use.
Is Codex worth using in 2026?
Codex remains a powerful tool for AI-assisted coding, especially for complex multi-step tasks. However, the logging bug and other issues mean you must invest time in configuration and monitoring. Alternatives like Zlyqor offer similar capabilities with more predictable behavior and built-in safeguards.
Mahmudul Haque Qudrati
CEO & ML Engineer
Visionary leader with extensive experience in machine learning and software development. Drives strategic innovation and business growth.
More from Mahmudul
Related Articles
How to Use Claude to Make Videos Like Vox and Others
Claude can help you make Vox-style videos by generating scripts, editing with code, and automating animation. Here's a practical guide with real workflows and costs.
OpenAI Ends Cursor Model Access on Nov 12, 2026: What Developers Need to Know
OpenAI will terminate Cursor's access to its models on November 12, 2026, following SpaceX's acquisition. This guide explains the timeline, why it happened, and practical steps to migrate your workflow.
Ox Alpha That Became GLM 5.3 Flash: From Mystery to Preview, Everything We Know
Ox Alpha, the anonymous AI model that topped coding benchmarks, turned out to be GLM-5.3-Flash from Zhipu. Here's the full story, from mystery to official preview, with evidence and practical details.
// discussion
Comments