Sandbox limits powershell behavior

Open 💬 0 comments Opened Apr 7, 2026 by acepace

What version of the Codex App are you using (From “About Codex” dialog)?

26.325.31654

What subscription do you have?

Business

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

When codex runs terminal commands in the sandbox, it loads the default user powershell profile and runs the commands. Those can frequently fail outside the sandbox. Example

Get-ChildItem -Force

Output is

  Directory: D:\tests\

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          07/04/2026    17:38                VPN

fnm: C:\Users\[username redacted]\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:1
Line |
   1 |  fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expressi .
     |  ~~~
     | The term 'fnm' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the
     | spelling of the name, or if a path was included, verify that the path is correct and try again.
Import-Module: C:\Users\[username redacted]\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:36
Line |
  36 |  Import-Module -Name Microsoft.WinGet.CommandNotFound
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What steps can reproduce the bug?

Create a powershell profile under
%USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

With a command such as
fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression

or
Import-Module -Name Microsoft.WinGet.CommandNotFound

What is the expected behavior?

  1. Codex should recognize there was a failure and stop
  2. Codex should run without the user profile if inside a sandbox

Additional information

_No response_

View original on GitHub ↗