codex icon indicating copy to clipboard operation
codex copied to clipboard

[VOTE needed] configurable Windows agent shell (powershell/git-bash) #16717

Open misaya98 opened this issue 4 months ago • 3 comments

What variant of Codex are you using?

cli

What feature would you like to see?

configurable Windows agent shell (powershell/git-bash) #16717

provide your vote!

Additional information

No response

misaya98 avatar Jul 08 '26 08:07 misaya98

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

  • #16717

Powered by Codex Action

github-actions[bot] avatar Jul 08 '26 08:07 github-actions[bot]

claude code is not opensourced, but git-bash is supported on windows

HustCoderHu avatar Jul 10 '26 07:07 HustCoderHu

+1 on this. Concrete use case from a Windows-native project, winuxsh (https://github.com/unixwin/winuxsh): a bash/zsh-like shell for Windows built on rubash + winuxcmd, intended for both humans and coding agents. The non-interactive -c contract is already agent-friendly (clean stdout/stderr, no banner, exact exit-code propagation, native Windows paths, ~ = %USERPROFILE%). The only thing standing between winuxsh and Codex shell_command is exactly what this issue proposes — a configurable Windows shell path.

I verified by tracing through codex-rs/shell-command/src/shell_detect.rs and codex-rs/core/src/session/session.rs that on Windows Codex currently hardcodes get_shell(ShellType::PowerShell, None) and reads no env var or config.toml field. The field proposed in #16579 (windows.shell_path) is exactly the missing piece; as soon as it lands, winuxsh can be wired up with a single config line.

Please coordinate with #16579 — the implementation there already covers config parsing, profile override, executable validation, and schema regeneration. Landing either approach unblocks the entire alternative Windows shell ecosystem, not just Git Bash.

caomengxuan666 avatar Jul 19 '26 11:07 caomengxuan666

+1. On Windows, the agent defaults to PowerShell which causes frequent syntax errors and wasted tokens when the model generates bash-style commands. The integratedTerminalShell setting in the UI is misleading — it only affects the integrated terminal, not the agent shell. Having [windows].agent_shell in config.toml would be a huge improvement for Windows users with Git Bash installed.

K-Jotaro avatar Aug 15 '26 10:08 K-Jotaro

Source-level confirmation of this request (codex-cli 0.154.0, Windows 11 26200):

  • codex-rs/shell-command/src/shell_detect.rs: default_user_shell_from_path() returns get_shell(ShellType::PowerShell) on Windows, and get_user_shell_path() returns None on non-Unix — so neither an env var nor a config key can change the agent's default shell today.
  • codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs: the shell is the model-provided shell argument, else session.user_shell() (that PowerShell default).
  • codex-rs/config/src/config_toml.rs / types.rs: only shell_environment_policy and allow_login_shell exist; there is no shell selector.

What works today: steering the model with an instruction like "pass shell: \"bash\" unless the task is Windows-specific". With Git for Windows bash on PATH (D:\Git\usr\bin\bash.exe here), the per-call parameter resolves to bash and commands run normally (verified end to end).

What still blocks a usable default even if the key lands: #15016 (with the Windows sandbox enabled, shell: "bash" fails with "couldn't create signal pipe, Win32 error 5") and #40328 (Desktop embedded CLI falling back to cmd.exe for an explicit bash shell).

+1 for [windows].agent_shell = "git-bash", as prototyped in #16717.

K-Jotaro avatar Sep 12 '26 16:09 K-Jotaro

I want my codex run on linux to use powershell

cloudhan avatar Sep 16 '26 05:09 cloudhan