`codex exec` hangs indefinitely — `codex_models_manager` logs "timeout waiting for child process to exit", no error surfaced, no recovery

Open 💬 2 comments Opened Jul 20, 2026 by dumiller

What version of Codex CLI is running?

0.144.1 (installed via Homebrew cask codex; 0.144.3 is available upstream as of 2026-07-20, not yet tried — unknown whether it addresses this)

What subscription do you have?

ChatGPT Pro (auth.credentials.stored auth mode: "chatgpt", not an API key)

Which model were you using?

gpt-5.6-sol, invoked via codex exec directly (not through gpt-5.6-luna/-terra, so this doesn't look model-specific)

What platform is your computer?

Darwin 25.4.0 arm64 arm (macOS, Apple Silicon)

What terminal emulator and version are you using (if applicable)?

Not applicable — codex exec was launched non-interactively from an automation wrapper (nohup bash -c 'codex exec ...' > log 2>&1 &), no interactive terminal/TTY attached, stdin redirected from /dev/null.

Codex doctor report

codex doctor --json currently and reproducibly reports overallStatus: "fail", with one failing check:

{
  "id": "network.provider_reachability",
  "category": "network",
  "status": "fail",
  "summary": "one or more required provider endpoints are unreachable over HTTP",
  "details": {
    "ChatGPT base URL": "https://chatgpt.com/backend-api/ request timed out (required)",
    "reachability mode": "ChatGPT auth"
  },
  "remediation": "Check proxy, VPN, firewall, DNS, and custom CA configuration."
}

This is reproducible on demand (ran twice, ~1 hour apart, same result both times). For context, on the same machine at the same time:

  • No proxy env vars are set (HTTP_PROXY/HTTPS_PROXY/etc. all unset).
  • DNS resolves chatgpt.com fine (104.18.32.47, 172.64.155.209 — Cloudflare).
  • A plain curl -sS --max-time 15 https://chatgpt.com/backend-api/ returns HTTP 403 in 5.6s — a real (if unauthenticated-appropriate) response, not a timeout.

So whatever codex doctor's reachability probe is doing to that URL behaves differently from a bare HTTPS GET, and consistently times out where curl succeeds.

What issue are you seeing?

A non-interactive codex exec dispatch (long-running planning/spec-review task, several tool calls executed successfully first) stalled permanently partway through. Its stderr showed:

2026-07-20T17:40:18.405988Z ERROR codex_models_manager::manager: failed to refresh available models: timeout waiting for child process to exit
2026-07-20T17:43:23.407528Z ERROR codex_models_manager::manager: failed to refresh available models: timeout waiting for child process to exit
2026-07-20T17:46:28.409987Z ERROR codex_models_manager::manager: failed to refresh available models: timeout waiting for child process to exit

Three occurrences, ~185s apart (looks like a periodic internal refresh timer). After the first occurrence, no further activity appeared in the log at all — no more tool calls, no more agent turns, nothing — for as long as we let it run. The process consumed ~0% CPU (confirmed via ps), i.e. genuinely idle/blocked, not churning. It only stopped because our own wrapper had an external 15-minute wall-clock timeout that force-killed it (pkill -f "codex exec"); codex exec itself never exited, errored, or recovered on its own, and nothing was surfaced to the calling process to indicate anything was wrong beyond those three stderr lines.

Given the concurrent codex doctor finding above, our working theory is: the codex_models_manager's periodic model-list refresh depends on reaching https://chatgpt.com/backend-api/ (consistent with reachability mode: "ChatGPT auth"), that network call (or a child process performing it) is hanging rather than timing out cleanly, and — critically — that internal background task's hang appears to block or otherwise permanently stall the main codex exec turn loop, rather than failing independently in the background the way a "refresh available models" task probably should.

What steps can reproduce the bug?

We don't yet have a minimal, fully isolated repro for the main-loop stall itself (it's occurred during long, multi-hour sessions with many concurrent codex exec dispatches against the same ChatGPT-plan account, so we can't rule out some concurrency/rate factor). However, the related codex doctor symptom is reproducible on demand right now:

  1. Ensure codex is authenticated via ChatGPT plan login (not API key).
  2. Run codex doctor --json.
  3. Observe network.provider_reachability fail with "request timed out" for https://chatgpt.com/backend-api/, while a plain curl to the same URL from the same machine at the same time succeeds.

For the main-loop stall itself, the invocation shape that triggered it was:

codex exec --cd . --sandbox read-only -m gpt-5.6-sol --output-last-message /tmp/out.md "<long planning/spec-review prompt>" < /dev/null > /tmp/out.log 2>&1 &

run under nohup from a non-interactive automation wrapper, no TTY.

What is the expected behavior?

codex exec should not hang indefinitely with zero CPU usage and zero surfaced error when its internal model-refresh mechanism can't complete. At minimum: the background refresh failing should not be able to stall the main task turn loop; and/or codex exec should itself time out and exit with a clear, actionable error (e.g. "could not reach ChatGPT backend, retrying" / "giving up after N attempts") rather than running forever with no indication anything is wrong beyond intermittent stderr lines an automated caller has no reliable way to watch for.

Additional information

We've worked around this on our side with an external wall-clock timeout + process-group kill around every non-interactive codex exec dispatch, since codex exec itself provides no way to detect or recover from this state. That's a caller-side mitigation, not a fix — happy to share the wrapper script or more detail if useful for triage.

View original on GitHub ↗

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