Codex doesnt auto compact its context with gpt 5.5 xhigh
Resolved 💬 8 comments Opened May 13, 2026 by JavierPiedra Closed Jun 29, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What version of the Codex App are you using (From “About Codex” dialog)?
Codex 26.506.31421
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.3.0 arm64 arm
What issue are you seeing?
Codex is not compacting its context
019e1c4e-d8ce-7292-b32a-e9b0080a5be1
What steps can reproduce the bug?
Just fill the conversation with gpt 5.5 xh until its time for codex to auto compact. it says is doing but it never reaches the end.
Sometimes is fix sending more and more messages
What is the expected behavior?
_No response_
Additional information
_No response_
8 Comments
From a quick read of the compaction path, the symptom "auto-compact starts but never reaches the end" lines up with two likely failure modes — would be useful for the team to disambiguate by rollout id (
019e1c4e-d8ce-7292-b32a-e9b0080a5be1):codex-rs/core/src/compact_remote.rs::run_remote_compact_task_inner_implissuescompact_conversation_history(...)against the compact endpoint andawaits the full reply beforereplace_compacted_historyruns. If that call drops mid-stream (SSE disconnect, transient 5xx swallowed by retry, slow server), the UI stays in the "compacting…" state becauseemit_turn_item_completedis only reached onOk(...). There are several recent reports of"Error running remote compact task: stream disconnected before completion"against the same endpoint (e.g. #22449, #22348, #22107) —gpt 5.5 xhighwould be more sensitive to this since its compact summaries are typically larger.ContextWindowExceeded. If the same provider lands the user on the inline (non-remote) path for some reason — or the remote path fails over —codex-rs/core/src/compact.rs::run_compact_task_inner_implremoves the oldest history item and retries on everyContextWindowExceeded, withretries = 0reset each time. When the post-trim prompt still overflows on a very large session, this loop walks history down toturn_input_len == 1before finally erroring out. That isn't strictly infinite, but on a multi-MB context it can take many seconds of "compacting…" UI with no externally visible progress.Quick diagnostic that would narrow this down without a full repro: when it gets stuck, does the TUI ever surface
"Error running remote compact task"(failure mode 1) or does it stay quiet indefinitely until the user sends another message (failure mode 2 / 1 with a very long stream)?If it's mode 1, the fix probably lives in compact-endpoint retry/timeout handling rather than the model. If it's mode 2, the inline retry loop could emit a progress event per history trim so the user sees forward progress instead of a frozen state.
(For context: I've been digging into this area because of #7808 / context-window mid-turn recovery — happy to help reproduce or surface more data if useful.)
Following up because this looks closely related to #7808 and the earlier overflow auto-compaction attempt in #22141 / revert #22170.
I have a focused local patch that handles the mid-turn
ContextWindowExceededcase by running one recovery compaction and retrying the turn from the outerrun_turnloop. It also addresses the review concerns from #22141:I do not want to send an unsolicited PR against the contribution policy. Would the Codex team be open to inviting a PR for this recovery path, or would you prefer to keep the patch details in the issue so the team can implement internally?
Happy to adapt the shape if there is a preferred direction.
I just ran into this in codex-cli 0.130.0, right after I wrote a really long prompt.
<img width="928" height="100" alt="Image" src="https://github.com/user-attachments/assets/ad907994-e125-4a9d-8e00-e05fafbccf51" />
And thanks to #7808 I can't resume.
Uploaded feedback about multiple chats today using MacOS
Codex -> Submit feedback. Blocking issueThis has been happening for many weeks now! GPT 5.5 xhigh. Auto-compacting an errors all the time, seemingly because it doesn't have enough context left to autocompact without an error.
I am seeing the same class of failure repeatedly on macOS/Codex Desktop, with
gpt-5.5andreasoning_effort=xhigh.Environment:
26.602.30954(CFBundleVersion=3575)codex-cli 0.137.0-alpha.426.5.1(25F80)gpt-5.5xhighUser-visible error:
This is now happening across multiple long threads. Once a thread approaches the context limit and Codex tries to run the remote pre-sampling compact, the compact request fails and the thread effectively cannot continue.
Sanitized local evidence from
logs_2.sqliteacross recent failures:Additional observation: basic reachability to the endpoint host appears fine from the same machine. A direct unauthenticated
GETprobe tohttps://chatgpt.com/backend-api/codex/responses/compactreturns405 Method Not Allowedquickly, so this does not look like a complete local network/DNS/TLS block. The failure appears specific to the long-runningPOST /responses/compactstreaming path near the context limit.Privacy note: I am not posting raw transcripts, local paths, or project contents publicly. I can submit private feedback with session/log upload separately if helpful.
I submitted in-app Codex feedback with current session logs included.
Feedback ID:
019e98bb-4410-7623-82c5-fc91d8757210This looks related to this issue, but it may be a broader transport/streaming failure class rather than a compaction-only bug. The same environment is seeing both variants:
and the newer user-visible non-compact/regular stream variant:
Environment remains:
26.602.30954, bundle build35750.137.0-alpha.426.5.1build25F80arm64gpt-5.5xhighMy current hypothesis is that compact is the most sensitive path because it involves a large/long-running request near context pressure, but the
error decoding response bodyvariant suggests the root cause may sit in the shared response streaming/transport layer. Please correlate the uploaded feedback logs with this issue if useful.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.