Codex on Windows under pwsh should not load profile when run shell as a tool call

Resolved 💬 3 comments Opened Nov 6, 2025 by doggy8088 Closed Nov 11, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What feature would you like to see?

When run shell command in Windows should add -NoProfile to the pwsh.exe command execution.

<img width="1393" height="265" alt="Image" src="https://github.com/user-attachments/assets/469c054d-a3b8-4faa-8a9a-9f716282ef9f" />

Additional information

The PowerShell script run by Codex CLI should not be affected by the default profile. The default pwsh profile should not be loaded it because it might contains many unrelated to Codex run.

View original on GitHub ↗

3 Comments

doggy8088 · 9 months ago

I have a workaround to load unsuitable settings from the default $PROFILE.

if ($host.Name -eq 'InternalHost')
{
    # stop reading any further profiles
    return
}
doggy8088 · 9 months ago

@etraut-openai Just FYI, the latest version of Copilot CLI now does always pass -nop to pwsh.exe. I believe this is a good default for Codex CLI as well. See here: https://github.com/github/copilot-cli/issues/176#issuecomment-3386463044

etraut-openai contributor · 9 months ago

Thanks for the bug report. We've shared the feedback with the team members who are responsible for training our codex models. We're tracking this feedback and similar reports so we can make the model more robust in future iterations.

If you see other model behavior that you'd like to report, please use the recently-added /feedback command in the CLI. That will provide us with additional details including logs and conversation text.