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 #15046
Thanks! Yeah there is this trick that can unblock this error but I want to run my sessions for really long (hours of long running task) with continued context and this error interrupts it and make it impossible...
Reproducing on Codex CLI v0.125.0, macOS (Apple Silicon), ChatGPT Pro subscription, model gpt-5.5.
Symptom
Error running remote compact task: stream disconnected before completion:
error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
Failure happens consistently at the 5-minute mark (300s), which exactly matches the documented default of stream_idle_timeout_ms = 300000 for SSE streams. The compact endpoint stays silent during server-side compute on long sessions, so the client-side idle timeout fires before any response bytes arrive.
No working override path exists for ChatGPT subscription users
[model_providers.openai] block is rejected — built-in provider IDs (openai, ollama, lmstudio) are reserved per the advanced config docs.
Top-level stream_idle_timeout_ms is documented as accepted in older releases but ignored in current ones.
Defining a custom provider (e.g. [model_providers.my-openai]) requires env_key = "OPENAI_API_KEY". ChatGPT subscription users only have auth.json from codex login — no API key, so this path is blocked.
openai_base_url only changes the base URL, not the timeout.
Net result: a config knob exists, the default is the exact value causing the bug, but the knob is unreachable for the largest segment of paying users. Existing workarounds in this thread (toggle VPN / switch model / pre-emptive /compact) are all narrow side-effects that don't address the root cause.
Things tried that did NOT help (network-layer fixes — confirming the bug is HTTP-level, not network)
macOS net.inet.tcp.always_keepalive=1, keepidle=60s, keepintvl=30s (persisted via LaunchDaemon)
All confirmed effective for SSH long-idle and other TCP-level idle scenarios; irrelevant to this bug as expected — TCP keepalive packets aren't visible to the HTTP-stream idle policy at the chatgpt.com edge.
Asks (any one would unblock)
Allow stream_idle_timeout_ms override for the built-in openai provider — either via a top-level key (openai_stream_idle_timeout_ms?) symmetric to openai_base_url, or by accepting non-conflicting fields like timeouts inside [model_providers.openai].
Server-side SSE heartbeat from /backend-api/codex/responses/compact during compute, so the stream is never silent for >300s.
Client-side: bump the default for the compact code path specifically. Compact computation reasonably takes minutes on long sessions; 5-minute default is too aggressive for this endpoint.
Happy to provide upload thread IDs from any reproduction if useful.
I am still facing this error... have been building some tools to help me rescue this programatically but those tools are brittle... Any update on this team? it is really frustrating to deal with this compaction error....
Reacted by Mohammadreza Najafipour, Aliaksandr-Hrynevich, Martin, Xinpei Kou, scc, NovaHe and Ighor July
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 Mar 18, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
maxiloEmmmm commentedon Mar 25, 2026
+1
smyja commentedon Apr 11, 2026
Turned off my wifi anf turned it on again. Also set model to low and fast and its olved the issue
briantcl1992 commentedon Apr 11, 2026
Thanks! Yeah there is this trick that can unblock this error but I want to run my sessions for really long (hours of long running task) with continued context and this error interrupts it and make it impossible...
Alavi1412 commentedon Apr 15, 2026
You can also run the
/compactcommand manually and then, ask the agent to continue. But still, it interferes with long-running agents.chenzhiy2001 commentedon Apr 19, 2026
i turned off and on VPN and the problem is solved
KiteBA89 commentedon Apr 26, 2026
i switch model from gpt5.4 to 5.3codex solved
ibabencu commentedon Apr 28, 2026
hey, this is a relatively new occurrence.
I hope you fix it.
thread ID 019dd23f-4f50-73d0-9f18-bb1101f6c3ae
Akagilnc commentedon May 2, 2026
Reproducing on Codex CLI v0.125.0, macOS (Apple Silicon), ChatGPT Pro subscription, model
gpt-5.5.Symptom
Failure happens consistently at the 5-minute mark (300s), which exactly matches the documented default of
stream_idle_timeout_ms = 300000for SSE streams. The compact endpoint stays silent during server-side compute on long sessions, so the client-side idle timeout fires before any response bytes arrive.No working override path exists for ChatGPT subscription users
[model_providers.openai]block is rejected — built-in provider IDs (openai,ollama,lmstudio) are reserved per the advanced config docs.stream_idle_timeout_msis documented as accepted in older releases but ignored in current ones.[model_providers.my-openai]) requiresenv_key = "OPENAI_API_KEY". ChatGPT subscription users only haveauth.jsonfromcodex login— no API key, so this path is blocked.openai_base_urlonly changes the base URL, not the timeout.Net result: a config knob exists, the default is the exact value causing the bug, but the knob is unreachable for the largest segment of paying users. Existing workarounds in this thread (toggle VPN / switch model / pre-emptive
/compact) are all narrow side-effects that don't address the root cause.Things tried that did NOT help (network-layer fixes — confirming the bug is HTTP-level, not network)
net.inet.tcp.always_keepalive=1,keepidle=60s,keepintvl=30s(persisted via LaunchDaemon)net.ipv4.tcp_keepalive_time=60, BBR + fq qdisc,tcp_rmem/wmemceiling raised to 64 MBAsks (any one would unblock)
stream_idle_timeout_msoverride for the built-inopenaiprovider — either via a top-level key (openai_stream_idle_timeout_ms?) symmetric toopenai_base_url, or by accepting non-conflicting fields like timeouts inside[model_providers.openai]./backend-api/codex/responses/compactduring compute, so the stream is never silent for >300s.Happy to provide upload thread IDs from any reproduction if useful.
endoibiza commentedon May 16, 2026
I’m also seeing this in Codex.
Error:
Automatically compacting contextError running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)Environment:
0.131.0-alpha.9Impact:
Compaction fails when the conversation gets large, leaving the session hard or impossible to continue without starting a fresh thread.
Expected:
Automatic context compaction should complete successfully, or retry/fallback gracefully without breaking the session.
Actual:
The remote
/backend-api/codex/responses/compactrequest disconnects before completion.briantcl1992 commentedon May 16, 2026
I am still facing this error... have been building some tools to help me rescue this programatically but those tools are brittle... Any update on this team? it is really frustrating to deal with this compaction error....
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.