Context compaction failed

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

What version of the Codex App are you using (From “About Codex” dialog)?

26.527.31326

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Darwin 25.6.0 arm64 arm

What issue are you seeing?

While Codex was actively working on a task, the session attempted to automatically compact the context.

The compaction failed with the following error:

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

The task appeared to stop unexpectedly during the compaction phase.

Feedback ID:
019e81ff-2ad4-7930-8224-47980fbdc561

The issue occurred after approximately 16 minutes of work while editing multiple files.

What steps can reproduce the bug?

Feedback ID: 019e811f-2ad4-7930-8224-47980fbdc561

  1. Start a Codex task that requires editing multiple files using 5.5 Extra High mode.
  2. Allow the task to run long enough for automatic context compaction to trigger.
  3. Observe the "Context automatically compacted" event.
  4. In some cases the compaction request fails.
  5. The following error appears:

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

What is the expected behavior?

Automatic context compaction should complete successfully without interrupting the running task.

If compaction fails, Codex should retry automatically.

Additional information

The issue occurred during a long-running coding session involving multiple file edits.

At the time of failure:

  • 8 files had been edited.
  • Context compaction was triggered automatically.
  • The session reported "Worked for 16m 34s".
  • The error appeared immediately after the "Context automatically compacted" message.

No manual interruption was performed by the user.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 2 months ago

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

  • #24920
  • #24449
  • #24544
  • #24618

Powered by Codex Action

lubef · 2 months ago

I can confirm a similar failure on Windows Codex Desktop.

Environment:

  • Codex Desktop package: 26.527.3686.0
  • Codex CLI after update: 0.135.0
  • Previous active Desktop runtime observed in logs: 0.135.0-alpha.1
  • OS: Windows
  • Model: gpt-5.5
  • Reasoning effort at the time of failure: xhigh

Observed local log evidence:

  • remote compaction failed
  • last_api_response_total_tokens: 209136
  • all_history_items_model_visible_bytes: 861454
  • model_context_window_tokens: 258400
  • failing_compaction_request_model_visible_bytes: 882928
  • compact_error: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

Impact:
The thread became unreliable around automatic compaction. I have since mitigated locally by:

  • updating the terminal CLI to 0.135.0
  • changing default reasoning effort from xhigh to high
  • manually switching the Desktop UI from “5.5 Extra High” to “5.5 High”
  • using manual handoff summaries before long threads reach automatic compaction

This looks consistent with remote compaction instability for long-running gpt-5.5 high/xhigh sessions.

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.