Codex hangs at “Initializing agent…” after successful OpenAI response

Resolved 💬 3 comments Opened Apr 21, 2025 by thursdaybw Closed Apr 21, 2025

What version of Codex is running?

0.1.2504181820

Which model were you using?

o4-mini

What platform is your computer?

Linux 6.6.84-1-MANJARO x86_64 unknown

What steps can reproduce the bug?

Awesome — here’s a ready-to-go GitHub issue for you to post:

Summary
Codex CLI hangs at the "Initializing agent…" stage, even after receiving a successful 200 OK response from the OpenAI API. This is not the same as hanging on "Thinking…", the backend clearly responds, but Codex never proceeds.

---
Environment

  • Running in Docker using the official run_in_container.sh sandbox

---

Steps to reproduce

  1. Launch Codex in a project directory:

``bash
codex "explain generate_cuts.py"
``

  1. Wait until it reaches Thinking…, then:
  2. Observe the CLI output freeze on:

``
Initializing agent…
``

  1. Set DEBUG=true and rerun. Observe this key log snippet:

``bash
OpenAI:DEBUG:response 200 https://api.openai.com/v1/responses e [Headers] {
'openai-processing-ms': [ '1144' ],
'x-request-id': [ 'req_…' ],
...
}
``

Yet Codex does not move forward from "Initializing agent…", and never returns a result.

What is the expected behavior?

Codex should proceed with displaying the agent’s reasoning and response after receiving a valid API response.

Let me know if you need more logs — happy to help reproduce.

What do you see instead?

_No response_

Additional information

Re-running Codex with DEBUG=true shows that OpenAI API responds correctly with 200 OK, and the CLI logs full streamed output. The issue occurs after receiving several valid responses — when it reaches:

Initializing agent…

Codex never recovers from that point.

Key log snippets:

OpenAI:DEBUG:response 200 https://api.openai.com/v1/responses e [Headers] {
  ...
  'x-request-id': [ 'req_e1f39bff9f4066679f1dd99d2a467186' ],
  'openai-processing-ms': [ '1144' ],
  ...
}

command.stdout (code: 0, duration: 0s)
$ grep -R "def assign_labels" -n generate_cuts.py

... hangs here ...

Initializing agent…

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗