codex - 💡(How to fix) Fix /compact and auto-compact fail with "stream disconnected before completion" since April 15, 2026 [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#18838Fetched 2026-04-22 07:51:45
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5closed ×1commented ×1

Error Message

Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) Every retry ends with the exact same error: Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) {"timestamp":"2026-04-21T13:13:03.358Z","type":"event_msg","payload":{"type":"error","message":"Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)","codex_error_info":"other"}}

Code Example

{"timestamp":"2026-04-21T13:03:03.024Z","type":"event_msg","payload":{"type":"task_started","turn_id":"019db023-176e-7c20-b0f2-e06dd50450eb","started_at":1776776583,"model_context_window":258400,"collaboration_mode_kind":"default"}}
{"timestamp":"2026-04-21T13:13:03.358Z","type":"event_msg","payload":{"type":"error","message":"Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)","codex_error_info":"other"}}
{"timestamp":"2026-04-21T13:13:03.359Z","type":"event_msg","payload":{"type":"task_complete","turn_id":"019db023-176e-7c20-b0f2-e06dd50450eb","last_agent_message":null,"completed_at":1776777183,"duration_ms":600334}}}
RAW_BUFFERClick to expand / collapse

What version of Codex CLI is running?

0.122.0

What subscription do you have?

PRO

Which model were you using?

gpt-5.4

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

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

PowerShell

What issue are you seeing?

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

What steps can reproduce the bug?

/compact compact starts normally after about 3-10 minutes, the task fails the turn completes without any compacted result repeated attempts behave the same way

What is the expected behavior?

/compact and auto-compact should complete successfully and return a compacted conversation/context.

Additional information

Since April 15, 2026, compacting stopped working in Codex CLI.

The issue happens in both cases:

when /compact is triggered manually when compact is triggered automatically by the model

Every retry ends with the exact same error:

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

This looks reproducible and not random.

Relevant logs

{"timestamp":"2026-04-21T13:03:03.024Z","type":"event_msg","payload":{"type":"task_started","turn_id":"019db023-176e-7c20-b0f2-e06dd50450eb","started_at":1776776583,"model_context_window":258400,"collaboration_mode_kind":"default"}}
{"timestamp":"2026-04-21T13:13:03.358Z","type":"event_msg","payload":{"type":"error","message":"Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)","codex_error_info":"other"}}
{"timestamp":"2026-04-21T13:13:03.359Z","type":"event_msg","payload":{"type":"task_complete","turn_id":"019db023-176e-7c20-b0f2-e06dd50450eb","last_agent_message":null,"completed_at":1776777183,"duration_ms":600334}}}

extent analysis

TL;DR

The issue is likely due to a connection timeout or server-side issue when sending a request to the Codex API, causing the compact task to fail.

Guidance

  • Verify the network connection and check for any firewall or proxy settings that might be interfering with the request to https://chatgpt.com/backend-api/codex/responses/compact.
  • Review the Codex CLI documentation to see if there are any configuration options for adjusting the timeout or retry settings for the compact task.
  • Check the system clock and ensure it is synchronized with the correct time, as the logs include timestamps and any desynchronization might cause issues.
  • Consider testing the compact task with a different model or subscription to isolate if the issue is specific to the gpt-5.4 model or the PRO subscription.

Example

No code snippet is provided as the issue seems to be related to the Codex CLI and its interaction with the API, rather than a code-specific problem.

Notes

The issue started occurring on April 15, 2026, which might indicate a change in the Codex API or the CLI that caused the compact task to fail. The fact that the error is reproducible and not random suggests a systematic issue rather than a transient problem.

Recommendation

Apply workaround: Adjust the network settings or configure the Codex CLI to use a different API endpoint or timeout setting to mitigate the issue, as the root cause is likely related to the connection to the Codex API.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix /compact and auto-compact fail with "stream disconnected before completion" since April 15, 2026 [1 comments, 2 participants]