Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
Resolved 💬 21 comments Opened Mar 7, 2026 by edwardsanchez Closed Apr 26, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.305.950 (863)
What subscription do you have?
Pro
What platform is your computer?
macOS
What issue are you seeing?
Automatically compacting context
Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
019cc753-b0ce-7a13-8543-c7ea965a3c35
What steps can reproduce the bug?
Just get to a point where it needs to be compact. Usually a few hours after it does work, and then you basically lose everything you did up to that point because the context is lost.
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 have been getting this issue for the last few days. I've reported multiple times in the feedback in the codex mac app. The latest one has reference 019d1fff-5705-7092-9468-30adf07dfbdc
me too
me too
Adding another reproducible case from macOS + VS Code Codex.
I see the same auto-compact failure:
Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)
Important additional detail:
after the compact-related hang, the UI can lose the latest visible turns, while those turns are still present in ~/.codex/sessions/...jsonl. So there may be a second bug in thread restore/history sync after compact failure.
Related report:
This is affecting long-running threads and makes them unreliable to continue.
Adding another Codex Desktop repro with local log evidence.
Environment
Observed behavior
Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)Concrete repro artifact
019d495f-c6c7-7240-9bd3-d32fe646277b019d7832-87a4-7c71-89da-7024af8e32feRelevant local log details
attempt=460622 mslast_api_response_total_tokens=647339all_history_items_model_visible_bytes=2699502failing_compaction_request_model_visible_bytes=2714195POST /backend-api/codex/responses/compacterror sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)This looks worse than a transient network blip because the failure leaves the session in a bad state instead of recovering cleanly or surfacing a usable fallback.
Is there a solution?or a way to avoid it?
me too
me too
codex is not usable at this point with getting these error all the time !!
It seems its related with vpn, the vpn is not stable.
I don't have VPN but have private cloud relay from iCloud. Which who knows maybe that's just a VPN from Apple. Doesn't cause me issues anywhere else though.
我解决了,通过在config.toml里面设置好压缩阈值(我采用的是240000,不要设置太大,否则压缩压力越大越容易失败),以及延长默认压缩时间(我采用的是60000ms)外加重试次数(我采用的是2次),这样下来我这个问题到现在为止还没发生过,希望能帮到你
How to set compaction threshold?
默认压缩阈值是245000,少5000能有那么大效果?
可能是我默认压缩时间增加了,我之前写错了,我压缩时间增加到了1200000ms,即最大压缩20分钟一次,失败的话再重试一次。大大减少了压缩失败的可能。其实20分钟夸张了,10分钟也差不多了
手动编辑config.toml,里面设置如下:
model_auto_compact_token_limit = 240000
stream_idle_timeout_ms = 1200000
stream_max_retries = 2
这样设置下来我的压缩错误大大减少
感谢,我试试,这两天一直被这个问题困扰
Still having issues. honestly most frustrating thing ever. this is why i'm still subscribed to claude, no issues there. for this i leave codex for overnight and stops the workflow, lost hours. recovery is manual - spam /fork into local and run 10 sessions in parallel on compaction in hopes that one of them will compact. such a massive waste of time, pls fix!
Same! Shit, I was expecting CodeX to work overnight, but it turned out this error and I am fixing it at 1:30 am !!!
Решение ошибки Codex:
remote compact task: stream disconnectedСтолкнулся с ошибкой в Codex:
Сначала казалось, что проблема в самом Codex или в
config.toml, но в моём случае причина оказалась в сети.Codex CLI не использовал системный Windows Proxy, хотя в Windows был включён SOCKS-прокси:
Из-за этого браузер и часть приложений могли нормально работать через прокси/VPN, а сам Codex CLI шёл напрямую. В результате
codex doctorпоказывал ошибки:При этом после явного указания proxy через переменные окружения всё заработало:
websocketподключился,reachabilityстал успешным, итогcodex doctorстал0 warn · 0 fail ok.Что помогло
В PowerShell нужно указать прокси для Codex через переменные окружения:
Если после этого
codex doctorпоказывает:значит проблема была именно в том, что Codex не использовал ваш локальный прокси.
Как закрепить навсегда
После этого нужно закрыть PowerShell, открыть заново и проверить:
Важно
127.0.0.1:10808— это мой локальный SOCKS-порт. У вас он может быть другим. Например, в некоторых клиентах это может быть1080,10808,7890,7897,10809и т.д.Проверить можно так:
Нормальный результат — быстрый ответ вроде:
Это не ошибка сети. Это значит, что endpoint доступен, просто
curlделаетGET, а Codex используетPOST.Дополнительно
Для снижения ошибок compact я также добавил в:
такие настройки:
Но в моём случае ключевым решением оказался именно proxy через переменные окружения, а не только настройки compact.