You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) #18450
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:
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.
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.
Reacted by 3VILALLIUM, meowtech, sinopec, Evgenii Burmistrov, theocaplan-del and XXZ
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:
Manual /compact triggered earlier in a session (smaller rollout) usually succeeds. Auto-compact triggering near the context-window threshold is where the failures cluster.
codex_error_info field on the error event reports "other" — suggesting the client lacks specific error categorization for this failure mode.
The bug is auto-compact-specific, not generic compact. Manual /compact reliably 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.
Recovery after the failure is unclear. When auto-compact fails mid-session, it is hard to know whether retrying succeeds, whether the rollout is still consistent, or whether the session needs to be ended. Client-side fallback (retry with smaller window, prompt the user, fall back to truncation) would make the failure recoverable rather than session-ending.
The goal is not to claim that all /responses/compact failures 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 against chatgpt.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 explain stream disconnected before completion during 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 completion reports by separating network-path idle cutoff from remote compact service/client failures.
Adding a concrete data point for the ~60s /responses/compact failures.
In my case Codex Desktop failed with:
Error running remote compact task: stream disconnected before completion:
error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
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 #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/75s request to complete normally, remote compaction stopped failing in my setup.
So this does not explain every /responses/compact failure, 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:
Context compacted
Error running remote compact task: stream disconnected before completion:
unknown variant `auto`, expected `high` or `original` at line 1 column 121843
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_v2 was disabled while enable_request_compression was enabled. The old remote compaction path appears to serialize or replay an image/detail value as auto, but the receiving parser only accepts high or original.
Fix / Workaround
Enable remote_compaction_v2, then fully restart Codex Desktop.
cp ~/.codex/config.toml ~/.codex/config.toml.bak-before-remote-compaction-v2
codex features enable remote_compaction_v2
codex features list | rg '^remote_compaction_v2|^enable_request_compression'
Expected:
enable_request_compression stable true
remote_compaction_v2 under development true
Then quit Codex Desktop completely with Cmd+Q and 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.
Reacted by David Murr, MarcusSt, Michael Kizimov and urbanmeeple
I got
Error running remote compact task: stream disconnected before completion: unknown variant auto, expected high or original at line 1 column 233067
on Mac Visual Studio Code
curl: (52) Empty reply from server
http_code=000 total_time=60.605310 exit=52 err=Empty reply from server
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.
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.
Activity
github-actions commentedon Apr 18, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
responses/compacton bundled agent0.122.0-alpha.1#18363Powered by Codex Action
ttllyy111 commentedon Apr 18, 2026
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.
douglasware commentedon Apr 22, 2026
Error running remote compact task: We're currently experiencing high demand, which may cause temporary errors.
All day.
DuskLin commentedon Apr 24, 2026
+1
uujx commentedon Apr 24, 2026
same
aaronysl commentedon Apr 28, 2026
same
sinopec commentedon Apr 29, 2026
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.
xuzheliu commentedon Apr 29, 2026
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
MrVampy commentedon Apr 29, 2026
Repro on Codex 0.125.0 / NixOS, with measured failure durations
Hitting this consistently. Pulled compact-failure data from 4 sessions in
~/.codex/sessions/: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).pcristin commentedon Apr 30, 2026
Have exactly the same issue as @trivially , e.g. with id 019de044-c6dd-72c0-8ddc-4f14fd70f0e8
bjmark commentedon May 5, 2026
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.
endoibiza commentedon May 5, 2026
Same here. Happened 5x today and burned through all my tokens and did nothing basically.
presidenzo commentedon May 7, 2026
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).
yuweuii commentedon May 15, 2026
@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.michaliskon commentedon May 16, 2026
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
hatab2010 commentedon May 22, 2026
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 #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.MaiHoangViet1809 commentedon May 23, 2026
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.CptHolzschnauz commentedon May 27, 2026
I got
Error running remote compact task: stream disconnected before completion: unknown variant
auto, expectedhighororiginalat line 1 column 233067on Mac Visual Studio Code
Wolbyworld commentedon May 28, 2026
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.
AhmedRMIT commentedon Jun 1, 2026
This worked for me:
etraut-openai commentedon Jun 29, 2026
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.