Windows Desktop hangs forever on startup: sync WSL PATH probe (spawnSync bash -ilc) has no timeout on the main thread
What version of the Codex App are you using (From “About Codex” dialog)?
26.1103.4239.0 (MSIX OpenAI.Codex_26.1103.4239.0_x64__2p2nqsd0c76g0, primary runtime framework 26.1104.1290.0)
What subscription do you have?
Pro
What platform is your computer?
Microsoft Windows NT 10.0.26340.0 x64 (WSL 2, several distros installed)
What issue are you seeing?
The desktop app hangs forever on startup: the main window either never appears or appears as "Not Responding". IsHungAppWindow is true for the main window, and the main log stops right after cloud_picker_host_cache_read. The process never recovers; the only way out is to kill it.
Root cause (from inspecting the main process and app.asar):
At startup the app enumerates WSL distros as hosts. When it builds the host config for a WSL host, it computes codex_cli_command. That goes through the synchronous variant of getInteractivePathFromWslBash(distro), which runs:
wsl.exe -d <distro> -- /usr/bin/bash -ilc "printf '%s\n' '__CODEX_WSL_PATH_START__'; printf '%s\n' \"$PATH\"; printf '%s\n' '__CODEX_WSL_PATH_END__'"
via child_process.spawnSync("wsl.exe", args, { encoding, env, windowsHide }) with no timeout, on the Electron main thread. While the hang is happening, the main thread sits in a WrQueue wait (spawnSync's nested loop) and that wsl.exe child of the main ChatGPT.exe never exits.
The async variant of the same helper already uses execFile(..., { timeout: 3e4 }). The sync one has no timeout. So one distro whose interactive login shell does not exit is enough to freeze the whole app forever. Distros are probed one after another, so each one has to be fixed before the app can start. In my case it got past one custom distro and then hung on the next one.
In my case bash -ilc never exits because the distro's default user has a login shell wrapper like exec sudo -n /usr/local/sbin/enter-wrapper /usr/bin/fish -l "$@". Ubuntu 24.04's sudo (1.9.15) has Defaults use_pty. When sudo has no foreground terminal, which is the case for a hidden child of a GUI app, the command is left in a background process group of the new pty. bash -i then sends itself SIGTTIN and stays stopped (T state in ps) forever. Running bash -ilc directly (wsl -e) returns in about 300 ms.
Related but different issues:
- #22376: another sync
spawnSync("wsl.exe")on the main thread (resolveCodexHomeFromWsl), causing multi-second freezes. - #30048: Desktop starts WSL distros on startup even in Windows-native mode. That's the same probing, which here turns into a permanent hang.
What steps can reproduce the bug?
- Create a WSL distro where
wsl.exe -d <distro> -- /usr/bin/bash -ilc 'echo hi'doesn't return when launched without a foreground TTY. For example, set the default user's login shell to a script that runsexec sudo -n /path/to/wrapper /usr/bin/fish -l "$@", with sudoersDefaults use_pty(the Ubuntu 24.04 default). Any.bashrcthat blocks would work too. - Launch the Codex desktop app.
- The window never becomes responsive.
wsl.exe -d <distro> -- /usr/bin/bash -ilc "printf ... __CODEX_WSL_PATH_START__ ..."is a child of the mainChatGPT.exeprocess and never exits. Killing thatwsl.exeunblocks the main thread.
What is the expected behavior?
A misbehaving WSL distro should never be able to block app startup:
- Add a timeout to the sync
spawnSync("wsl.exe", ...)call, matching the 30s used by the async variant. Better still, don't run it synchronously on the main thread at all. Building the host config could use the asyncgetInteractivePathFromWslBashor defer the PATH probe until the WSL host is actually used. - If the probe for a distro fails or times out, skip that distro or fall back to the default PATH (
${CODEX_INSTALL_DIR:-$HOME/.local/bin}:$PATH, which the code already handles when the probe returns null). - Consider running the probe with
--exec/-e(bypassing the user's default login shell) or without-i.
Additional information
Workaround: make bash -ilc exit in every distro. In my case that meant adding a sudoers drop-in, Defaults!/usr/local/sbin/enter-wrapper !use_pty, in each affected distro. After that the probe returns in about 250 ms and the app starts normally.
Independent confirmation with a different, much more common trigger: a plain Docker auto-start line in ~/.bashrc.
Environment
- OpenAI.Codex 26.1106.6628.0 (also observed on 26.1103.7773.0)
- Windows 11 Insider 26H2, build 26300.9818
- WSL2, Ubuntu, default distro; login shell is bash; systemd is not enabled (PID 1 is
init) - Docker installed inside the distro;
dockerdnot running
Trigger
~/.bashrc contained a Docker auto-start:
if ! pgrep -x dockerd > /dev/null 2>&1; then
sudo service docker start > /dev/null 2>&1
fi
sudo requires a password in this distro. When the app runs the PATH probe there is no foreground TTY, so sudo waits forever.
Observed
-
wsl.exe -d Ubuntu -- /usr/bin/bash -ilc 'echo ok'hangs indefinitely when launched from the hidden child context. -
bash --noprofile --norc -ilc 'echo ok'returns immediately. -
Process tree while the app is hung:
wsl.exe -d Ubuntu -- /usr/bin/bash -ilc "printf ... $PATH ..."→sudo service docker start -
The main-process log stops after
[wsl] eligible distro list ...and never reaches[startup][renderer] app routes mounted(waited more than 15 minutes). The window is "Not Responding".
After the workaround
Guarded the line so it is skipped for bash -c invocations, then made it fully non-blocking (sudo -n + timeout + background):
- the exact
bash -ilcprobe now returns in ~0.3 s - the app logs
[startup][renderer] app routes mounted after 23246ms - all
ChatGPT.exeprocesses reportResponding=True, and no Application Hang events are recorded
Notes
- This is the same failure mode described above, but without a custom login-shell wrapper or
Defaults use_pty. Any rc/profile command that blocks or prompts — Docker/systemd start, conda init, a network mount, password-requiring sudo — is enough. - Since
dockerdwas not running, the condition was hit on every launch. - Suggested fix is unchanged: put a timeout on the synchronous
spawnSync("wsl.exe", ...)call, or use the async/off-main-thread probe and fall back to a default PATH when it fails.
I reproduced this on Codex for Windows 26.1117.3838.0 with Ubuntu 24.04 under WSL. In my case, ~/.bashrc starts keychain, which invokes ssh-add and waits for an SSH key passphrase. The app's bash -ilc PATH probe never returned, and the desktop window became unresponsive.
Terminating just the wsl.exe child running the __CODEX_WSL_PATH_START__ probe immediately restored the window. I then guarded the existing keychain invocation in ~/.bashrc with if [[ ${BASH_EXECUTION_STRING-} != *"__CODEX_WSL_PATH_START__"* ]]; then ...; fi. The same PATH probe completed, and Codex stayed responsive after a normal relaunch. This also preserves the usual SSH passphrase prompt in my terminal.
Confirmed: SSH keychain passphrase prompt in .bashrc causes the same startup deadlock.
I encountered the same issue with Codex Desktop on Windows and WSL2 (Ubuntu 24.04).
Root cause:
My ~/.bashrc contained the following line:
eval $(keychain --eval --quiet id_rsa)
When launching an interactive Ubuntu terminal, keychain may prompt for the SSH private key passphrase.
During Codex startup, I observed two wsl.exe processes running:
wsl.exe -d Ubuntu-24.04 -- /usr/bin/bash -ilc "..."
The command was probing $PATH, using the __CODEX_WSL_PATH_START__ and __CODEX_WSL_PATH_END__ markers.
The main ChatGPT.exe window became permanently unresponsive. Reinstalling the application did not help.
Confirmation:
Killing the two blocked wsl.exe processes immediately unblocked the Codex desktop application.
Successful workaround:
I modified ~/.bashrc to prevent keychain from running during bash -c invocations:
if [[ -z ${BASH_EXECUTION_STRING+x} && -t 0 ]]; then
eval "$(keychain --eval --quiet id_rsa)"
fi
After this change:
wsl -d Ubuntu-24.04 -- /usr/bin/bash -ilc 'echo CODEX_PROBE_OK'returns immediately without prompting for a passphrase.- Codex Desktop starts almost instantly.
- Normal interactive Ubuntu terminals retain the SSH keychain functionality.
Suggested fix:
The synchronous WSL PATH probe should not be allowed to block the Electron main thread indefinitely. An asynchronous implementation with a timeout would prevent password prompts or other blocking shell startup commands from freezing the entire application.
This is another real-world confirmation of the issue, triggered by SSH keychain rather than sudo, Docker, or a custom login shell.
Still reproducing on OpenAI.Codex 26.1117.4957.0 (build 29803), Windows 11 Pro 26100 x64 — and worth flagging a key trigger/call-site detail beyond hanging .bashrc prompts: this also freezes startup for 25–85 seconds on completely normal stopped WSL2 distros with autoConnect: false and zero WSL projects.
Exact call chain (from app.asar in build 29803)
- On Windows, the renderer unconditionally calls
appServices.wslConnections.setEnabled(platform === "windows")on startup, even when running in Windows-native mode with no WSL projects configured. runRemoteWslRefresh()enumerates all WSL2 distros viawsl.exe --list --verboseand callsthis.catalog.update({ wsl })(all entries haveautoConnect: false).remoteConnectionCatalog.onDidChangesynchronously invokesthreadReadState'sonHostsChangedlistener on the Electronbrowser_mainthread.threadReadStateiterates over all configured host IDs (including every disconnected WSL distro) and callsgetHostConfigForHostId(hostId)to construct a fullHostConfig.- Constructing the WSL
HostConfigunconditionally buildscodex_cli_commandvia the synchronousgetInteractivePathFromWslBash(distro)helper →child_process.spawnSync("wsl.exe", ["-d", distro, "--", "/usr/bin/bash", "-ilc", ...])with no timeout, sequentially booting every stopped WSL2 distro on the main thread (including distros without/usr/bin/bashsuch asdocker-desktopor Alpine). threadReadStatethen passes thatHostConfigintogetHostKey(), which only hashes[kind, id, distro]and completely discardscodex_cli_command.
Observed impact
- Regression window in local logs: Build
29030had no startup stall; starting on build29513through29803, 7/7 consecutive launches frozebrowser_mainfor 23.9s–84.1s (25.1s,23.9s,84.1s,42.2s,48.1s,45.6s,55.0s), with every log resuming at the exact millisecond ofreconcile_completed/refresh_wsl_completedfollowed immediately bymain_thread_jank_snapshot. - Repro timing across 5 stopped WSL2 distros (no blocking
.bashrc):- 2 stopped systemd-enabled distros:
19.6s+24.0s - 1 stopped Podman WSL distro:
3.0s - 2 non-bash distros (Alpine +
docker-desktop,rc=127):1.8s+1.0s - Total synchronous main-thread freeze:
49.3s(also delaying secondaryavatarOverlayrenderer mount to60,403ms).
- 2 stopped systemd-enabled distros:
Suggested fix
- Avoid building
codex_cli_commandinthreadReadState: Compute the host key directly from the catalog metadata (kind,hostId,distro) instead of callinggetHostConfigForHostId()for disconnected/non-autoConnectWSL distros. - Defer & make WSL PATH probing async: Never call
spawnSync("wsl.exe", ...)on the Electron main thread; defergetInteractivePathFromWslBashuntil a WSL connection is actually opened, use the async helper with a bounded timeout, and fall back to the default PATH on failure/timeout.
Independent confirmation: this issue is still reproducible on Codex Desktop for Windows, MSIX version 26.1120.6357.0, as of November 26, 2026.
Observed behavior
The entire desktop interface repeatedly becomes unresponsive. The native Windows codex.exe app-server is running, but Codex still launches WSL PATH probes despite these settings in ~/.codex/config.toml:
[desktop]
runCodexInWindowsSubsystemForLinux = false
integratedTerminalShell = "powershell"
Process tree captured during the freeze
ChatGPT.exe (PID 24128)
wsl.exe (PID 35924)
wsl.exe (PID 35960)
Both WSL processes were executing the following command (distribution name redacted):
wsl.exe -d <distro> -- /usr/bin/bash -ilc "printf '%s\n' '__CODEX_WSL_PATH_START__'; printf '%s\n' \"$PATH\"; printf '%s\n' '__CODEX_WSL_PATH_END__'"
Confirmed recovery
Running the following command in an elevated PowerShell session while Codex was frozen immediately restored UI responsiveness, without restarting Codex:
Get-CimInstance Win32_Process -Filter "Name='wsl.exe'" | Where-Object { $_.CommandLine -match '__CODEX_WSL_PATH_START__' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }
Switching to native Windows execution and PowerShell did not prevent the freeze. Previous attempts to repair the WSL shell environment were not a reliable solution.
This independently confirms the association between the blocking WSL PATH probe and the desktop UI freeze on a newer build. The exact reason the Linux shell fails to exit on my system has not been established. The process evidence is consistent with the synchronous main-thread call described in the original report; I have not independently inspected the application bundle.
Requested fix
- Make WSL discovery and PATH probing asynchronous and enforce a finite timeout.
- Do not launch or probe WSL distributions automatically when native Windows execution is selected, or provide a separate persistent setting to disable WSL discovery entirely.
- If a WSL probe fails, skip that host without blocking the desktop UI or interrupting native sessions.
WSL is occasionally required for legitimate Linux testing, so permanently removing or disabling it is not an acceptable long-term solution. Terminating the probe is a temporary recovery method, not a fix.
Possible fix: ChatGPT Desktop freezes on Windows due to WSL and SSH keychain initialization
I managed to identify and fix this issue on my machine without reinstalling ChatGPT or disabling WSL.
Affected environment:
- ChatGPT Desktop:
26.1120.6357.0 - Codex Primary Runtime:
26.1123.915.0 - Windows 11
- WSL2 / Ubuntu 24.04
Root cause:
During startup, ChatGPT executes bash -ilc through WSL to retrieve the Linux PATH.
My .bashrc contained the following line:
eval "$(keychain --eval --quiet id_ed25519)"
Keychain was waiting for my SSH passphrase, causing the entire ChatGPT interface to freeze.
Running wsl --shutdown while ChatGPT was frozen immediately restored responsiveness.
Diagnostic steps:
time timeout -k 2s 10s bash --noprofile --norc -ilc 'echo OK'
time timeout -k 2s 10s bash -ilc 'echo OK'
The first command completed in 6 ms. The second requested my SSH passphrase and timed out with exit code 124.
Solution:
Back up your .bashrc:
cp ~/.bashrc ~/.bashrc.bak
Replace the keychain initialization line with:
if [[ -t 0 && -t 1 ]]; then
eval "$(keychain --eval --quiet id_ed25519)"
fi
Validate the configuration:
bash -n ~/.bashrc
This prevents keychain from requesting a passphrase when Bash is launched without terminal input and output.
There is no need to remove your SSH passphrase, disable WSL, or reinstall ChatGPT.
Recommendation for OpenAI: WSL environment discovery should not block the main application thread. Please consider asynchronous execution and an appropriate timeout.
Hopefully this helps others experiencing the same issue!
Additional confirmed reproduction: Debian WSL2 with Apache startup in .bashrc
I experienced the same desktop application freeze.
Environment:
- Windows 11 26H2, build 26300.9974
- OpenAI.Codex 26.1120.6357.0
- WSL2 with Debian
- ChatGPT web works normally.
- Windows application repair did not resolve the issue.
Diagnostic findings:
Running wsl --shutdown immediately restores application responsiveness.
The following command returns OK immediately:
wsl -d Debian -- timeout -k 2s 10s bash --noprofile --norc -ilc 'echo OK'
However, running Bash with its normal startup configuration triggers a sudo password prompt:
wsl -d Debian -- timeout -k 2s 10s bash -ilc 'echo OK'
The offending line was found in ~/.bashrc:
sudo service apache2 start
This provides additional evidence that password-requiring commands in WSL shell initialization can freeze the entire desktop application.
Suggested improvements:
- Perform WSL environment discovery asynchronously.
- Enforce a timeout on shell initialization.
- Avoid sourcing interactive shell configuration when discovering environment variables, where possible.
- Keep the desktop UI responsive if WSL initialization fails.
A blocking shell initialization command should never freeze the entire application.