Compaction/Autocompaction fails

Resolved 💬 10 comments Opened Apr 12, 2026 by alanxchen85 Closed Jun 29, 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.409.20454 (1462)

What subscription do you have?

pro

What platform is your computer?

Darwin 25.3.0 arm64 arm

What issue are you seeing?

<img width="1102" height="753" alt="Image" src="https://github.com/user-attachments/assets/3dcae9c3-59f4-4ba9-a75e-9f203531f0df" />

autocompaction gets stuck at this and sends error: Error running remote compact task: stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses/compact)

What steps can reproduce the bug?

Uploaded thread: 019d7927-56b7-7110-99a9-05daa49544de

in this thread max context is 760k, also happens at 1mm

This is not consistent. sometimes happens sometimes doesn't. sometimes if you keep prompting it you can even get it going again.

What is the expected behavior?

finish autocompaction

Additional information

Bug has been around for a while

View original on GitHub ↗

10 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #17392
  • #17335

Powered by Codex Action

lasertiger · 3 months ago

autocompact fails for me too: 019db1fd-7d09-7370-bea2-7e518769131e and shows ■ Error running remote compact task: stream disconnected before completion: error sending request for url (https://api.openai.com/v1/responses/compact)
no fix? how to fix?

infiloop2 · 2 months ago

+1, almost consistently failing for me starting today

alanxchen85 · 2 months ago

this is making the 5.5 update completely unuasble, especially given that 5.5 only is 258k tokens right now even with settings to 400k. autocompaction gets stuck -> copy thread id for a new session to resume, one turn it its autocompaction again. completely unusable right now. @etraut-openai pls fix thnx!

alanxchen85 · 2 months ago

Additional live occurrence on 2026-04-24:

This still happens during real coding work. The failure mode is not just slow compaction; the thread gets stuck in the autocompaction transition and needs manual steering / additional prompts to become usable again.

Observed today:

  • Thread was mid-task on a multi-file code/debugging fix.
  • Autocompaction interrupted the task.
  • The Codex app thread became stuck enough that Alan had to continue through the CLI instead of the Codex app.
  • After prompting again from CLI, Codex resumed with a compacted summary, but the active control flow had been disrupted.
  • The summary preserved facts like changed files, tests run, root cause, and next step, but the thread no longer continued cleanly from the pending action.
  • User had to ask meta questions to re-establish whether the session was unstuck.

So there seem to be two related failure surfaces:

  1. The remote compact request can fail/stall with stream disconnected before completion.
  2. Even when the session becomes promptable again, the transition can leave the agent operationally “stuck” until the user manually reorients it, and in this case the practical workaround was switching out of the Codex app to the CLI.

Expected behavior:

  • If remote compaction fails, return control with a clear recoverable error and do not leave the thread in a half-compacted state.
  • If compaction succeeds after retry/recovery, preserve the active task continuation explicitly: latest user intent, immediate next action, pending blocker/tool step, and whether injected workspace/session instructions are informational or should supersede the active task.

A useful diagnostic would be exposing whether the failure happened in:

  • upload/sync of thread state
  • remote /backend-api/codex/responses/compact
  • streaming compact response
  • local persistence of compacted summary
  • app state transition back to interactive mode
alanxchen85 · 2 months ago

To be clear, after testing, this is not autocompaction failing, this is compaction failing in general. I get this error when invoking compaction manually (now that it's available) as well!

hchafiatheal · 2 months ago

Also having same issue, compaction fails in codex app, but not in cli, not sure why @etraut-openai keeps removing the app label from these issues, where clearly it is a codex app issue.

lasertiger · 2 months ago

It happens in the CLI for me only. Perhaps it's different for you.

On Fri, Apr 24, 2026, 12:39 p.m. hchafiatheal @.***>
wrote:

hchafiatheal left a comment (openai/codex#17508) <https://github.com/openai/codex/issues/17508#issuecomment-4314778794> Also having same issue, compaction fails in codex app, but not in cli, not sure why @etraut-openai <https://github.com/etraut-openai> keeps removing the app label from these issues, where clearly it is a codex app issue. — Reply to this email directly, view it on GitHub <https://github.com/openai/codex/issues/17508#issuecomment-4314778794>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAIXWKKUEX5OUULNEKOVSPT4XOKDDAVCNFSM6AAAAACXVLP2PSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DGMJUG43TQNZZGQ> . Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS <https://github.com/notifications/mobile/ios/AAIXWKI6H44OZ6Y2GNFO4234XOKDDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMZRGQ3TOOBXHE2KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJKTGN5XXIZLSL5UW64Y> and Android <https://github.com/notifications/mobile/android/AAIXWKJ75YOIV3AQ3VFI6L34XOKDDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMZRGQ3TOOBXHE2KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>. Download it today! You are receiving this because you commented.Message ID: @.***>
psaul20 · 2 months ago

Getting the same issue - 019dea5d-63bc-7a52-acf0-48000ae08f95

etraut-openai contributor · 21 days ago

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.