Codex app automatic context compaction fails with context_length_exceeded
What version of the Codex App are you using (From “About Codex” dialog)?
26.519.31651 (CFBundleVersion 3017)
What subscription do you have?
Not included in this public report.
Which model were you using?
GPT-5 Codex in the Codex desktop app.
What platform is your computer?
macOS 26.5 (Build 25F71), arm64
What issue are you seeing?
The Codex desktop app repeatedly attempted automatic thread/context compaction, but every automatic compact attempt failed with context_length_exceeded.
The error shown in the thread was:
Error running remote compact task: { "error": { "message": "Your input exceeds the context window of this model. Please adjust your input and try again.", "type": "invalid_request_error", "param": "input", "code": "context_length_exceeded" } }
This was not caused by a user-submitted oversized message. It was triggered by the app's automatic context compaction flow. The UI showed multiple automatic compaction markers, each followed by the same remote compact task error.
What steps can reproduce the bug?
- Work in a long Codex desktop app thread until automatic context compaction is triggered.
- Let Codex attempt automatic context compaction.
- Observe that the app-generated remote compact request fails with
context_length_exceeded. - The app retries/marks compaction again, but the same failure repeats.
What is the expected behavior?
Automatic compaction should safely chunk, trim, or progressively summarize the thread so the compact request itself never exceeds the target model's context window. The user should be able to continue work after compaction.
What is the actual behavior?
The automatic compact task appears to build an internal compact request that is too large for the model context window, causing context_length_exceeded. Work in the thread is effectively blocked because the app cannot complete automatic compaction.
Additional information
The UI's remaining-context indicator did not make this failure actionable for the user. The user did not submit a large message at the time of failure; the oversized input was the app-generated compact payload.
7 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I am leaving this issue open for now rather than closing it as a duplicate, because the current user-facing problem is not only that compaction fails, but that there is no in-thread recovery path after the automatic compact task repeatedly fails.
The practical impact is that ongoing work is blocked even though the failure was caused by the app-generated compact payload, not by a user-submitted oversized message.
If this is the same root cause as #23589, the needed resolution should still include a user recovery path, for example safe chunked/progressive compaction, a fallback handoff summary, or another way to continue the thread without requiring the user to manually reconstruct context.
I can confirm the same failure mode on Windows Codex Desktop as well.
In my case two existing local threads hit the same error during automatic compaction:
The user prompt itself was small, but Codex Desktop attempted an automatic remote compact task and failed with:
context_length_exceededAfter that, continuing the original thread was effectively blocked. The local thread data was still present and exportable, so this was not data loss, but the app had no usable recovery path inside the same thread.
The practical workaround was to archive the overloaded thread as source/old and create a new continuation thread with a short handoff prompt plus links to the old thread/export. That works, but it is manual and error-prone.
So I agree this needs a fallback path: chunked/progressive compaction, a smaller emergency summary, or a safe “continue in new thread from generated brief” flow when automatic compaction cannot fit into the model context.
Same issue on Linux. connected with Context Length Exceeded issue, both triggered by _compact_. most recent version. never seen before. started to trigger today in different CLI sessions. nothing helps
I’m seeing what appears to be the same issue in the Codex VS Code / IDE sidebar on Windows.
Environment:
<img width="1919" height="1023" alt="Image" src="https://github.com/user-attachments/assets/a617f5e6-3116-4b0f-9fd5-954696771cda" />
Observed UI state:
Update as of 2026-06-08: I am currently on Codex 26.602.40724 (Released Jun 6, 2026). Since updating to this build, I have not seen the automatic context compaction failure recur in normal use so far.
I am leaving this issue open for now rather than closing it because I have not seen a maintainer-confirmed fix, a linked closing PR, or documented recovery behavior for already-stuck threads. If maintainers consider this covered by a specific fix/release or want this closed as a duplicate, please point me to the canonical issue/PR and I can close or update accordingly.
Closing as a duplicate of #23589.