Windows: allow configuring the default session shell via config
Summary
Codex currently defaults to PowerShell for the Windows session shell path. That makes it hard for users who primarily work in Git Bash or another already-supported shell to make that shell the default for Codex sessions.
I prepared a change that adds an explicit Windows config entry:
[windows]
shell_path = "C:\\Program Files\\Git\\bin\\bash.exe"
When windows.shell_path is configured, Codex uses that executable as the default session shell. When it is not configured, the current behavior remains unchanged and Windows still falls back to PowerShell.
Why this approach
I intentionally implemented this as an explicit config option rather than automatic shell detection:
- Windows does not have a single reliable equivalent to Unix
$SHELL - multiple
bash.exevariants may exist on PATH (Git Bash, WSL, MSYS2, etc.) - explicit configuration is easier to reason about and avoids changing behavior for existing users
Implementation notes
The change currently does the following:
- adds
windows.shell_pathto config parsing - supports
profile.windows.shell_pathoverriding the top-level value - validates the configured executable against Codex's existing built-in shell detection/execution logic
- uses the configured shell as the default session shell when no internal
user_shell_overrideis provided - updates the Windows shell tool descriptions so they refer to the configured default shell rather than hardcoding PowerShell wording
- updates docs and regenerates
config.schema.json
This does not try to add arbitrary shell adapter support. The configured path must resolve to a shell executable already supported by Codex's built-in shell handling.
Testing performed
I ran:
cargo +stable test -p codex-toolscargo +stable test -p codex-core config::tests::config_loads_windows_shell_path_from_toml -- --exact --nocapturecargo +stable test -p codex-core config::tests::profile_windows_shell_path_overrides_top_level_value -- --exact --nocapturecargo +stable test -p codex-core config::tests::invalid_windows_shell_path_fails_config_load -- --exact --nocapturecargo +stable test -p codex-core shell::tests::configured_windows_shell_path_uses_bash -- --exact --nocapturecargo +stable test -p codex-core shell::tests::invalid_windows_shell_path_is_rejected -- --exact --nocapturecargo +stable test -p codex-core shell::tests::finds_powershell -- --exact --nocapturecargo +stable test -p codex-core shell::tests::detects_powershell_as_default -- --exact --nocapture
Branch / commit
I could not open a PR directly because the repository currently limits PR creation to collaborators.
The proposed change is available here:
- branch:
LXL47/codex:feat/windows-shell-path-config - commit:
0d9010493
If this direction is acceptable, I can keep the branch available for maintainers to review or cherry-pick from.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗