automatic triggered "remote compact task" never works (Error running remote compact task: stream disconnected before completion)

Resolved 💬 5 comments Opened Apr 29, 2026 by Kupferfox 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.125.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.4, gpt-5.5

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

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

Powershell/CMD/VSCode (no difference)

What issue are you seeing?

On an automatic compact, the process fails. A manual "/compact" afterwards fails too. No chance to get the session running again.

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

The direct internet connection is stable and has no influence on this behaviour.

A manual "/compact" before the context-window is reached _occasionally_ works.

What steps can reproduce the bug?

Fill session up till the context window limit is reached. The automatic compact-task and following manual /compact then fails.

What is the expected behavior?

That the compact works...

Additional information

_No response_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 4 months ago

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

  • #19660
  • #19740
  • #19558
  • #19441
  • #19547

Powered by Codex Action

matthewromano18-code · 4 months ago

Thank God, I’m not the only one. This is the most irritating thing ever I don’t understand why it’s happening. I lowered my automatic compacting window to 150,000 tokens and it’s still doing it. I don’t know what the issue is

codec-d · 4 months ago

<img width="973" height="616" alt="Image" src="https://github.com/user-attachments/assets/e029f757-af7e-4a52-b250-b7aae3dae40e" />

presidenzo · 3 months ago

Also seeing this on Codex Desktop for macOS.

Thread ID: 019e0390-d329-74c3-b8ab-13a32d339c9b
Codex App: 26.429.61741 (2429)
Error:

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

This is still happening today (2026-05-07).

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.