Skip to content

"Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying." error while /goal is in progress #24247

Closed

Description

@marcelruhf

What version of Codex CLI is running?

0.133.0

What subscription do you have?

API Billing

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 25.5.0 arm64 arm

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

Warp v0.2026.05.18.05.32.stable_02

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1779504338s since unix epoch",
  "overallStatus": "ok",
  "codexVersion": "0.133.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/Users/mruhf/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/Users/mruhf/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/Users/mruhf/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/Users/mruhf/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/Users/mruhf/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "ok",
      "summary": "OpenAI auth is not required for the active model provider",
      "details": {
        "auth file": "/Users/mruhf/.codex/auth.json",
        "auth storage mode": "File",
        "model provider requires OpenAI auth": "false"
      },
      "remediation": null,
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/Users/mruhf/.codex",
        "config.toml": "/Users/mruhf/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/Users/mruhf/RepairPal/Repairpal-Rails.admin-typescript",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, terminal_resize_reflow, sqlite, memories, hooks, enable_request_compression, multi_agent, apps, 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": "memories=true, prevent_idle_sleep=true",
        "feature flags enabled": "30",
        "log dir": "/Users/mruhf/.codex/log",
        "mcp servers": "10",
        "model": "gpt-5.5",
        "model provider": "<company>",
        "sqlite home": "/Users/mruhf/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/Users/mruhf/.bun/bin/codex",
        "current executable": "/Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin/codex",
        "install context": "bun (package /Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin, bin /Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin, resources none, path /Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path)",
        "managed by bun": "true",
        "managed by npm": "false",
        "managed package root": "/Users/mruhf/.bun/install/global/node_modules/@openai/codex"
      },
      "remediation": null,
      "durationMs": 5
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "MCP configuration is locally consistent",
      "details": {
        "configured servers": "10",
        "disabled servers": "0",
        "stdio servers": "7",
        "streamable_http servers": "3"
      },
      "remediation": null,
      "durationMs": 1638
    },
    "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": {
        "reachability mode": "provider auth",
        "<company> API base URL": "<internal gateway> reachable (HTTP 200)",
        "<company> API route probe": "<internal gateway>/models route exists (HTTP 401)"
      },
      "remediation": null,
      "durationMs": 1559
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "ok",
      "summary": "Responses WebSocket is not enabled for the active provider",
      "details": {
        "model provider": "<company>",
        "provider name": "<Company>",
        "proxy env vars": "none",
        "supports websockets": "false",
        "wire API": "responses"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running bun on macos-aarch64",
      "details": {
        "commit": "unknown",
        "current executable": "/Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin/codex",
        "install method": "bun (package /Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin, bin /Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/bin, resources none, path /Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path)",
        "platform": "macos-aarch64",
        "version": "0.133.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (bundled)",
      "details": {
        "search command": "/Users/mruhf/.bun/install/global/node_modules/@openai/codex-darwin-arm64/vendor/aarch64-apple-darwin/codex-path/rg",
        "search command readiness": "file exists",
        "search provider": "bundled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "OnRequest",
        "codex-linux-sandbox helper": "none",
        "execve wrapper helper": "/Users/mruhf/.codex/tmp/arg0/codex-arg0xUma3E/codex-execve-wrapper",
        "filesystem sandbox": "restricted",
        "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/mruhf/.codex (dir)",
        "active rollout files": "5369 files, 2154783956 total bytes, 401338 average bytes",
        "archived rollout files": "140 files, 121378199 total bytes, 866987 average bytes",
        "goals DB": "/Users/mruhf/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/Users/mruhf/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/Users/mruhf/.codex/log (dir)",
        "sqlite home": "/Users/mruhf/.codex (dir)",
        "state DB": "/Users/mruhf/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok"
      },
      "remediation": null,
      "durationMs": 23218
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "COLORTERM": "truecolor",
        "TERM_PROGRAM": "WarpTerminal",
        "color output": "enabled",
        "effective locale": "en_US.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "Warp",
        "terminal size": "281x64",
        "terminal version": "v0.2026.05.18.05.32.stable_02"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.133.0",
        "check for update on startup": "true",
        "last checked at": "2026-05-22T16:51:34.398796Z",
        "latest version": "0.133.0",
        "latest version status": "current version is not older",
        "update action": "bun install -g @openai/codex",
        "version cache": "/Users/mruhf/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 193
    }
  }
}

What issue are you seeing?

After several hours of /goal usage, the following error message appears repeatedly, until the conversation is interrupted:

Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.

What steps can reproduce the bug?

Uploaded thread: 019e5173-d297-7ae1-84ac-828e9823498d

What is the expected behavior?

I would normally expect automatic compaction to work as expected during /goal execution.

Additional information

No response

Activity

  1. added
    CLIIssues related to the Codex CLI
    contextIssues related to context management (including compaction)
    on May 23, 2026
  2. etraut-openai commented on Jun 10, 2026

    @etraut-openai
    Contributor

    Thanks for reporting. This issue isn't specific to /goal. We've had many other reports of running out of room in the model's context window during compaction. We're working on improving this.

    I'm going to close this issue since the underlying issue is already covered in many other bug reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingcontextIssues related to context management (including compaction)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions