Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact
Open 💬 12 comments Opened Mar 18, 2026 by briantcl1992
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of Codex CLI is running?
0.115
What subscription do you have?
chatgpt Pro
Which model were you using?
gpt-5.4
What platform is your computer?
linux
What terminal emulator and version are you using (if applicable)?
linux terminal
What issue are you seeing?
always running into Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) when there is still context left.
What steps can reproduce the bug?
Uploaded thread: 019cdbad-25cb-7d00-a1bd-13cc5b058058
What is the expected behavior?
_No response_
Additional information
_No response_
12 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
+1
Turned off my wifi anf turned it on again. Also set model to low and fast and its olved the issue
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...
You can also run the
/compactcommand manually and then, ask the agent to continue. But still, it interferes with long-running agents.i turned off and on VPN and the problem is solved
i switch model from gpt5.4 to 5.3codex solved
hey, this is a relatively new occurrence.
I hope you fix it.
thread ID 019dd23f-4f50-73d0-9f18-bb1101f6c3ae
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.
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.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....
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.