[Windows][WSL] Integrated terminal auto-closes when Git availability probe fails
Open 💬 7 comments Opened Aug 11, 2026 by rbogasch
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
[!IMPORTANT] Current status — 2026-08-24: the relevant defects remain in Store package26.818.5229.0. Inspection of an isolated copy of the originalapp.asar(SHA-256C5D839BC9B122B7EF2A2F0F45186B3E5895923DE5B6CEF5253C936FE670C0479) confirms that both duplicated WSL builders still use--cd <cwd-or-.> -- <bash> -lc <command>rather than an explicit--execboundary, and terminal creation still awaits the optional worktree-repository lookup without a failure boundary. Newer-build evidence was cross-posted to the Git tracker and terminal tracker. The full impact analysis, detailed root cause, production-style fix, and requested regression coverage are in this comment. No maintainer, milestone, linked fix, or fixed Microsoft Store build has been identified yet.
[Windows][WSL] Integrated terminal closes immediately when Git availability probe fails
- Codex App: internal release
26.803.81509(Microsoft Store package26.803.10989.0) - Platform: Windows 10 x64 (
19045), WSL2.7.11, Ubuntu-based distro - Subscription: not disclosed
- Related / duplicate tracking:
- #35119 — underlying WSL Git availability regression
- #37104 — primary integrated-terminal startup/panel failure report; same downstream failure path
- #37821 — same terminal regression across builds 26.730 and 26.803
- #37771 — same immediate close and
wsl.exeexit4294967295; already closed as a duplicate
Issue
- With the Codex App execution environment set to WSL, opening the integrated terminal makes the drawer appear briefly and close immediately.
- The failure occurs in every chat and project, including newly created projects.
- WSL and Git work normally outside the app.
- The same app can open an integrated terminal in native Windows mode.
- Git-backed desktop features also report
Git is unavailable.
Exact failure chain
- In WSL mode,
codexHome()resolves to a Windows UNC path such as\\wsl.localhost\<distro>\home\<user>\.codex. platformPath()simultaneously selects the POSIX parser.- The Git availability probe evaluates
platformPath.parse(codexHome).root, producing an empty string. - The WSL spawn wrapper substitutes
.and invokeswsl.exe --cd .. - That fails before the shell or Git starts with
Wsl/E_INVALIDARG. - The worker reports
Git is unavailable. - Terminal creation performs optional Git/worktree environment enrichment before PTY creation. The rejection is propagated as a terminal-session error, the renderer cleans up the terminal, and
node-pty.spawnis never reached.
Reproduction
- Select WSL as the Codex App execution environment and integrated-terminal shell.
- Open any project or chat.
- Open the integrated terminal.
- Observe that it closes immediately.
- Confirm that
git --versionand a normal WSL shell work outside the app.
Expected
- The integrated terminal should open even when optional Git metadata is unavailable.
- WSL subprocesses should receive an absolute Linux working directory, or omit
--cd; the wrapper should not generate--cd .. - This matches the documented purpose of the integrated terminal, including running Git operations: https://learn.chatgpt.com/docs/integrated-terminal
Excluded causes
- WSL installation or distro startup
- Git installation or repository health
- ConPTY, the bundled
node-pty, or shell startup - Project-specific paths or existing project state
- Sandbox setup, app cache, or profile reset
7 Comments
Additional source-level fix proposal and local validation:
/(or another valid absolute Linux path) for the availability probe;codexHomeback to Linux form before POSIX parsing; or--cdwhen no valid cwd is available.wsl.exe --cd .. On the affected setup:--cd .→Wsl/E_INVALIDARG--cd /→ unchanged Git probe succeedsPotential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Closing as a duplicate of #37104. This issue remains as the sanitized exact trace for build 26.803.81509; the underlying Git-probe regression is #35119, with related terminal reports #37821 and #37771.
Reopened. The previous ‘not planned’ closure was performed by the reporter while consolidating potential duplicates; it was not a maintainer disposition. This report remains distinct enough to track because it provides an exact, reproducible two-layer failure on build 26.803.81509: the WSL Git availability probe generates the invalid \wsl.exe --cd .\ invocation, and that optional Git-enrichment rejection is then treated as fatal by terminal creation before \
ode-pty.spawn\. Related terminal reports are #37104, #37821, and #37771; the underlying Git regression is #35119.
Additional reproduction on Windows 11, using the same Microsoft Store package:
Environment
26.803.10989.026100(Windows PowerShell5.1.26100.8875)2.9.4.0, Ubuntu, WSL2, kernel6.18.35.2C:and accessed by the WSL agent through/mnt/c/...A/B result
This shows that the failure is tied to the WSL agent initialization path and occurs before the selected terminal shell is spawned. Selecting PowerShell is not a workaround while the agent remains in WSL mode.
Checks and logs
Application Error,Windows Error Reporting, orAppHangevent is recorded when the drawer closes.node-pty/ ConPTY native files are present.bundled_executable_relocation_failed ... sourcePath=...\\app\\resources\\codex-resources\\bwrap ... errorCode=ENOENTFailed to apply worktree shell environment config ... Git is unavailableThis is consistent with the failure chain described in this issue and adds an A/B case showing that the documented independent terminal selection cannot bypass the WSL-agent-side failure.
I can reproduce this on a newer Microsoft Store build, so the issue does not appear to be fixed yet.
My setup is:
26.810.7004.0262002.7.11.06.18.33.2-microsoft-standard-WSL2When I click the integrated terminal button, the panel appears for a moment and immediately closes. I tried selecting both WSL and PowerShell as the integrated terminal, but the result is the same.
While monitoring the processes started by Codex, I saw it run the equivalent of:
This exits before Git or the selected terminal shell starts, with:
I also tested the WSL commands directly from PowerShell to rule out a broken WSL installation:
wsl -d Ubuntu-24.04 --exec /bin/bash --noprofile --norcworks.--cd .fails withWsl/E_INVALIDARG.--cd ~,--cd /home/<user>, an absolute/mnt/c/...path, or an absolute Windows path works.git --versionworks normally in both Windows and WSL.It looks like this fails during the WSL Git availability/environment check, before the PTY or the chosen terminal shell is started. That would also explain why selecting PowerShell does not help.
The WSL command builder should avoid passing the relative path
.towsl.exe --cd. It could translate the path to an absolute Linux path or omit--cdwhen there is no valid working directory. A failure in this optional Git/worktree environment lookup also should not prevent the terminal itself from opening.Request for maintainer ownership and a shipped fix
This remains unresolved as a product issue and needs an official response, an owner, and a fixed Microsoft Store build.
This is not a cosmetic terminal problem and it is not a broken local Git or WSL installation. It breaks two core Desktop workflows for Windows users who select WSL:
The scope is potentially broad because the failure is in the shared Windows/WSL adapter and Git worker, not in a particular repository. Multiple users have reproduced it across Windows 10 and 11, multiple WSL releases and distributions, and multiple Codex Desktop builds. Git and WSL continue to work outside the app. Repairing or reinstalling the Store package does not correct shipped application logic.
OpenAI's own documentation describes the integrated terminal as project/worktree-scoped and specifically lists Git operations such as
git statusandgit pull --rebaseas intended uses: https://learn.chatgpt.com/docs/integrated-terminal. When the same first-party WSL integration prevents both repository detection and terminal creation, users cannot reasonably repair that from settings. The fix belongs in the shipped application.Given that this is a first-party desktop integration, the reasonable expectation is an official patched build and a clear release confirmation—not requiring customers to inspect or modify packaged JavaScript. Please assign an owner, acknowledge whether the reproduction is confirmed, and identify the first Store package containing the fix.
Root cause — general explanation
The Windows Desktop app crosses three path/process domains: Windows paths, WSL/Linux paths, and
wsl.execommand-line arguments. The availability probe constructs a WSL process using a working directory derived through the wrong path semantics. That makes a healthy WSL Git installation appear unavailable.The terminal then performs Git/worktree environment enrichment before creating its PTY. Although that enrichment is optional metadata, its rejection is allowed to escape. The renderer consequently treats terminal creation as failed and removes the tab. One WSL-boundary bug therefore disables Git integration and is amplified into a total terminal failure.
Root cause — detailed failure chain
The original reproducible path is:
codexHome()can be represented on the Windows side as a UNC path such as\\wsl.localhost\<distro>\home\<user>\.codex.platformPath()implementation.``
text
``wsl.exe -d <distro> --cd . -- /usr/bin/bash -lc <git-probe>
wsl.exe --cd .fails withWsl/E_INVALIDARGbefore Bash or Git starts.gitManager.getWorktreeRepository(...)to enrich the shell environment before PTY creation.node-pty.spawnand the user's selected shell are never reached.There is also evidence in #35119 of a second WSL command-construction defect on newer builds: even with an absolute
--cd /, using bare--can allow an earlier/default shell to expand the nested probe before the intended/usr/bin/bash -lcreceives it. On affected systems, variables such as$gitarrive empty and the probe still fails. The WSL builder should use the documented--exec/-eform and preserve the intended argv boundary.On the currently installed Store package
OpenAI.Codex_26.818.5229.0_x64, an isolated copy of the original runtime still contained the unguarded terminal worktree lookup. A guarded, byte-length-preserving local A/B patch again made the terminal survive the Git lookup failure. This validates the error-boundary fix, but binary patching is only diagnostic evidence and is not an acceptable distribution mechanism.What a clean production fix should look like
This needs defense in depth because Git capability detection and terminal availability are separate concerns.
1. Make the Git probe WSL-native
Choose the working directory from the execution host, not by parsing a Windows UNC string with POSIX rules:
Before adding
--cd, require a host-valid absolute path. Never substitute.for a missing WSL cwd; either use a known valid absolute Linux directory or omit--cd.2. Preserve the WSL argv boundary
Invoke the intended executable explicitly:
Do not use a bare
--path that permits an unintended default-shell expansion of the nested Git probe. Arguments should be passed as an argv array, not reconstructed as another command string.3. Never make optional Git metadata a prerequisite for the terminal
The local diagnostic patch used the minified equivalent of this behavior:
Git enrichment may improve the terminal environment, but it must not determine whether a terminal exists. A visible warning is preferable to silently destroying the panel.
4. Add regression coverage at the actual boundaries
At minimum, automated coverage should include:
codexHomerepresented as a\\wsl.localhost\...UNC path.--cdand an explicit--execexecutable.getWorktreeRepositoryfailures while asserting that PTY creation still occurs and the terminal remains visible.Requested resolution
Please provide:
Until that happens, this issue should remain open. The local wrapper proves that the two immediate failure points can be corrected, but users should not be expected to maintain a patched copy of a signed Store application's runtime to restore documented core functionality.