CLI remote compaction loops with 400 invalid_enum for `context_compaction`, consuming quota across sessions

Resolved 💬 2 comments Opened May 16, 2026 by Bazza-X Closed Jun 29, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.130.0

What subscription do you have?

Team. I also observed the same failure across a second Personal Pro account.

Which model were you using?

gpt-5.5 with xhigh reasoning

What platform is your computer?

Darwin 25.4.0 arm64 arm

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

Ghostty, zsh, TERM=xterm-256color

Codex doctor report

not available {

{
  "available": false,
  "codex_version": "codex-cli 0.130.0",
  "fresh_session": true,
  "codex_update": "Warning: Not upgrading codex, the latest version is already installed. Update ran successfully! Please restart Codex.",
  "help_doctor": "error: unrecognized subcommand 'doctor'",
  "doctor_json": "error: unexpected argument '--json' found",
  "doctor": "Error: stdin is not a terminal"
}

What issue are you seeing?

Remote compaction repeatedly fails because Codex sends or injects an item type named `context_compaction`, but the backend rejects it. The backend error says accepted values include `compaction` and `compaction_trigger`, but not `context_compaction`.

This affected multiple threads/windows, including at least four separate Codex windows, across two different accounts. I am not including account/user IDs in this public issue, but OpenAI should be able to correlate the uploaded feedback thread ID or contact me directly for further diagnostics. 

019e3003-2bda-77e2-a709-d641e65ff317

This materially consumed quota/usage while sessions repeatedly failed.

epresentative error:

Error running remote compact task: {
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "[ItemParam] [input[226]] [invalid_enum_value] Invalid value: 'context_compaction'. Supported values are: 'apply_patch_call', 'apply_patch_call_output', 'code_interpreter_call', 'compaction', 'compaction_trigger', 'computer_call', 'computer_call_output', 'custom_tool_call', 'custom_tool_call_output', 'file_search_call', 'function_call', 'function_call_output', 'image_generation_call', 'item_reference', 'local_shell_call', 'local_shell_call_output', 'mcp_approval_request', 'mcp_approval_response', 'mcp_call', 'mcp_list_tools', 'message', 'reasoning', 'shell_call', 'shell_call_output', 'tool_search_call', 'tool_search_output', and 'web_search_call'."
  },
  "status": 400
}

I also saw repeated websocket failures on the same remote compaction path:

Error running remote compact task: unexpected status 403 Forbidden: Unknown error,
url: wss://chatgpt.com/backend-api/codex/responses

What steps can reproduce the bug?

Uploaded feedback thread:
019e3003-2bda-77e2-a709-d641e65ff317

1. Run Codex CLI 0.130.0 using gpt-5.5 with a long-running session.
2. Let the session grow until automatic remote compaction is triggered.
3. Observe remote compaction failing with invalid enum `context_compaction`.
4. Continue or resume the session; the failure can repeat and continue consuming quota.

Affected local session/thread IDs observed in local logs:

- 019e2e07-10b8-7b72-9979-8ee724045622
  - 35,588 line-level codex_core::compact_remote failure log entries
  - first observed 2026-05-16T02:39:31Z; last observed 2026-05-16T08:58:41Z
  - transcript: codex/sessions/2026/05/16/rollout-2026-05-16T00-44-35-019e2e07-10b8-7b72-9979-8ee724045622.jsonl

- 019e2e85-62c8-7ce1-b0e3-09297bb7e458
  - 13,588 line-level codex_core::compact_remote failure log entries, including 13,581 403 Forbidden failures
  - first observed 2026-05-16T02:20:02Z; last observed 2026-05-16T08:59:42Z
  - transcript: codex/sessions/2026/05/16/rollout-2026-05-16T03-02-34-019e2e85-62c8-7ce1-b0e3-09297bb7e458.jsonl

- 019e2e83-f8d7-7b83-832b-dce6b01ff340
  - 12,555 line-level codex_core::compact_remote failure log entries, including 12,547 403 Forbidden failures
  - first observed 2026-05-16T02:23:47Z; last observed 2026-05-16T08:59:42Z
  - transcript: codex/sessions/2026/05/16/rollout-2026-05-16T03-01-01-019e2e83-f8d7-7b83-832b-dce6b01ff340.jsonl

- 019e2e55-2d10-76f3-8b01-a65314d16bca
  - 14 line-level codex_core::compact_remote failure log entries, all 403 Forbidden failures
  - first observed 2026-05-16T01:52:01Z; last observed 2026-05-16T01:55:03Z
  - transcript: codex/sessions/2026/05/16/rollout-2026-05-16T02-09-54-019e2e55-2d10-76f3-8b01-a65314d16bca.jsonl

This affected multiple threads/windows, including at least four separate Codex windows, across two different accounts.

What is the expected behavior?

Remote compaction should only send item types accepted by the backend schema, such as `compaction` or `compaction_trigger`.

If compaction fails, Codex should stop retrying in a way that consumes quota and should provide a safe recovery path.

Additional information

Isearched existing openai/codex issues before filing. There are many broad remote-compaction issues, but I found no exact match for the context_compaction invalid enum mismatch.

Closest related issues:

Local mitigation applied:
remote_compaction_v2 = false

This avoids the failing path in new sessions, but already-running sessions do not reload that config in place.

The local Codex SQLite/log evidence contained 58 rows matching:
Invalid value: 'context_compaction'

Experimental feature analysis:

  • Direct suspect: remote_compaction_v2 was enabled during the incident and is the feature that selects the failing remote compaction path. It is now disabled locally as a mitigation.
  • Adjacent suspect: responses_websocket_response_processed is enabled and under development. The failing path is wss://chatgpt.com/backend-api/codex/responses, and the 0.130.0 binary contains both compaction and context_compaction response item variants.
  • Amplifiers rather than root causes: goals, multi_agent_v2, enable_fanout, and prevent_idle_sleep can keep long-running sessions active enough to trigger compaction repeatedly, but they should not create an invalid backend enum by themselves.
  • Probably unrelated to this specific enum mismatch: MCP/app flags such as enable_mcp_apps, builtin_mcp, apps_mcp_path_override, remote_plugin, plugin_hooks, and tool_search_always_defer_mcp_tools.

Please investigate whether this is a Codex CLI/backend schema mismatch and restore or credit quota consumed by repeated failed remote compaction attempts.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 3 months ago

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

  • #23003
  • #22335

Powered by Codex Action

etraut-openai contributor · 1 month ago

Thanks for reporting this problem. Until recently, Codex used a separate endpoint and server-side logic for compaction. We recently switched to a more robust approach where the compaction logic is moved locally using the same endpoint as normal turns. This eliminates "remote compaction" errors and increases the stability and reliability of compaction operations. If you see further problems with compaction, please use /feedback and open a new bug report.