Codex remote compact ran out of room in the context window
Codex says a remote compact task ran out of room in the model's context window? Preserve files and instructions before starting a fresh thread.
Quick answer
If Codex shows Error running remote compact task: Codex ran out of room in the model's context window, the attempt to shorten the thread did not complete. The wording points to a context-window limit, but users have also reported it in unexpectedly short sessions. It does not say your account allowance is empty. Save the task's current files, diff, and key instructions before changing threads.
Keep the work, then continue
- Inspect what the agent already changed or submitted. A failed compaction does not undo file edits or other actions.
- Copy a short handoff: goal, current result, unfinished steps, constraints, and exact file paths. Keep a link to the original thread if available.
- The error itself offers starting a new thread or clearing earlier history. Save the handoff before either action. Try the product's offered retry once if the thread still responds. If it repeats, start a new thread with the handoff and relevant files. Verify the new thread understood them before letting it act.
If the task disconnected rather than failing during compaction, use the stream-disconnect guide. For a matching broader incident, check Codex status.
What OpenAI documents
OpenAI's compaction guide explains that compaction carries forward key state using fewer tokens. Its Codex prompting guide notes that the input sent to compaction must itself fit the model's context window. These documents explain the mechanism, but do not establish a guaranteed recovery method for this exact Codex UI error.
What users reported
In openai/codex issue #44456, a VS Code user reported automatic compaction failing at a full context window and the thread becoming unusable. Another issue #37476 says the same message appeared even in a fresh session. The message therefore cannot be explained by thread length alone. A new thread may get the job moving, but it does not inherit every earlier instruction or pending action automatically. That is why the file and handoff check comes first.
Frequently Asked Questions
Will retrying compaction erase files?
The message does not say files were erased. Inspect the workspace and any external actions before retrying. Do not assume a task failed atomically.
Is this Selected model is at capacity?
No. That is a separate capacity message. A remote compact can also fail for other reasons; retain the exact text.
Can I paste the entire old thread into the new one?
That may reproduce the size problem. Move only the necessary instructions, current artifacts, and a concise status summary.
Sources
- Official: OpenAI compaction guide; Codex prompting guide.
- User reports: VS Code context-window case; case reporting the same message in a fresh session.