Retry loop on usage-limit error fills disk: codex-tui.log grew to 67 GB

Resolved 💬 3 comments Opened May 20, 2026 by RochoMerino Closed May 20, 2026

What version of Codex CLI is running?

codex-cli 0.131.0

What subscription do you have?

100

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 25.2.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty

Codex doctor report

❯ codex doctor --json
{
  "schemaVersion": 1,
  "generatedAt": "1779296858s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.131.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/Users/rocho/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/Users/rocho/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/Users/rocho/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/Users/rocho/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/Users/rocho/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "auth is configured",
      "details": {
        "auth file": "/Users/rocho/.codex/auth.json",
        "auth storage mode": "File",
        "stored API key": "false",
        "stored ChatGPT tokens": "true",
        "stored agent identity": "false",
        "stored auth mode": "chatgpt"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/Users/rocho/.codex",
        "config.toml": "/Users/rocho/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/Users/rocho/Developer/inicIA/smartvisas",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_search, tool_suggest, plugins, plugin_hooks, in_app_browser, browser_use, browser_use_external, computer_use, plugin_sharing, image_generation, skill_mcp_dependency_install, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, personality, fast_mode, tui_app_server, prevent_idle_sleep, workspace_dependencies",
        "feature flag overrides": "terminal_resize_reflow=false, goals=true, prevent_idle_sleep=true",
        "feature flags enabled": "29",
        "log dir": "/Users/rocho/.codex/log",
        "mcp servers": "2",
        "model": "gpt-5.5",
        "model provider": "openai",
        "sqlite home": "/Users/rocho/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/Users/rocho/.nvm/versions/node/v24.15.0/bin/codex",
        "current executable": "/Users/rocho/.nvm/versions/node/v24.15.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex",
        "install context": "npm",
        "managed by bun": "false",
        "managed by npm": "true",
        "managed package root": "/Users/rocho/.nvm/versions/node/v24.15.0/lib/node_modules/@openai/codex",
        "npm update target": "/Users/rocho/.nvm/versions/node/v24.15.0/lib/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 75
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "2",
        "disabled servers": "0",
        "stdio servers": "1",
        "streamable_http servers": "1"
      },
      "remediation": null,
      "durationMs": 385
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "ok",
      "summary": "active provider endpoints are reachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ reachable (HTTP 403)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": null,
      "durationMs": 404
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket handshake succeeded",
      "details": {
        "DNS": "2 IPv4, 0 IPv6, first IPv4",
        "auth mode": "chatgpt",
        "connect timeout": "15000 ms",
        "endpoint": "wss://chatgpt.com/backend-api/<redacted>",
        "handshake result": "HTTP 101 Switching Protocols",
        "model provider": "openai",
        "models etag present": "true",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "reasoning header": "false",
        "server model present": "false",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 974
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running npm on macos-aarch64",
      "details": {
        "commit": "unknown",
        "current executable": "/Users/rocho/.nvm/versions/node/v24.15.0/lib/node_modules/@openai/codex/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex/codex",
        "install method": "npm",
        "platform": "macos-aarch64",
        "version": "0.131.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (system)",
      "details": {
        "search command": "rg",
        "search command readiness": "ripgrep 15.1.0 (rev af60c2de9d)",
        "search provider": "system"
      },
      "remediation": null,
      "durationMs": 9
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "Never",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "/Users/rocho/.codex/tmp/arg0/codex-arg0fHlv0F/codex-execve-wrapper",
        "filesystem sandbox": "unrestricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/Users/rocho/.codex (dir)",
        "active rollout files": "176 files, 226960811 total bytes, 1289550 average bytes",
        "archived rollout files": "192 files, 315555686 total bytes, 1643519 average bytes",
        "log DB": "/Users/rocho/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/Users/rocho/.codex/log (dir)",
        "sqlite home": "/Users/rocho/.codex (dir)",
        "state DB": "/Users/rocho/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 3314
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "TERMINFO": "/Applications/Ghostty.app/Contents/Resources/terminfo (dir)",
        "TERM_PROGRAM": "ghostty",
        "color output": "enabled",
        "effective locale": "en_US.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "Ghostty",
        "terminal size": "97x35",
        "terminal version": "1.3.1"
      },
      "remediation": null,
      "durationMs": 1
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.131.0",
        "check for update on startup": "true",
        "last checked at": "2026-05-19T19:03:12.601260Z",
        "latest version": "0.132.0",
        "latest version status": "newer version is available",
        "npm update target": "/Users/rocho/.nvm/versions/node/v24.15.0/lib/node_modules/@openai/codex",
        "update action": "npm install -g @openai/codex",
        "version cache": "/Users/rocho/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 486
    }
  }
}

What issue are you seeing?

Codex CLI entered an infinite retry loop after hitting the ChatGPT usage limit while a goal was
running unattended. The retries had no backoff, and every error was appended to
~/.codex/log/codex-tui.log. With no log rotation, the file grew to 67 GB and filled my
entire SSD before I noticed.

Error spammed in the TUI (printed continuously, with no delay between attempts):

■ Error running remote compact task: You've hit your usage limit. Visit
https://chatgpt.com/codex/settings/usage to purchase more credits or try
again at 11:12 AM.

Once the disk was full, Codex itself failed to persist state:

⚠ Failed to save the conversation transcript; Codex will continue retrying.
Error: thread-store internal error: No space left on device (os error 28)

Final log size on disk:

.rw-------@ 67G rocho 20 May 10:39 ~/.codex/log/codex-tui.log

Truncating the log (: > ~/.codex/log/codex-tui.log) immediately recovered 67 GB.

Environment

  • codex-cli: 0.131.0
  • macOS: 26.2 (build 25C56)
  • Shell: zsh

Token usage when it failed: total=8,581,679 input=7,849,216 (+396,911,232 cached)
output=732,463

What steps can reproduce the bug?

  1. Start a long-running goal in the codex TUI.
  2. Walk away. Let it run until your ChatGPT/Codex credit balance hits its usage limit.
  3. The remote API begins returning usage_limit errors (HTTP 402-style, with a wall-clock

retry time).

  1. Codex retries the remote compact task immediately, with no backoff and no upper bound on

attempts.

  1. Each failed attempt writes a full multi-line error block to ~/.codex/log/codex-tui.log.
  2. The log has no rotation and no max-size cap, so it grows unbounded.
  3. Within hours, the log can consume tens of GB. In my case it reached 67 GB and filled the

disk, which then caused secondary failures (transcript save, other processes' temp files,
etc.).

Thread ID from the failing session: 019e3e69-dca5-7552-9ee2-1935a82a0c6f

What is the expected behavior?

  1. usage_limit should not trigger an immediate retry loop. It is not a transient error.

The API even returns a wall-clock retry time (e.g. "try again at 11:12 AM"). Codex should:

  • Pause the agent and surface that retry time to the user.
  • Optionally schedule a single retry at/after that time, not a tight loop.
  • Never auto-retry without exponential backoff capped at a reasonable max.
  1. codex-tui.log should never grow unbounded. Regardless of what the agent is doing, the

logger should:

  • Rotate the file (e.g. N rolled files × M MB each), OR
  • Enforce a hard size cap and truncate / drop on overflow.

A debug log that can grow to 67 GB silently is a foot-gun no matter what's writing to it.

Additional information

  • The crash mode is self-amplifying: once the disk fills, Codex can't write its own transcript,

which produces more errors, which generate more log lines, accelerating the fill.

  • I'd also suggest adding a startup check that warns if ~/.codex/log/ exceeds some threshold

(e.g. 1 GB), so users notice before it becomes catastrophic.

  • Workaround for other users hitting this: : > ~/.codex/log/codex-tui.log (safe to truncate

while Codex is closed; the running session may keep an open FD).

  • Happy to share an anonymized excerpt of the log if it helps — the same ~5-line error block

repeats many millions of times.

<img width="1139" height="806" alt="Image" src="https://github.com/user-attachments/assets/45411616-429c-444c-ba26-df425e399360" />

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗