feat: configurable Windows agent shell (powershell/git-bash)

Resolved 💬 12 comments Opened Apr 3, 2026 by Jawad-hussain-kalwar Closed May 10, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Problem

On Windows, Codex hardcodes PowerShell as the agent shell. PowerShell syntax is unfamiliar to the model compared to bash, leading to worse command generation. Users with Git Bash installed have no way to switch.

Proposed Solution

Add a [windows].agent_shell config key ("power-shell" | "git-bash") to ~/.codex/config.toml:

[windows]
agent_shell = "git-bash"

When git-bash is selected:

  • Agent default shell resolves to bash (with Git for Windows fallback paths)
  • Tool descriptions sent to the model switch to bash syntax examples
  • Hard error on session start if bash is configured but not found
  • Bash binary registered as sandbox-readable root

Default behavior (PowerShell) is unchanged when the key is omitted.

Implementation

I have a working implementation in my fork with all tests passing:

The implementation follows existing config patterns ([windows].sandbox, [windows].sandbox_private_desktop) and the zsh-fork shell resolution precedent.

View original on GitHub ↗

12 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #16579

Powered by Codex Action

etraut-openai contributor · 3 months ago

Have you tried just steering the model to use bash? It tends to use PowerShell because many Windows users don't have git bash, but if you ask it to use bash, it should do so.

Jawad-hussain-kalwar · 3 months ago

I have tried it, I have tried adding it to global rules, it sitll tends to use powershell, the limitation is the functions.shell_command tool by default it is only configured to be powershell so even if agent tried to use gitbash it will do so via powershell and then use bash.exe followed by command and it makes its performance even worse and token usage is also wasted,

etraut-openai contributor · 2 months ago

This feature request hasn't received enough upvotes, so I'm going to close it.

sicora-at-mcgough · 2 months ago

The fact that there is an option in the windows app for choosing the "integrated shell" is confusing, took me a very long time to realize that the choice there has no bearing on the terminal shell used by the agent.

etraut-openai contributor · 1 month ago

@sicora-at-mcgough, you are welcome to open a new issue. Sometimes a feature request doesn't attract upvotes because of the way it's titled or described, so opening a new one can help attract more support.

Kronen · 1 month ago

@etraut-openai Why does a basic feature like letting users choose which shell the agent uses need a certain number of upvotes? It's the kind of option that should have been there from the start, in the very first version.

abhinavgaba · 1 month ago

It's a blocking issue for environments where users need a bash-like shell for their workflows, and have git-bash/cygwin etc. installed, but don't have admin rights to install WSL.

It would be preferable if we had the ability to choose the type of shell (to tell the agent which kind of commands to generate) as well as the path to the shell tool (like #16579), or at least have codex honor $SHELL, if it's set.

davidgilbertson contributor · 1 month ago

There's 20 upvotes on this issue, plus it seems like an obvious thing to fix, (at least obvious to Windows users). Is that really not enough to fix this problem?
I just ran a script that looked through my Codex history at all the times that it had, behind-the-scenes, got a command wrong, or messed up quoting for PowerShell, and either got confused and headed down the wrong path. It's a lot!
I suspect if a certain subset of OpenAI employees used Windows and noted the same thing, they'd see how suboptimal it is right now and accept this fix.
Or even better than allowing Git Bash would be to train the model to use PowerShell. Surely that's the long-term win.

HustCoderHu · 10 days ago

dude, claude code supported git-bash long time ago, is it very hard ?

imblowsnow · 8 days ago

@etraut-openai I hope I can support it. There are already multiple issue.

n03xcus3 · 5 days ago

wish Git‑Bash can be integrated sooner.