Codex on Windows keeps tasks “running” indefinitely when Playwright (or npm scripts) spawn child processes

Resolved 💬 4 comments Opened Sep 5, 2025 by tm-iands Closed Nov 26, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of the VS Code extension are you using?

0.4.3

Which IDE are you using?

VS Code​

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64

What steps can reproduce the bug?

  1. The Codex task stays “running” forever even after the command printed output and should have finished.
  • Example command:

``powershell
pwsh -NoProfile -Command "[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;

$env:CI='1'; npx playwright test tests/e2e/specs/dashboard-error-investigation.spec.ts
--project=chromium-debug --reporter=line --timeout=120000"
``

  • Playwright itself exits in a normal terminal, but inside Codex it never signals completion.
  1. For Playwright HTML report (npx playwright show-report), the process requires pressing Ctrl+C twice to stop.
  • In Codex, this prevents the task from finishing and blocks further runs.

What is the expected behavior?

  • Codex should detect when child processes (started by npx, Start-Process, etc.) finish and mark the task as complete.
  • A single Ctrl+C should be propagated correctly to terminate the Playwright process.
  • Tasks should not remain indefinitely “running”.

What do you see instead?

  • Tasks remain stuck in “running” state indefinitely.
  • HTML report requires Ctrl+C twice to exit.
  • This only occurs when running under Codex on Windows; normal PowerShell runs behave correctly.

Additional information

  • Workarounds attempted:
  • Setting $env:CI=1 and disabling interactive reporters
  • Adding --workers=1 and --max-failures=1
  • Wrapping commands in custom PowerShell scripts with timeouts and PID cleanup
  • These mitigate the issue but do not solve the root cause.

This seems to be specific to Codex’s process handling on Windows, since Playwright itself terminates normally when run outside Codex.

View original on GitHub ↗

4 Comments

machado2 · 11 months ago

I got the same problem, had codex fix itself

https://github.com/openai/codex/pull/3649

tm-iands · 11 months ago

Thanks a lot for jumping in and linking your PR! 🙏 I just read through #3649 and it really looks like the exact root cause of the issue I reported. I’ll try it out once it gets merged, but it’s already reassuring to know this is being addressed. Really appreciate you taking the time to fix and share this!

machado2 · 11 months ago
Thanks a lot for jumping in and linking your PR! 🙏 I just read through #3649 and it really looks like the exact root cause of the issue I reported. I’ll try it out once it gets merged, but it’s already reassuring to know this is being addressed. Really appreciate you taking the time to fix and share this!

If you need it don't wait for someone to merge / fix it, codex will happily write you a workaround if you explain it the problem, that is:

"Some commands (e.g. test runners like Playwright) spawn grandchildren that inherit stdout/stderr. Those descendants may keep the inherited FDs open after the main child process exits. Our previous implementation waited for EOF on the pipes, so we could wait forever even though we already observed the child exit (or timeout), leaving Codex blocked."

It will generate a wrapper in whatever you use to call playwright that handles the stdout and stderr problem

etraut-openai contributor · 9 months ago

This should be fixed in the most recent versions of codex.