codex keeps hanging out when runs pytest

Resolved 💬 3 comments Opened Nov 6, 2025 by ihribernik Closed Jan 17, 2026
💡 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.55.0

What subscription do you have?

Plus

Which model were you using?

gpt-5-codex

What platform is your computer?

Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64

What issue are you seeing?

I am doing some refactoring in a Python/FastAPI project. In some cases, when I ask Codex to write test cases for me, it hangs when it tries to run pytest to execute the whole test suite (as shown in the image).
The test suite is small (around 17 short tests), but the execution gets stuck and never completes.

<img width="1912" height="316" alt="Image" src="https://github.com/user-attachments/assets/82bf83d2-da7e-435c-8830-eb5f2f32576f" />

What steps can reproduce the bug?

  1. activate a virtualenv
  2. launch codex
  3. ask to codex to run pytest

Uploaded thread: 019a5a65-84b5-75f1-b265-ae30a5761c18

What is the expected behavior?

codex must display/read the test result and continue with the task mentioned

Additional information

currently i am using ubuntu 24.04 inside wsl

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 9 months ago

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

  • #5533
  • #6294
  • #6279
  • #6274
  • #6293

Powered by Codex Action

balboah · 9 months ago

experienced this with other commands as well, I believe it's related to spawning background processes.

Here's a simple Makefile target example

hang:
		sleep 30 & \
		kill -0 $$!

If I run this, it returns instantly.
If codex runs it, it stalls for the full sleep period of 30 seconds before I see any output. Doesn't matter if it's sandbox or with elevated permissions.

It seems to not be able to fork processes into the background and continue with the next command.
This breaks my test target that for example starts a local database to run tests against.

version 0.56

etraut-openai contributor · 7 months ago

Closing out old bugs.