WSL Codex sandbox hangs FastAPI/Starlette TestClient and blocks Vite localhost bind
Environment:
- Codex CLI: 0.140.0
- OS: Ubuntu 24.04 under WSL
- Terminal: Warp
- Repo path: /home/user/code/Kids-Tutor
- codex doctor sandbox: restricted filesystem + restricted network, approval
OnRequest
- Project trust_level: trusted in ~/.codex/config.toml
Problem:
Inside Codex sandbox on WSL, FastAPI/Starlette TestClient requests hang
indefinitely. The same tests pass outside the sandbox.
A second related symptom: Playwright/Vite cannot bind localhost in the sandbox
with:
Error: listen EPERM: operation not permitted 127.0.0.1:5173
Minimal repro:
```python
from fastapi import FastAPI
from fastapi.testclient import TestClient
app = FastAPI()
@app.get("/health")
def health():
return {"ok": True}
print("before")
print(TestClient(app).get("/health").status_code)
print("after")
```
Expected:
Prints 200 and exits.
Actual in Codex sandbox:
Prints "before", then hangs in Starlette/AnyIO TestClient.
Observed stack:
- starlette.testclient.py handle_request / enter
- anyio.from_thread portal wait
- asyncio selector loop waiting
Control:
Running the same repo gate outside Codex sandbox passed:
- make test -> backend 1441 passed / 216 skipped; frontend vitest 305 passed
- npx playwright test --project=chromium admin-weekly-report-review -> 6
passed when allowed to bind localhost
Impact:
Codex can produce false audit/test failures in WSL because normal local test
gates hang only inside the sandbox. This has happened more than once.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗