Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.
Resolved 💬 11 comments Opened Apr 16, 2026 by evilfps 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)?
26.409.20454
What subscription do you have?
Pro
What platform is your computer?
Darwin 25.4.0 arm64 arm
What issue are you seeing?
<img width="898" height="447" alt="Image" src="https://github.com/user-attachments/assets/15ee6aac-900a-415e-82e0-54d251f29983" />
Long task suddenly says “chat ran out of room, start new thread or clear hist.” Then whole chat dies, no more output. Stops mid-task. Never happened this often, even on 30-day-old chats. Thanks for checking! Same happened with 5.4 and 5.3 codex.
What steps can reproduce the bug?
Uploaded thread: 019d9134-df50-7423-b31f-7cb056e14f9a
What is the expected behavior?
It never used to happen that I run of out of room in chats but it happened thrice in a day.
Additional information
_No response_
11 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
+1
happened for me
<img width="832" height="77" alt="Image" src="https://github.com/user-attachments/assets/8ad8c8a4-67f0-4508-b353-99e0743fcc7e" />
Happend to me in two threads over this weekend with latest version.
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" } }Found a solution, issue is likely due to the compaction limits. Edit the config to auto compact limit at 160K and context window to 250K the auto compact limit is to high due to 5.4 having a higher context window. Edit it manually, and it should work.
@augard , @Ghxst
I am seeing what looks like the same issue in Codex Desktop, across multiple workspaces, not just one long thread.
Sanitized environment:
26.519.415010.133.0-alpha.1gpt-5.5Observed behavior:
Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.Additional report (template format)
What version of the Codex App are you using (From “About Codex” dialog)?
openai/codexdesktop/CLI session.What version of the Codex CLI is running?
What subscription do you have?
What platform is your computer?
Which model were you using?
gpt-5.3-codex-spark xhighWhat terminal emulator and version are you using (if applicable)?
What issue are you seeing?
Reconnecting /2Error running remote compact task: stream disconnected before completion: Incomplete response returned, reason: max_output_tokensCodex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.What steps can reproduce the bug?
gpt-5.3-codex-spark xhigh.Context compacted/Reconnecting /2loops and stalls.Exact examples from this session
019eab5f-ebaf-7873-b407-1995e54516fdContext automatically compactedandReconnecting /2What is the expected behavior?
Additional context
context_length_exceededclass around compaction), but I’m explicitly confirming thatgpt-5.3-codex-spark xhighreproduces it.Follow-up with exact local context (from my machine)
I’m adding concrete template values I could collect locally:
What version of the Codex CLI is running?
codex --version:codex-cli 0.139.0(fromC:\Users\User\AppData\Roaming\npm\node_modules\@openai\codex\package.json)What subscription do you have?
Which model were you using?
model = "gpt-5.3-codex-spark"andmodel_reasoning_effort = "xhigh"What platform is your computer?
Microsoft Windows 11 Home 10.0.26200(x64 / 64-bit processor)What terminal emulator and version are you using?
If you want, I can do one more pass to lock exact Codex App build string if you can share how you launch/update the desktop bundle.
Suggested fix:
Commit: https://github.com/openai/codex/commit/257acee4
<img width="1449" height="295" alt="Image" src="https://github.com/user-attachments/assets/5c3e48f5-f98d-448f-b753-daad041e477b" />
I can also reproduce this exact error with a Spark variant.
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 is with
gpt-5.3-codex-sparkand appears to match the same remote compaction overflow failure mode, so likely a Spark-specific compaction path issue rather than user input alone.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.