Codex integrated terminal crashes PowerShell 7 on startup context

Open 💬 1 comment Opened Apr 6, 2026 by KhakiSkech

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

Please fill from About Codex dialog. I have not verified the app version from the UI yet.

What subscription do you have?

Please fill with your actual plan (for example: ChatGPT Plus / Pro / Team / Enterprise).

What platform is your computer?

Windows 11 Version 10.0.26100.8037 x64

What issue are you seeing?

Codex integrated terminal crashes PowerShell 7 only inside Codex.

What works:

  • powershell.exe 5.1 works normally
  • C:\Program Files\PowerShell\7\pwsh.exe works normally when launched from cmd.exe
  • C:\Program Files\PowerShell\7\pwsh.exe -NoLogo -NoProfile also works normally from cmd.exe

What fails:

  • Codex integrated terminal when the shell is set to PowerShell

Observed context inside Codex:

  • The terminal prompt/cwd is shown as:

PS Microsoft.PowerShell.Core\FileSystem::\\?\C:\Users\wocks\KSIProjects\KhakiSketch>

  • The cwd reported by the app terminal snapshot was:

\\?\C:\Users\wocks\KSIProjects\KhakiSketch

When Codex tries to execute a PowerShell command, the process terminates with this error:

Process terminated.
The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception.
   at System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle, System.String, System.Runtime.CompilerServices.ObjectHandleOnStack, System.String)
   at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, System.String)
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
   at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception.
 ---> System.ComponentModel.Win32Exception (126): 지정된 모듈을 찾을 수 없습니다.
   at System.Management.Automation.Internal.SecuritySupport.GetSaferPolicy(String path, SafeHandle handle)
   at System.Management.Automation.Security.SystemPolicy.TestSaferPolicy(String testPathScript, String testPathModule)
   at System.Management.Automation.Security.SystemPolicy.GetAppLockerPolicy(String path, SafeHandle handle)
   at System.Management.Automation.Security.SystemPolicy.GetLockdownPolicy(String path, SafeHandle handle, Nullable`1 canExecuteResult)
   at System.Management.Automation.Security.SystemPolicy.GetLockdownPolicy(String path, SafeHandle handle)
   at System.Management.Automation.Security.SystemPolicy.GetSystemLockdownPolicy()
   at System.Management.Automation.Runspaces.InitialSessionState..cctor()
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault2()
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)


### What steps can reproduce the bug?

1. Open Codex on Windows 11.
2. Go to Settings and set `Integrated terminal shell` to `PowerShell`.
3. Open or create a thread in a local workspace.
4. Let Codex use the integrated terminal with PowerShell, or have Codex execute any simple PowerShell command.
5. Observe that the integrated PowerShell session shows a cwd/prompt in this form:
   `Microsoft.PowerShell.Core\FileSystem::\\?\C:\...`
6. Run any minimal PowerShell command through Codex, for example:
   ```powershell
   $PSVersionTable.PSVersion


### What is the expected behavior?

Codex should start and use the integrated PowerShell terminal normally when `Integrated terminal shell` is set to `PowerShell`.

A simple command such as:

```powershell
$PSVersionTable.PSVersion


### Additional information

Additional notes:

- This does not appear to be a system-wide PowerShell issue.
- `powershell.exe` 5.1 works normally.
- `pwsh.exe` 7.6.0 works normally both non-interactively and interactively when launched from `cmd.exe`.
- The failure appears specific to Codex integrated terminal on Windows.
- The integrated terminal prompt/cwd inside Codex uses a provider/extended-length path form such as:
  `Microsoft.PowerShell.Core\FileSystem::\\?\C:\Users\wocks\KSIProjects\KhakiSketch`
- That path format may be related to the crash during AppLocker / SaferPolicy initialization.

Temporary workaround:
- Use `cmd` or an external terminal instead of PowerShell in the Codex integrated terminal until the issue is fixed.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗