compact execution failed

Resolved 💬 2 comments Opened Apr 1, 2026 by skoh5 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?

v0.118.0

What subscription do you have?

ChatGPT Enterprise

Which model were you using?

gpt-5.4

What platform is your computer?

Linux 4.18.0-553.62.1.el8_10.x86_64 x86_64 x86_64

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

xterm

What issue are you seeing?

"When executing a prompt with the context window already partially used, an error message appears during the automatic compact process and the execution fails. After that, even running /compact manually does not work.

  • error message in TUI

■ Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

  • error message in codex-tui.log

2026-04-01T00:04:37.591078Z ERROR session_loop{thread_id=019d3c70-a313-7573-a258-2b6cc79ce1a2}:submission_dispatch{otel.name="op.dispatch.compact" submission.id="019d465a-0b4e-7651-948b-e679cdcdc159" codex.op="compact"}:turn{otel.name="session_task.compact" thread.id=019d3c70-a313-7573-a258-2b6cc79ce1a2 turn.id=019d465a-0b4e-7651-948b-e679cdcdc159 model=gpt-5.4}: codex_core::compact_remote: remote compaction failed turn_id=019d465a-0b4e-7651-948b-e679cdcdc159 last_api_response_total_tokens=213930 all_history_items_model_visible_bytes=927677 estimated_tokens_of_items_added_since_last_successful_api_response=870 estimated_bytes_of_items_added_since_last_successful_api_response=3479 model_context_window_tokens=Some(258400) failing_compaction_request_model_visible_bytes=942370 compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

What steps can reproduce the bug?

Uploaded thread: 019d3c70-a313-7573-a258-2b6cc79ce1a2

What is the expected behavior?

Context compaction should complete successfully

Additional information

_No response_

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 4 months ago

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

  • #15046
  • #14913
  • #14684
  • #16281
  • #15553

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.