sandbox NextJS build goes for 20min+
Resolved 💬 2 comments Opened Mar 5, 2026 by henningpokriefke Closed Apr 24, 2026
What version of the Codex App are you using (From “About Codex” dialog)?
26.303.1606 (806)
What subscription do you have?
$200
What platform is your computer?
Darwin 25.1.0 arm64 arm
What issue are you seeing?
When codex tries to make a build "next build" that normally takes <20s it gets stale. I am using a turborepo with 3 NextJS applications and it happens for all of them.
It happens ONLY in the sandbox environment (when codex did not ask me (i am using standard permissions))
<img width="763" height="263" alt="Image" src="https://github.com/user-attachments/assets/18527f1b-1368-406a-8e4d-29e1f6bda952" />
Would be fixable with a e.g. standard timeout or possibility to skip that without stopping the agent.
Normal output would be (gets stale after 2nd line):
[...]
▲ Next.js 16.1.6 (Turbopack)
[MDX] generated files in 19.385582999999997ms
Creating an optimized production build ...
✓ Compiled successfully in 7.1s
✓ Finished TypeScript in 1730.7ms
✓ Collecting page data using 13 workers in 335.4ms
[...]
What steps can reproduce the bug?
- Setup Turborepo (might not be necessary but is my case and have not tested otherwise)
- 1. let it run a task where it needs to build a NextJS App "next build" in a sandbox (See it failing here)
- 2. Tell codex explicitly that he should ask about building outside of sandbox (See it succeeding here)
What is the expected behavior?
Building NextJS in under 20s.
Additional information
_No response_
2 Comments
Can confirm this on my side as well.
I’m seeing the same behavior on one specific machine:
next buildbecomes extremely slow / appears to stall (20+ minutes).So far this is machine-specific for me (not all of my computers are affected). Happy to provide more environment details
or logs if that helps.
@henningpokriefke @happyCodingHyy did either of you get this resolved?
I have been experiencing similar
next buildhangs while sandboxed.Even just getting Next.js builds within a sandbox to exit with a helpful error would be enough.
For now I'm doing this hacky thing to exit in my scripts if
next buildis being run inside the agent sandbox:Maybe it should be resolved on the Next.js side... cc @gaojude because I saw you also opened a similar issue:
There's also another (still open) issue that shows
next buildhanging within Codex CLI: