codex - 💡(How to fix) Fix Codex Desktop remote compaction repeatedly fails on long sessions, breaking /goal workflows

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

The repeated local log error is: compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) 13 ok · 1 idle · 0 warn · 0 fail ok compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact) Request failed method=POST url=https://chatgpt.com/backend-api/codex/responses/compact error=error sending request

Root Cause

Remote compaction repeatedly fails across multiple Codex Desktop threads when sessions become long-running / large-context. This makes /goal and long standing Codex workflows effectively unusable, because the thread reaches compaction and then dies instead of compacting/resuming normally.

Fix Action

Fix / Workaround

Local mitigations attempted

Code Example

compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

---

13 ok · 1 idle · 0 warn · 0 fail ok

---

2026-05-26T08:39:15+02:00 thread=019e5f7f-2a42-7491-94b1-3a3b65c55600
last_api_response_total_tokens=237047
all_history_items_model_visible_bytes=804876
estimated_tokens_of_items_added_since_last_successful_api_response=1466
failing_compaction_request_model_visible_bytes=826350
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

2026-05-26T08:36:50+02:00 thread=019e5b53-d4cc-7183-9a21-3a0544595302
last_api_response_total_tokens=234680
all_history_items_model_visible_bytes=1010829
estimated_tokens_of_items_added_since_last_successful_api_response=1428
failing_compaction_request_model_visible_bytes=1032303
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

2026-05-26T08:32:34+02:00 thread=019e62df-52ae-74f3-b54f-9cb040ef6f92
last_api_response_total_tokens=235538
all_history_items_model_visible_bytes=681186
estimated_tokens_of_items_added_since_last_successful_api_response=12634
failing_compaction_request_model_visible_bytes=702660
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

---

api.path="responses/compact"
auth_header_attached=true
duration_ms=67288
connected to 172.64.155.209:443
Request failed method=POST url=https://chatgpt.com/backend-api/codex/responses/compact error=error sending request
RAW_BUFFERClick to expand / collapse

What version of the Codex App are you using?

  • Windows desktop package path: OpenAI.Codex_26.519.5221.0_x64__2p2nqsd0c76g0
  • Crashpad annotation seen in local process args: 26.519.41501
  • Codex CLI/runtime: codex-cli 0.133.0-alpha.1 / windows-x86_64

What subscription do you have?

ChatGPT-authenticated Codex Desktop session. Plan not included in this redacted local report.

What platform is your computer?

Windows, Codex Desktop app.

What issue are you seeing?

Remote compaction repeatedly fails across multiple Codex Desktop threads when sessions become long-running / large-context. This makes /goal and long standing Codex workflows effectively unusable, because the thread reaches compaction and then dies instead of compacting/resuming normally.

The repeated local log error is:

compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

This does not appear to be a local auth/reachability issue. Running codex doctor --summary against the real user profile after cleanup reports:

13 ok · 1 idle · 0 warn · 0 fail ok

Doctor also reports auth configured, WebSocket connected with HTTP 101, and provider endpoints reachable over HTTP.

What steps can reproduce the bug?

  1. Use Codex Desktop on Windows with gpt-5.5 and high reasoning.
  2. Start or resume a long-running task such as a /goal workflow, Git hygiene audit, or large structured extraction job.
  3. Continue until the session reaches the remote compaction path.
  4. Codex POSTs to /backend-api/codex/responses/compact.
  5. The request connects and auth is attached, but compaction fails with stream disconnected before completion.

Local evidence

Recent compact failures from logs_2.sqlite, redacted to thread IDs and request-size diagnostics only:

2026-05-26T08:39:15+02:00 thread=019e5f7f-2a42-7491-94b1-3a3b65c55600
last_api_response_total_tokens=237047
all_history_items_model_visible_bytes=804876
estimated_tokens_of_items_added_since_last_successful_api_response=1466
failing_compaction_request_model_visible_bytes=826350
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

2026-05-26T08:36:50+02:00 thread=019e5b53-d4cc-7183-9a21-3a0544595302
last_api_response_total_tokens=234680
all_history_items_model_visible_bytes=1010829
estimated_tokens_of_items_added_since_last_successful_api_response=1428
failing_compaction_request_model_visible_bytes=1032303
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

2026-05-26T08:32:34+02:00 thread=019e62df-52ae-74f3-b54f-9cb040ef6f92
last_api_response_total_tokens=235538
all_history_items_model_visible_bytes=681186
estimated_tokens_of_items_added_since_last_successful_api_response=12634
failing_compaction_request_model_visible_bytes=702660
compact_error=stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

A detailed trace for one failure shows:

api.path="responses/compact"
auth_header_attached=true
duration_ms=67288
connected to 172.64.155.209:443
Request failed method=POST url=https://chatgpt.com/backend-api/codex/responses/compact error=error sending request

Local mitigations attempted

  • Archived failed/giant local active thread rows in state_5.sqlite.
  • Stopped stale per-thread codex.exe app-server --listen stdio:// workers that were reactivating failed rows.
  • Reduced active local session load from hundreds of millions of tracked tokens to ~26M, with no active row above 1M tokens.
  • Verified no new compact errors immediately after cleanup.
  • Tried enabling remote_compaction_v2, but it caused Codex Desktop to crash on reload, so it was disabled and removed from config.

Expected behavior

Remote compaction should complete reliably for long-running Desktop sessions, or Codex should gracefully fall back / retry / trim locally instead of making /goal workflows unusable.

Additional information

This appears similar to prior stream disconnected before completion reports, but the impact here is specifically that Codex Desktop long-running /goal workflows cannot be used reliably even when local auth, websocket, and reachability checks pass.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Remote compaction should complete reliably for long-running Desktop sessions, or Codex should gracefully fall back / retry / trim locally instead of making /goal workflows unusable.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop remote compaction repeatedly fails on long sessions, breaking /goal workflows