Codex session stuck or compacting: what to do
Check active tools, approvals, network retries and compaction before treating a silent turn as stuck. Preserve progress before continuing elsewhere.
Start here
Save your work, then check for pending approvals, tool activity and repeated compaction before starting another turn.
Check what Codex is waiting for
No new text does not identify a single cause. The model may be working, a tool may be running, an approval may be waiting, the network may be retrying, or context compaction may be in progress. Read the visible status and any actual error before interrupting work.
| What you see | Next action |
|---|---|
| A tool or command is still running | Inspect its progress and whether it needs input. |
| Approval or user input requested | Resolve the visible request if appropriate. |
| Compacting context | Allow a normal compaction to finish; watch for completion or an error. |
| Repeated compaction without useful output | Preserve progress and compare a fresh task. |
| Context-window error on every retry | Stop resending the same prompt; prepare a new task with a concise handoff. |
| Stream disconnected or idle timeout | Follow the connection guide. |
When compaction is normal
Compaction makes room in the model’s working context. A TUI change added a visible Compacting context status and timer. Older or different clients may display it differently; the pull request does not establish a shipping version for every client.
An advancing timer measures elapsed time, not guaranteed progress. Do not interrupt ordinary compaction immediately, but do not wait indefinitely just because a clock continues to tick. Look for a completed turn, an error, or a repeated cycle with no output.
If the same context error keeps returning
A Windows desktop report describes repeated context-window failures even for a short follow-up. Another report describes recurring compaction notices without useful progress. These are examples of failed recovery, not evidence that every slow turn is broken.
Before moving work:
- Preserve the last useful answer, current task goal and remaining steps.
- Inspect the project files and Git diff to see what has actually changed.
- Record any running process or external action whose result is uncertain.
- Start a new task in the intended project with that concise handoff.
- Ask the new task to verify the current state before continuing edits or repeating external actions.
Keep the old task available as a record. A new task working normally is a workaround; the original task may remain unresolved.
Compact deliberately when the client supports it
The CLI commands reference documents /compact. Use the command offered by your installed client when you want to reduce active context. Save important requirements first. It is not a guaranteed repair for a session whose compaction requests already fail.
If you need to reopen a CLI session, codex resume and its documented options are covered in the resume guide. Resuming does not remove a context error by itself.
If the cause is still unclear
Save unsent text and note the last visible action and timestamp. Check whether another idle task in the same client can answer a small harmless prompt; the comparison may consume usage. Avoid sending duplicates into the stalled task while it could still be executing.
After saving work and resolving active operations, one normal relaunch can be a useful comparison. If the same failure returns, collect the error rather than cycling through restarts or increasing permissions.
How to tell it worked
The intended task produces a useful response and can continue. A finished timer or a compaction notification alone is insufficient. Record separately whether the original recovered or you continued in a new task.
If reporting the problem, include the client build, OS, exact error, elapsed time, active tool/approval state and fresh-task comparison. Keep credentials and unrelated conversation content out of shared logs. Do not delete session files or databases as a generic hang repair.
This guide is part of our Codex sessions troubleshooting.
Compare another message in the Codex error guide library. First check whether this is a Codex service-side problem → View live Codex status.
Useful Codex tools
Sources
Each source lists what it is used to support. Sources are re-read on the review schedule, not continuously.
Show live context compaction status in the TUI (openai/codex #42319, merged 2026-09-02)
The 'Compacting context' status line with an elapsed timer, that compaction used to be silent until it finished (so silence during compaction on older builds is expected, not proof of a hang), and that an error can replace the status text. This is a merged pull request describing intent; it does not state which version shipped the line.
The exact context-limit sentence and its 'Error running remote compact task:' prefix, that the recovery path itself can fail inside remote compaction with the same error, that the desktop task status reported systemError, and the reporter's own statement that the root cause is not established.
Codex automatic context-compaction failure (openai/codex #40213, closed)
That 'Context automatically compacted' can repeat (~48 times in ~76 minutes) without the session recovering — compaction appearing to succeed is not proof the session recovered. Single reporter, one build; the page states no fix.
The failing sequence 'Error running remote compact task:' -> 'stream disconnected before completion:' -> 'idle timeout waiting for SSE', and the reporter's conclusion that the original WebSocket fault and the remaining remote-compaction failure were separate issues — which is why a compaction failure must not be sent to the stream-disconnected page.
/compact and resume commands.
Related guides
How this page is checked
- Evidence level
- Reported - based on public reports, not reproduced here
- Last reviewed
- 2026-09-22
- Content updated
- 2026-09-22
- Full version scope
- Public desktop reports on Windows and macOS; the locally installed CLI version in one report was not a verified desktop backend version. No universal affected or fixed release is asserted.
- Symptoms indexed
-
- A turn stops producing output and you cannot tell whether the model is still thinking or the client has died
- The client shows 'Compacting context' with an elapsed timer while no reply appears
- A message appears: 'Codex ran out of room in the model's context window. Start a new thread or clear earlier history before retrying.'
- Compaction appears to succeed ('Context automatically compacted') but the session makes no progress
Reviewer note
Reviewed against current official references and original issue reports on 2026-09-22. General diagnostic steps are distinguished from reported outcomes; no cross-platform failure reproduction is claimed.