Unusable on Windows due to permission ask for every shell command
What version of Codex is running?
codex-cli 0.25.0
Which model were you using?
gpt-5
What platform is your computer?
Microsoft Windows NT 10.0.26100.0 x64
What steps can reproduce the bug?
Simply use Codex in a basic way on Windows. It uses PowerShell for almost all operations (reading file contents, searching for files, enumerating directories) and asks for permission for every operation. Telling it to stop asking for permission has no effect.
Here is a screenshot example:
<img width="911" height="571" alt="Image" src="https://github.com/user-attachments/assets/55d06809-19cb-4a73-aa72-72002543d02d" />
What is the expected behavior?
It should be able to perform basic harmless operations within the current directory and its subdirectories, such as reading files, scanning directories, and searching for text without asking permission for each operation.
Also, explicitly prefixing every operation with "powershell -NoProfile -Command ..." is fairly weird.
What do you see instead?
✔ You approved codex to run powershell -NoProfile -Command 'rg -n -S -e "gamelist" -e "recentlist" -e "recentList" -e "gameList"
src' this time
✓ ⌨️ powershell -NoProfile -Command 'rg -n -S -e "gamelist" -e "recentlist" -e "recentList" -e "gameList" src'
✔ You approved codex to run powershell -NoProfile -Command 'Write-Output "Opening gameListSlice.ts to inspect fetch functions
and triggers."; Get-Content -TotalCount 350 src/stores/slices/gameListSlice.ts' this time
✓ ⌨️ powershell -NoProfile -Command 'Write-Output "Opening gameListSlice.ts to inspect fetch functions and triggers.";
Get-Content -TotalCount 350 src/stores/slices/gameListSlice.ts'
✔ You approved codex to run powershell -NoProfile -Command 'Get-Content src/stores/slices/gameListSlice.ts -TotalCount 1000 |
Select-Object -Index 0..999' this time
✗ ⌨️ powershell -NoProfile -Command 'Get-Content src/stores/slices/gameListSlice.ts -TotalCount 1000 | Select-Object -Index
0..999'
Select-Object : Cannot bind parameter 'Index'. Cannot convert value "0..999" to type "System.Int32". Error: "Input string
was n
ot in a correct format."
At line:1 char:88
+ ... lices/gameListSlice.ts -TotalCount 1000 | Select-Object -Index 0..999
+ ~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Select-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SelectObjectCommand
✔ You approved codex to run powershell -NoProfile -Command '(Get-Content src/stores/slices/gameListSlice.ts -Raw)' this time
✓ ⌨️ powershell -NoProfile -Command '(Get-Content src/stores/slices/gameListSlice.ts -Raw)'
✔ You approved codex to run powershell -NoProfile -Command '$content = Get-Content -Raw src/stores/slices/gameListSlice.ts;
$content.IndexOf('"'loadAllGameLists'); "'$content.Substring(0, [Math]::Min($content.Length, 2000))' this time
✓ ⌨️ powershell -NoProfile -Command '$content = Get-Content -Raw src/stores/slices/gameListSlice.ts;
$content.IndexOf('"'loadAllGameLists'); "'$content.Substring(0, [Math]::Min($content.Length, 2000))'
? Codex wants to run powershell -NoProfile -Command '$content = Get-Content -Raw src/stores/slices/gameListSlice.ts; $start =
$content.IndexOf('"'loadAllGameLists'); "'$content.Substring($start, [Math]::Min(2400, $content.Length - $start))'
▌Allow command?
▌ Yes Always No, provide feedback
▌ Approve and run the command
Additional information
Unfortunately Codex-cli is unusable on Windows like this.
As an aside, I am using Claude Code extensively and Gemini-cli occasionally on the same Windows setup, and they work fine.
77 Comments
Even writing output to the conversation requires permission!
...and the PowerShell invocations more often than not fail because vertical pipes or parentheses are not quoted or backslash-escaped correctly. Then you need to approve them twice!
@vthorsteinsson If you dare, then /approval and choose Full Auto then you are only asked about applying pacth code (which is a bug as it happen even if you run dangerous sandbox mode)... Making it better for now
Same problem with codex-cli
0.27.0.There's not sense on confirming every shell command. Makes codex an useless extension because you still need a manual interaction.
Even if I set approvals to never, it still asking permission for each command, even if I choose "Run always".
BTW, I think prefix
powershell -NoProfile -Commandis very weird too.I just set to
Agent (full access)in VS Code and it works, but I dont think is the best option.Same thing happens to me in windows and WSL. Even adding the commands to “safecommands” in the confit file does nothing. I have to approve every single command. 🙁
Made a PR to fix https://github.com/openai/codex/pull/2988
TL;DR "--yolo"
I had the same issue even using "--full-auto" and set "/approval" to "Full Access"
When using "--yolo" I don't get asked to allow a command. I just get asked to apply changes to e.g. a script file. Might help a bit. In Gemini CLI with "--yolo" I don't even have to approve changes to files.
https://www.reddit.com/r/OpenAI/comments/1n4gk3w/how_to_adjust_permissions_in_codex_so_i_can_stop/
same issue
Yeah same issue, basically useless, I can do research and write code by myself faster than this.
Also having this issue and it is totally useless to me right now.
someone please merge the PR
Same with the VS Code extension, need to approve every single tool call
I need to approve every shell command in the VSCode extension on macOS, even when I select “run every time”
I also have the same issue.
For me the extension also doesn't seem to load my configuration.
I have this in project specific settings.json and in global vs code settings.json:
{
"chatgpt.config": {
"approval_policy": "never",
"shell": "C:Program FilesGit\bin\bash.exe"
}
}
I also thried to configure it in settings.toml globally but still no effect.
But still when checking in the session files it always says the following. Even after reloading and restarting VS Code:
<approval_policy>on-request</approval_policy><shell>pwsh.exe</shell>
Same issue here
Please fix this. I'm liking the quality of this over Claude right now, but having to babysit it completely defeats the purpose. I have to approve every
grep, everysed, everydockerrun.Re: some of the workarounds, like turning on full access, I'd much rather it just do what it says on the tin:
This is sensible, but it isn't what it does.
Same issue, its kinda really annoying and unusable with all the handholding it needs. Even with full access or ANY workaround I've seen online, it keeps asking for approval for everything.
the same, please fix this asap! this is MAJOR BUG!
Workaround for now while waiting for mergre, in WSL for Windows it works, not perfect but well
Can confirm that even on the highest approval level codex is still asking me for permission for every mundane thing it wants to do.
I should be more precise. After testing it more today, it seemed to run commands without asking, but asked every time it wanted to change a file. If anything, I actually don't mind if it changes any file, since it's all in version control. Ideally I'd be able to allowlist commands and perhaps subcommands while allowing all file changes to the current directory, but either way, it's far from what even the most permissive mode is doing right now.
Same here, asking for confirmation for every file creation or file modification.
Oh my god, this tool is so useless. Confirming consent literally every 3 seconds?
Can also confirm this, no matter what parameters you set.
This fixed for me on Windows 10:
/approvaland set it to "Full Access"edit: I still have to approve file edits with this
And you don't have to approve file edits with this?
/approval = Full Access fix everything but approval of add/edit/delete files
Run in WSL instead of cmd/Powershell make everything work
Looks like a PR in this issue was merged. If that fixes the issue, maybe it'll be deployed soon?
Oh, sorry, I still have to approve edits. But before this combination I had to approve everything. Will edit my comment to make it clear
New version 0.30 is semi-out (not yet reached npm servers) and according to the changelog, it should fix this, but when downloaded and installed, I hit this error instead #3224 ... Don't know if it is just me or a new, more serious bug
Yes, I hit https://github.com/openai/codex/issues/3224 too - both on Windows and Linux. Went back to 0.29.0, which nominally works.
With
/approvalset to _Full Access_, on version 0.29.0, Codex indeed does not ask permission for every operation - but it goes too far in the other direction. For instance, it is right now doing apip installinto my Python environment without having asked for permission! Also, it does not fully understand PowerShell syntax and has to repeat commands after removing or adjusting non-existent flags. Other spurious errors are also common, such as:The issue with 0.30 is now fixed. Default /approval still does not work as expected, but /approval = Full Access can now work 100% without user interaction.... Now we just need it for Codex IDE for me to be happy (no issue running Full Access)
I'm glad we have a somewhat decent workaround, but I'd really like the default approval mode to work, since I'm really wary of giving it full access to my hard drive.
@dellis23 : Then go the WSL route. That work as intended on Windows it seems
shell caommand Made a PR to fix #3253
Completely useless since release for me. Approving every single command defeats the purpose of the whole thing. VSCode extension 0.5.4.
I would recommend installing the microsoft WSL extension, pressing ctrl + shift + P, WSL: Open current folder in WSL and execute everything from there until this gets fixed, there it works without confirmation. Also command execution within linux is 10 times more powerful than from cmd or powershell and results are much better. But the extension should be able to work right away with the wsl system without needing to open the whole workspace in WSL, it would be nice to be able to choose the default terminal type used.
Meanwhile, Claude Code and Google Gemini CLI work perfectly on Windows, so it's hard to understand why Codex should be so far behind.
Confirmed that 0.30.0 in Auto mode still asks for every single attempt to read or list files even when telling it to always approve.
I have a workaround that makes things work perfectly.
Select Agent (full access) after that ask codex to write some powershell script, to create update and delete file in the workspace. When it has to manage files, it has not to ask confirm but using this script to manage all the work without asking anything.
Now it work like charm.
Pro tip. When you start again vs code, it loses all the memory. Ask to create a folder ai with all the instruction to do the work you agreed with it and a prompt to insert every time you start the day of work to read how it has to deal with files.
Tried 0.30.0 in auto mode in a linux shell on windows. Still asks for approval for every read operation.
Actually, it's worse than that. It seems to try to use
rgto search files and is able to find the command sometimes; other times it seems to thinkrgisn't available and resorts to runningpowershellcommands from within the linux shell!Still an issue in the pre-release VS Code extension 0.5.8. This is easily the worst thing about using Codex in Windows right now - the results are great, but having to approve every single file read (as far as I can tell, "Approve this session" vs. "Approve once" is meaningless) is insane.
This has to be intentional for reasons they won't explain. And this long for a fix?
Ahh, this still be an issue here, in previous versions this can be solved using auto clicker, now, the CTA's positions are always changing based on what the agent changes, this is very hard to deal with, I hope this can be fixed soon @bolinfest so I can play my games while vibing
Modifying the config.toml file resolved the constant permission prompts for me on Windows. I added the following settings to ~/.codex/config.toml under the [core] section:
[core]
full-auto = true
bypass-approvals = true
bypass-sandbox = true
trusted-workspace = true
Saved the file as UTF-8, restarted my terminal, and tested with codex --version. No more prompts for basic operations like file reading or directory searches. Note: Be cautious with these settings, as they reduce security checks. Thanks for the discussion in this thread!
I've done some testing with different parameters
codex-cli 0.34.0
windows 11
codex --full-auto "Please add a funny joke at the end of readme.md"
codex --ask-for-approval never --sandbox workspace-write "Please add a funny joke at the end of readme.md"
codex --ask-for-approval never --sandbox danger-full-access "Please add a funny joke at the end of readme.md"
codex --dangerously-bypass-approvals-and-sandbox "Please add a funny joke at the end of readme.md"
Appears to be a problem with sandbox and
workspace-write.welp. this was a neat trial. back to claude code as this is absolutely worthless in current form
Same here, it uses
pwsh.exeto read files, and ask permission to runpwsh.exeevery time, no matter if I use--full-automode or choose "Always" when approving its requests. This is just totally unusable on Windows.I'm trying the PRO subscription but really, how can this still be a problem, the Local VScode extension is unusable
<img width="503" height="1140" alt="Image" src="https://github.com/user-attachments/assets/011292f4-3e0c-4155-9ff4-b015d11ec8ab" />
I've been able to work around most of this, see below:
Been using/testing in windows platform - here are a some findings:
> codex --ask-for-approval never --sandbox workspace-write -c model_reasoning_effort="high" -c model_reasoning_summary="detailed" -c model_verbosity="high" -c tools.web_search="true" --search
> For tool calling you are running inside a Windows machine with access to
pwshandcmdshells and I have mademsbuild,sed,grep,rg,ls,jq,less,curl, andwgetcommands available. {rest of my prompt/request}lsin powershell is key. E.g.:Powershell profile:> if (Test-Path Alias:\ls) {
> Remove-Item Alias:ls # Remove built-in
lsalias, we replace it with a shim (ls.cmd) that automatically routes to correct command> }
>
> if (Check-Command cmd) {
> if (Test-Path Alias:\dir) {
> Remove-Item Alias:dir # Remove built-in
diralias, use cmddirfunction> }
> Function dir { cmd /r dir $args }
> }
> if (betterWhereIs curl | Where-Object {$_.Type -eq "Executable"}) {
> if (Test-Path Alias:\curl) {
> Remove-Item Alias:curl # Remove built-in
curlalias, prefer curl binary if available> }
> }
pwshcommands (which wants approval on every single one). Closing and starting the session over usually solves this for me,.pwshsequenced commands, all commands are available and msbuild does work/run (the downside being there being every single read/search etc prompts for approval). That aside, codex-cli keeps butting up against some kind of whitelisted allowlist but I can't find a config on how to set. Opened https://github.com/openai/codex/issues/3821 to see if can get more info/docs.--
ls.cmd (shim for better ls)
<details>
</details>
msbuild.cmd (shim for msbuild)
<details>
On Windows + VS Code extension, this feels like installing a steering wheel on a bicycle; it looks cool, but you cant drive anywhere. the plugin is almost useless there.
This issue is not caused by sandbox restrictions. The problem of requiring authorization on Windows due to lack of complete sandbox mechanisms has been fixed by this PR: https://github.com/openai/codex/pull/2988. Thanks again to @Sing303.
The current issue is caused by Codex's preference for wrapping command execution on Windows by default. This prevents Codex's whitelist command recognition mechanism from identifying read-type commands that should be allowed to pass through.
My current solution is to add a prompt in AGENTS.md that prohibits wrapper execution:
This forces Codex to directly call commands like
ls,rg, orsed. I'm using scoop to install busybox and ripgrep to provide these commands:This way Codex can execute Unix-like commands and be properly recognized by Codex's whitelist command mechanism.
is there a sentence I can tell codex on windows that will cause it to read an entire file into its context window (in read-only mode)? It seems to be able to run 'rg' but it spends a suspicious amount of time doing things like
analyzing truncation modeActivating "Agent (full access)" made the trick here.
<img width="498" height="958" alt="Image" src="https://github.com/user-attachments/assets/f5f5eaa1-14fc-4a33-937e-02848051be04" />
Still have these issues even with the above merged fixes. Full access works but I don't want to give it access to everything like this.
Using the normal agent mode doesn't work and asks permission even to read a file in the same workspace.
Codex works great on my mac but I end up still using claude code as I need it running on windows too (game dev)
@xjjon
As I mentioned in my previous comment https://github.com/openai/codex/issues/2860#issuecomment-3313415968, I tested with the default permission settings and found that basic commands like
ls,rg, etc. can execute without requiring approval:With these default settings (
Approval Mode: on-request,Sandbox: read-only), commands likelsandrgexecute without needing explicit approval each time. This seems to work smoothly in v0.39.0-alpha.1.Simpsons also predicted how to work with Codex in Windows
!Image
Selecting "Agent (full access)" obviously works for not getting those annoying permission requests but in Windows its doing those "Ran Powershell.exe -NoProfile -Command '...." EVERYTIME it needs to read a file or do an action like running a python script to modify files, it seems like a bug... which is also making it SUPER slow in comparison to run cursor + codex extension connecting via SSH to a Linux server.
I also have this problem on macOS.
I don't understand how almost every other CLI has this nailed but not Codex...
--yolo mode works but I don't like using it.
is it really difficult to always allow readonly commands and ask for write commands? currently it is always asking for everything... claude does it great. gemini does it great. codex asks me 250 times before it can read a project folder. (why i still have to use codex? because I only have company api key for openai/codex)
how to limit --yolo to current working directory and subdirectories only pls ? I did run
codex --yoloin powershell 7.5 windows 10 and it started to discover upper folders too . I did run codex --yolo inmaind1/subd1/subsubd1and I saw it is reading/parsingmaind1root files beside files inmaind1/subd1/someothersubd2.. just changed few hrs ago from Claude CLI to Codex CLI.. I am scared ..And yes I tried this because I was getting the same pwsh permission requests every second (even though I said do not ask , allow always option).. with --yolo I didnt get any question at all , but must figure out only workspace with --yolo )
I am on OpenAI Codex (v0.42.0)Thanks.The workaround mentioned earlier by LaelLuo makes it tolerable.
I have installed ripgrep with
winget install BurntSushi.ripgrep.GNUand the other GNU tools were already available on my system thanks to Git, inC:\Program Files\Git\usr\binThis single instruction in AGENTS.md (or in the CODEX conversation) works so far:
To be fair, the documentation does state that Codex on Windows is best used on WSL, but IMO there should be a runtime check and warning, for discoverability. Otherwise it makes for a pitiful first time experience.
Same issue. My god its frustrating!
Wow yeah the difference between running Codex in a WSL terminal, versus running it as a VS Code extension in windows is STARK.
I'm honestly surprised the extension was released - when you compare the experience to Copilot or Claude, Codex comes away looking really really bad. Usually I roll my eyes at descriptions like "unusable" but in this case I actually completely agree with OP - it's like it's actively trying to discourage you from using the extension (or actively encouraging you to use full auto / yolo, which is terrifying)
@etraut-openai just to clarify, it's happening not only on windows, here I'm using MacOS
019a4551-4cc9-7ca2-9285-8f3ab6474375
@kidcuauh, this is a known issue on Windows. Because there is no sandbox on Windows, all tool calls require user approval. This isn't the case on MacOS, so if you're seeing an issue there, it's a different problem. Please search for other related issues, and if you'd find one, file a new bug report that includes details about the behavior you're seeing.
There has been new progress on this issue. I can see that the main branch now has an experimental option
[features].enable_experimental_windows_sandbox. When enabled, usingapproval_policy = "on-request"withsandbox_mode = "workspace-write"means that at least when Codex usesapply_patchto edit files within the project, no authorization is required.However, as I mentioned above in https://github.com/openai/codex/issues/2860#issuecomment-3313415968, the root cause of this issue is the failure of the command whitelist recognition mechanism.
But I now notice that there's code for a pwsh command whitelist mechanism at
codex-rs/core/src/command_safety/windows_safe_commands.rs:142, so even without installing busybox-related executables, the experience should now be much more comfortable.However, there's still a model-level issue: when the Codex model realizes it's running in a Windows environment, it has a strong tendency to use script-based file modification rather than prioritizing
apply_patch. In these cases, you'll likely still need to authorize approval. Interestingly, this tendency is rarely seen on Unix platforms.For the past two weeks, we've been testing and refining a new Windows-native sandbox implementation for the Codex CLI and IDE extension. Today, we've released new versions of the CLI (0.59.0) and extension (0.4.44, or pre-release 0.5.44) that incorporate the latest bug fixes for this feature. The new Windows sandbox is still considered "experimental", but we think it's ready for broader use, and we welcome you to give it a try. For more details, refer to this documentation. With the new sandbox enabled, you should see far fewer approval requests.
Today we also announced a new model: GPT-5.1-Codex-Max. In addition to being more token efficient and able to solve longer-horizon problems, it also has improved support for Windows code generation and tool usage. Give it a try, and let us know what you think.
I have been using codex-cli with the Terminal app on Windows 11 and gpt-5.1-codex-max for the past hour and the difference compared to before is night and day. It now just works! Navigating folders, running commands, reading, creating and editing files. It just works! Thank you
@etraut-openai Did I got it right by the Windows sandbox mode you mean this one?
https://learn.microsoft.com/ru-ru/windows/security/application-security/application-isolation/windows-sandbox/
Looks like these are related #6521
@nos1609, no that's not the sandbox I'm referring to. The codex team has implemented a sandbox mechanism that leverages restricted tokens in the Windows kernel to provide write protections for file system locations outside of your working directory. You can read more about it here.
With the new Windows sandbox now ready for broad use, I'm going to mark this issue as closed. There are undoubtedly many additional improvements that we still need to make for codex on Windows. Many of these are already reported as open bugs. If you see further issues with Windows tool permissions or sandboxing, please open new issues with repro steps and additional details. That will help us focus our attention on the most important issues.
For what it's worth, while the update did help to significantly reduce the number of 'allows' you need to click through on windows, I feel like "Allow this session" can't be functioning as intended. As an example from today -
<img width="319" height="772" alt="Image" src="https://github.com/user-attachments/assets/320afa90-0e65-49b4-9385-d4930e5a74fa" />
each of these 'edited' entries marked in blue asked for confirmation, and each one I answered with 'Allow this session' - but what exactly am I allowing, given that the next request, often to edit the same file, just results in _another_ nag to grant permission?
this is using the codex plugin in vscode:
Identifier: openai.chatgpt
Version: 0.4.46
Last Updated: 1 day ago
Size: 125.90MB
is this still expected behavior? because it feels like it's checking in too often Claude might have asked once at the beginning of the process, or maybe even once per file, but would not have bugged me over and over again every time it wants to make an edit to the same file, especially not once I'd already granted it permission for the session.
I'm being asked for approval for file edits within the sandboxed workspace even though I am in the "Agent" mode. "Allow this session" also doesn't seem to work; It will continue to ask for permission for file edits, even after clicking that option. Hopefully I'm not misunderstanding either of these functionalities, but this was previously resolved and has only recently become an issue again.
As I mentioned above, if you see further issues with Windows tool permissions or sandboxing, please open new issues with repro steps and additional details. That will help us focus our attention on the most important issues. Thanks!
I'm going to lock this issue to prevent additional posts.