Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
What version of the Codex App are you using (From “About Codex” dialog)?
26.415.30602 (1773)
What subscription do you have?
plus
What platform is your computer?
macos m5
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?
I am experiencing repeated failures in Codex Desktop when a long conversation reaches the context limit and triggers automatic remote context compaction.
The error message is:
Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
From the local Codex logs, the failure consistently happens on this request:
POST https://chatgpt.com/backend-api/codex/responses/compact
The related logs include:
Request failed method=POST url=https://chatgpt.com/backend-api/codex/responses/compact
remote compaction failed
Failed to run pre-sampling compact
What stands out is that every failed compact request takes almost exactly 60 seconds before failing. Examples from my logs:
duration_ms=60819
duration_ms=60671
duration_ms=60643
duration_ms=60864
duration_ms=60663
duration_ms=60691
duration_ms=60666
duration_ms=60644
duration_ms=60575
duration_ms=60709
This does not look like a random network issue. It looks like there may be a fixed timeout or deadline of around 60 seconds somewhere in the Codex Desktop remote compaction path.
Some additional context from the logs:
remote compaction failed
last_api_response_total_tokens=232337
all_history_items_model_visible_bytes=930076
model_context_window_tokens=Some(258400)
failing_compaction_request_model_visible_bytes=948544
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
I have two questions:
- Is there a 60-second limit in Codex?
- If so, I'd like to configure this 60-second limit and increase it to enable automatic context compression requests.
What is the expected behavior?
_No response_
Additional information
_No response_
21 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I reviewed the suggested duplicates (#17392, #17508, #17335, #18363). They appear to describe the same remote compaction failure path, but I did not find a confirmed fix, timeout configuration, or official workaround. My local logs add one more data point: each failed /responses/compact request consistently fails at about 60.6 seconds, across multiple attempts, while other proxy traffic can remain active for more than 60 seconds.
Error running remote compact task: We're currently experiencing high demand, which may cause temporary errors.
All day.
+1
same
same
0.125 is still the same, failing over and over again. For such a high-frequency, recurring issue, it has been reported for so long and has severely affected the user experience—basically making it impossible to carry out long-running tasks. Yet there still hasn’t been an urgent fix. This should be prioritized as one of the most critical issues to be fixed immediately.
I consistently encounter this issue whenever a Codex session gets close to the context window limit. Codex attempts to run automatic context compaction, but the compaction task fails and the session becomes unable to continue.
The error I often see is: "Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)"
This is especially disruptive during long-running coding tasks. In my case, the agent had already delegated or started multiple subtasks, but once automatic compaction failed, the whole session got stuck and I could no longer continue the task or recover the previous plan reliably. Codex running in WSL2 ,Also project located inside the WSL environment
Repro on Codex 0.125.0 / NixOS, with measured failure durations
Hitting this consistently. Pulled compact-failure data from 4 sessions in
~/.codex/sessions/:| Rollout size | Duration before stream-disconnect |
|---|---|
| 3.8 MB | 364 seconds |
| 11.8 MB | 93 seconds |
| 48.2 MB | 325 seconds |
| 81.3 MB | 756 seconds |
The failures span 93s to 756s — not a fixed 60s timeout as some earlier comments suggest. Smaller rollouts (3–4 MB) also fail. Pattern looks more like: the server holds the connection open during processing, then drops it at variable durations depending on queue depth or processing load.
Other observations:
/compacttriggered earlier in a session (smaller rollout) usually succeeds. Auto-compact triggering near the context-window threshold is where the failures cluster.codex_error_infofield on the error event reports"other"— suggesting the client lacks specific error categorization for this failure mode.chatgpt.com/backend-api/codex/responses/compact).Two things that would help triage:
/compactreliably succeeds; auto-compact at trigger threshold fails. Filing it as "auto-compact fails at the auto-trigger size" rather than the generic title may help focus a fix.Environment: Codex 0.125.0, NixOS host, ChatGPT subscription auth (
plan_type: pro).Have exactly the same issue as @trivially , e.g. with id 019de044-c6dd-72c0-8ddc-4f14fd70f0e8
Adding another data point from Codex Desktop.
Observed on May 5, 2026 while Codex was running a coding task and automatic context compaction was triggered.
Error shown in the UI:
Task context at the time of failure:
Expected behavior: automatic context compaction should complete and allow the active coding task to continue.
Actual behavior: the remote compact request failed, leaving the session at risk of losing continuity during a long-running task.
Same here. Happened 5x today and burned through all my tokens and did nothing basically.
Also seeing this on Codex Desktop for macOS.
Thread ID:
019e0390-d329-74c3-b8ab-13a32d339c9bCodex App:
26.429.61741 (2429)Error:
This is still happening today (2026-05-07).
@etraut-openai looping you in because you previously commented in #14860 that increasing timeouts may paper over an underlying latency issue.
I opened a focused diagnostic issue here: #22798
The goal is not to claim that all
/responses/compactfailures are caused by the user's network. It is to give users a concrete way to test one specific failure class: whether the same network/proxy/VPN/gateway path used by Codex can keep a long-idle HTTPS request alive for more than 90 seconds.The proposed self-test uses
slee.pt, which intentionally waits before replying. This is different from a basic connectivity check againstchatgpt.com, because the failure mode here is about surviving a long silent wait, not just DNS/TLS/connectivity.If
slee.pt>90s is cut off early on the same path used by Codex, that user has evidence of a transport-path idle cutoff that can directly explainstream disconnected before completionduring remote compaction. If it succeeds, that specific explanation becomes less likely and the report can focus more on backend/client compaction behavior.This may help triage the many duplicate
stream disconnected before completionreports by separating network-path idle cutoff from remote compact service/client failures.Issue "Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)"
WIndows 11
Codex 26.506.3741.0
Adding a concrete data point for the ~60s
/responses/compactfailures.In my case Codex Desktop failed with:
Local logs showed the compact request failing after about 60s.
I initially suspected a Codex-side timeout, especially because the Desktop bundle I had did not yet appear to include the timeout-related fix from https://github.com/openai/codex/pull/23451. However, the more useful finding was that the same local network/proxy path used by Codex could not keep a long-idle HTTPS request alive.
This test failed after about 60s on the failing path:
The upstream/remote path itself survived the same 75s delay, so the cutoff was in my local client/network path. One client I used generated aggressive idle settings and did not expose a persistent way to change them; reconnecting regenerated the config.
After switching to a client/configuration that allowed the same
slee.pt/75srequest to complete normally, remote compaction stopped failing in my setup.So this does not explain every
/responses/compactfailure, but for failures that happen consistently around ~60s, testing the exact Codex network path with a long-idle HTTPS request is a useful diagnostic step.Symptom
Codex Desktop compact/fork/resume fails when a thread reaches 0% context:
Editing old session JSONL/transcript files does not fix it, because the failing payload is generated during the new remote compact request, not necessarily read from saved rollout history.
Root Cause / Likely Cause
remote_compaction_v2was disabled whileenable_request_compressionwas enabled. The old remote compaction path appears to serialize or replay an image/detail value asauto, but the receiving parser only acceptshighororiginal.Observed environment:
Fix / Workaround
Enable
remote_compaction_v2, then fully restart Codex Desktop.Expected:
Then quit Codex Desktop completely with
Cmd+Qand reopen it. After restart, compact/fork/resume works again.Notes
Before finding the actual workaround, I checked the saved session files and confirmed there were no real JSON fields left with
detail == "auto". That confirmed this was not just stale transcript corruption; it was the active compact path generating an incompatible request.I got
Error running remote compact task: stream disconnected before completion: unknown variant
auto, expectedhighororiginalat line 1 column 233067on Mac Visual Studio Code
Adding another macOS Codex Desktop data point for the same visible error.
Environment:
Feature flags from the bundled CLI:
Visible error:
The error has been recurring during normal Codex Desktop use when a thread gets long enough to trigger automatic remote compaction.
I also ran the long-idle HTTPS probe mentioned above on the same machine/network path:
Result:
So this machine appears to have a ~60s idle HTTPS cutoff on that probe, which may put this report in the client/network-path timeout bucket rather than proving a backend-only compact failure.
This worked for me:
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
/feedbackand open a new bug report.