Codex Desktop auto-compaction fails with an invalid enum error when a long-running thread is automatically compacted.
What version of the Codex App are you using (From “About Codex” dialog)?
Codex 26.608.12217
What subscription do you have?
ChatGPT Pro
What platform is your computer?
Darwin 24.6.0 arm64 arm
What issue are you seeing?
Codex Desktop auto-compaction fails with an invalid enum error when a long-running thread is automatically compacted.
Feedback ID:
019eb60c-29f9-77d3-a533-464dfd6bac40
Error message:
[ItemParam] [input[1]] [invalid_enum_value] Invalid value: ‘context_compaction’. Supported values are: ‘additional_tools’, ‘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’.
This occurs immediately after Codex Desktop shows that the context was automatically compacted.
Environment / workflow:
- Codex Desktop App version: Codex 26.608.12217
- Codex Desktop says it is on the latest version.
- I am using Codex Desktop with a remote Mac workflow.
- The remote Codex CLI is up to date.
- This happens during long-running coding sessions with file edits and tool calls.
Workarounds already tried:
- I added the following to ~/.codex/config.toml:
[features]
remote_compaction_v2 = false
- I restarted Codex Desktop.
- I confirmed after restart that remote_compaction_v2 was still disabled using:
codex features list
- I also tested OMO PostCompact hooks separately. They did not produce malformed output.
- The issue still reproduced after Codex Desktop restart and after confirming remote_compaction_v2=false.
Impact:
Long-running Codex Desktop threads become unusable once automatic compaction triggers. The coding operation may partially complete and file edits may be applied, but the thread then fails with the invalid enum error and cannot continue reliably.
Expected behavior:
Codex Desktop should not send an unsupported item type named “context_compaction” to the API. If compaction metadata is needed, it should use a supported item type such as “compaction” or “compaction_trigger”, or filter internal-only item types before submitting the request.
Actual behavior:
When automatic context compaction triggers, Codex sends or replays an item with type “context_compaction”. The API rejects it because “context_compaction” is not one of the supported input item types.
Steps to reproduce:
- Open Codex Desktop.
- Use a remote Mac workflow.
- Start or continue a long-running coding thread.
- Perform enough file edits/tool calls for automatic context compaction to trigger.
- Codex Desktop shows that the context was automatically compacted.
- The next request fails with the invalid_enum_value error for “context_compaction”.
This does not appear to be caused by my project code. It appears to be a Codex Desktop auto-compaction or saved-thread replay serialization issue where an internal item type leaks into the API input.
What steps can reproduce the bug?
This issue is not caused by a specific project code snippet. I do not have a minimal standalone code snippet that reproduces it, because the failure occurs in Codex Desktop’s automatic context compaction / saved-thread replay path.
Feedback ID:
019eb60c-29f9-77d3-a533-464dfd6bac40
Codex App version:
Codex 26.608.12217
Workflow:
- Codex Desktop App
- Remote Mac workflow
- Long-running coding thread with multiple file edits and tool calls
- Remote Codex CLI is up to date
- remote_compaction_v2=false was confirmed after restarting Codex Desktop
Reproduction steps:
- Open Codex Desktop App.
- Connect to or use a remote Mac workflow.
- Start a long-running coding thread in a real project.
- Ask Codex to perform coding work involving file reads, file edits, searches, and tests.
- Continue the same thread until Codex Desktop automatically compacts the context.
- Codex shows that the context was automatically compacted.
- Immediately after compaction, the next request fails with this error:
[ItemParam] [input[1]] [invalid_enum_value] Invalid value: ‘context_compaction’. Supported values are: ‘additional_tools’, ‘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’.
Observed example:
After the error, Codex still reported file edits:
- src/reports/build_report.py
- tests/test_report.py
This suggests the coding operation may partially apply file changes, but the thread becomes unreliable or unusable once automatic compaction/replay fails.
Workarounds already tried:
- Added this to ~/.codex/config.toml:
[features]
remote_compaction_v2 = false
- Restarted Codex Desktop.
- Confirmed after restart that remote_compaction_v2 remained disabled using:
codex features list
- Tested OMO PostCompact hooks separately; no malformed output was observed.
- The error still reproduced after Codex Desktop restart and after confirming remote_compaction_v2=false.
Session ID / token usage / context window usage:
I do not have a visible session ID or exact token/context-window usage from the UI. The issue consistently appears when the thread becomes long enough for Codex Desktop to trigger automatic context compaction.
What is the expected behavior?
Codex Desktop should continue the thread normally after automatic context compaction.
It should not send or replay an unsupported input item type named “context_compaction” to the API.
If compaction metadata needs to be represented in the conversation input, Codex Desktop should use a supported item type such as “compaction” or “compaction_trigger”, or filter any internal-only item types before submitting the next request.
Expected result:
- Automatic context compaction completes successfully.
- The long-running coding thread remains usable.
- File edits and tool-call history are preserved correctly.
- The next user request after compaction does not fail with invalid_enum_value.
- Disabling remote_compaction_v2 should either prevent this compaction path or Codex should clearly use a compatible fallback path.
Actual result:
After automatic compaction, Codex Desktop fails with invalid_enum_value because “context_compaction” is included as an input item type even though it is not supported by the API schema.
Additional information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗