Codex hangs for 5 minutes before applying patch

Resolved 💬 4 comments Opened Dec 2, 2025 by alborzdev Closed Dec 2, 2025
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.63.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.1-codex-max

What platform is your computer?

Linux 5.15.148-tegra aarch64 aarch64

What issue are you seeing?

Since the release of gpt-5.1-codex (a few weeks ago), I have been running into this hanging issue where anytime codex wants to change code, apply a patch, or anything related to code changes, it will wait exactly 5 minutes before applying those changes and moving on.

Codex is able to read and investigate the codebase just fine, and answer questions regarding it. But as soon as I ask it to implement the changes, it will always just wait 5 minutes before doing anything. I notice that after 20 seconds of asking it to do a code change, if I hit escape, I will see the code changes diff:

• Edited vss/processing/inference_queue.py (+21 -0)
512 try:
522 + logger.info(
523 + "✅ Postprocess done | stream=%s depth=%d duration=%.2fs",
524 + task.request.stream_id,
525 + self._postprocess_queue.qsize(),
526 + duration,
527 + )
528 except asyncio.CancelledError:
⋮
716 self._postprocess_queue.put_nowait(PostprocessTask(request=request, result=result))
717 + depth = self._postprocess_queue.qsize()
718 + if depth > 50:
719 + logger.warning(
720 + "📥 Postprocess backlog growing | depth=%d stream=%s",
721 + depth,
722 + request.stream_id,
723 + )
724 except Exception as exc:

■ Conversation interrupted - tell the model what to do differently. Something went wrong? Hit /feedback to report the issue.

It's like it has the change ready, but always just waits 5 minutes before doing it.

This happens with every single model, it's been happening since ~v0.58 of codex, have already tried giving it full access, used the --sandbox command. No idea what's causing this hang, it's very time consuming to code with Codex now.

What steps can reproduce the bug?

Anytime I ask Codex to implement a code change, it will wait 5 minutes.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

4 Comments

github-actions[bot] contributor · 8 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #7265
  • #7109
  • #7278

Powered by Codex Action

alborzdev · 8 months ago

UPDATE: I added the debug level logs for codex, tailed them when asking codex for a code change. Gave these logs to chatgpt to interpret and give the key points as to what's happening, it's clear what's going wrong now:

Below is a clean excerpt from ~/.codex/log/codex-tui.log showing the behavior.
The pattern is:

The model finishes generating the patch.

For ~5 minutes, the CLI repeatedly logs starting new connection once per minute.

After ~5 minutes, a sequence of ghost snapshot log lines appear.

Immediately after that, Codex finally approves and executes the apply_patch tool call.

Relevant log excerpt (timestamps included):
2025-12-02T16:53:46.393288Z INFO event.name="codex.sse_event" event.kind=response.completed
2025-12-02T16:53:46.397958Z DEBUG pooling idle connection for ("https", chatgpt.com)

~5 minutes of repeated connection attempts, once per minute:

2025-12-02T16:54:08.864934Z DEBUG starting new connection: https://chatgpt.com/
2025-12-02T16:55:08.871962Z DEBUG starting new connection: https://chatgpt.com/
2025-12-02T16:56:08.867163Z DEBUG starting new connection: https://chatgpt.com/
2025-12-02T16:57:08.864539Z DEBUG starting new connection: https://chatgpt.com/
2025-12-02T16:58:08.861910Z DEBUG starting new connection: https://chatgpt.com/

After ~5 minutes, Codex logs these back-to-back:

2025-12-02T16:58:37.563316Z INFO ghost snapshot blocking task finished
2025-12-02T16:58:37.563424Z INFO ghost commit captured: 221ccccc536e7ea38635536c23fd511115a21632
2025-12-02T16:58:37.563451Z INFO ghost snapshot gate marked ready

Immediately afterwards, Codex finally applies the patch:

2025-12-02T16:58:37.568926Z INFO event.name="codex.tool_decision" tool_name=apply_patch decision=approved
2025-12-02T16:58:37.574906Z INFO event.name="codex.tool_result" success=true

Summary of what the logs show

The patch is generated immediately.

For exactly 5 minutes, the CLI shows periodic starting new connection debug lines.

No tool calls are executed during this period.

After ~5 minutes, three log entries appear:

ghost snapshot blocking task finished
ghost commit captured: <sha>
ghost snapshot gate marked ready

Immediately after those lines, Codex finally approves and executes the apply_patch tool call.

It appears that Codex is waiting for a blocking “ghost snapshot” operation to complete, and only once that finishes does it approve and execute the apply_patch tool call. On my machine this “ghost snapshot” step consistently takes about 5 minutes, which matches the delay I see before every code-modifying action.

jif-oai contributor · 8 months ago

What is the size of your repo? tracked VS untracked files
You can always disable it with --disable undo

alborzdev · 8 months ago
What is the size of your repo? tracked VS untracked files You can always disable it with --disable undo

This was for sure the problem. My repo accumulated 45GB in the .git directory, with 33GB of it being garbage (orphaned tmp_pack_* files from interrupted operations using command line agents), and some huge untracked tar.gz files that I forgot to add to my git ignore. As soon as I pruned all of that, it fixed the hanging!