dotnet command hangs until timeout, with high cpu
What version of Codex is running?
0.30.0
Which model were you using?
gpt-5-high
What platform is your computer?
Darwin 24.6.0 arm64 arm
What steps can reproduce the bug?
ask codex to run dotnet test, it will respond something like
run dotnet test directly
> Running .NET tests directly for the solution (no restore). This may take a
few minutes.
• Ran
└ dotnet test ./<solution>.sln --no-restore -v minimal
<here I press escape due to no progress after minutes..>
🖐 Tell the model what to do differently
I cancelled after several minutes. Looking in Activity Monitor, the dotnet process consumes ~50% cpu and seems to get nowhere. If I run the exact same command (copying from codex and running in separate terminal) it completes successfully in 11 seconds.
I have no clue what is happening here, but I also have similar issues running vitest from codex from npm npm run test, it just completely hogs my computer and I have to force quit.
Is anyone else managing to run dotnet and vitest using codex? My commands work flawlessly in Claude Code, so I know it is not my tests that are failing, it is something about how codex call the commands that seems off.
What is the expected behavior?
Codex should call dotnet, npm or vitest commands successfully.
What do you see instead?
Hangs (if I don't press escape, it auto-timeouts after like 10 minutes)
Additional information
_No response_
20 Comments
I saw the windows-os tag but this is macOS 15.6.1
I can confirm it also happens on mac. there were several node process, consuming all my system memory, swap was at 24gb, had to restart with the power button. I restart codex every few tasks to have fresh context, the processes are still there.
Also using vitest.
Same issue for me dotnet build on Mac never finishes making codex for dotnet useless because it can’t check for errors
dotnet build hangs when codex runs it however if i set access to full access it builds fine
Thanks for that note on enabling full access. It turns out codex 0.36.0 has an improved error message;
So I went into
config.tomland setNow the same command rendered the following output;
So allowing network access seems to be a workaround for running dotnet commands in codex. I still think this default behaviour is not very user friendly and confusing coming from Claude Code where dotnet commands run out of the box. I am also unsure what security implications this have for me enabling network access in the sandbox mode.
This hanging has been a problem for me for some time.
I confirm that running it in full access fixes the problem! Thanks @danyo1399
dotnet test doesnt work even with workspace-write and network access:
output:
@cyril265 codex is not very consistent here, sometimes it asks for elevated network access after setting sandboxed network access, sometimes not. I usually have to remember it to ask me - something like this to get the "Allow Access" prompt;
I agree. Codex appears to struggle with knowing when to request elevated permissions, leading to prolonged retries and occasional edits to unrelated items.
Perhaps this can be fixed broadly, eliminating the need for additional prompts.
It would be handy to be able to give conditional reminders to the LLM when it runs specific tasks, including a "are you sure" when it's running something potentially destructive.
Yes, running with
sandbox_mode = "danger-full-access"is the only solution.Without it, there is no agentic loop in Codex on .Net projects, which is sad
Only found this issue now, but seems like i had the same problem on codex 0.50.0 in #5946
Thanks for tips in previous comments, running the same in full access mode finally worked. Yet i believe this should be fixed to work in regular permission auto-mode too
I solved this by modifying
agents.mdfile to tell it to request elevated permissions, worked like a charm. Hope there will eventually be a broader fix@AndrewNikolin yes, I find it responds even better to be explicit in AGENTS.md by including the actual internal flag Codex needs to use;
That said, when Codex escalates, it would be nice if it was possible to make the approval last more than this session similar to Claude Code it would be a huge QOL to make it last the approval for all future sessions as well.
You approved codex to run npm run lint every time this session=>
You approved codex to run npm run lint every time for future sessionsSimilar issue is happening for me using VSCode extension with WSL2 on Win11. I have a python repo, where I have pytest suite using asyncio and sqlite, following snippet can be used to reproduce.
without full access, test hangs on the db connection stages, but with @joakimriedel suggestion, if I put in in the agents.md to make codex ask for elevated access, it remembers to ask elevated permissions but feels like it should work in sandbox without full access.
This solved my issue, thanks!
Wanted to share here as well, 0.66.0 update makes this less painful: after command is remembered as "always allow" the timeouts and other related issues don't happen. On mac os that is stored in
~/.codex/policy/default.codexpolicyso i guess one can add patterns beforehandsame issue on macOS
same issue