I've been working on an integration with heavy assistance from Codex, since Python is not my strongest area. One odd problem I ran into is that Home Assistant tests hang, but only inside the Codex sandbox. Running the same tests outside the sandbox, against the same HA Python packages, finishes in a few seconds.
At first it looked like a DNS or pycares issue. We found a pycares shutdown thread in one timed-out run, and blocking aiodns/pycares changed the failure mode, but it did not fully solve the hang. We also tried blanket socket blocking with the necessary Unix-socket allowance, and that did not reproduce the problem outside the sandbox either. So it seems related to networking or socket behavior, but not just “real network access” in the normal sense.
The strongest clue so far is that, in the sandboxed runs, asyncio logs PermissionError: [Errno 1] Operation not permitted when trying to write to its own self-pipe socket during Home Assistant test bootstrap. Outside the sandbox, the exact same test passes immediately. So at this point it looks less like a normal HA test bug and more like an interaction between Home Assistant’s async test stack and the sandbox/runtime restrictions. Has anyone seen similar behavior with HA tests in restricted/containerized/sandboxed environments, especially around asyncio self-pipes, socketpair, aiodns, or pycares?
I've been searching for keywords but haven't found any posts that might hint at the same. I could report a bug on the HA core, but wanted to see if others had similar issues first.