Skip to content

Allow PowerShell or WSL execution environment to be selected per project and per chat #36098

Open

Description

@MikeeeGit

What variant of Codex are you using?

App

What feature would you like to see?

Title: Support per-project and per-chat Windows/WSL environments with reliable path handling

I regularly use Codex on Windows 11 with both Windows-native and WSL-native projects:

  • C:\platform-tools requires the Windows agent and PowerShell.
  • /home/mike/repos/PortfolioWatch requires the WSL agent and an Ubuntu-22.04 terminal.

Currently, changing the Agent or Integrated Terminal between PowerShell and WSL behaves like a global setting. Switching environments can make existing chats appear to disappear, disrupt project grouping, break file and attachment links, and cause the file browser to resolve paths using the wrong environment.

For example, Codex can incorrectly reinterpret WSL paths as Windows paths and produce invalid hybrids such as C:\home\... or C:\mnt\....

These path forms need to remain distinct and be translated deliberately:

  • Windows native: C:\platform-tools
  • WSL native: /home/mike/repos/PortfolioWatch
  • Windows access to WSL: \\wsl.localhost\Ubuntu-22.04\home\mike\repos\PortfolioWatch
  • WSL access to Windows: /mnt/c/...

Please add:

  1. A default execution environment for each saved project:

    • Windows/PowerShell
    • WSL, including distribution selection
    • Inherit global default
  2. A per-chat environment override when creating or reopening a chat.

  3. Independent configuration of:

    • Agent execution environment
    • Integrated terminal shell
  4. Persistent environment identity for every chat, including its working directory and path format.

  5. Correct Windows-to-WSL and WSL-to-Windows path translation for the file browser, attachments and clickable file links.

  6. A consistent task list where chats remain visible regardless of the currently selected environment.

Expected behaviour:

  • Opening C:\platform-tools automatically restores the Windows agent and PowerShell terminal.
  • Opening /home/mike/repos/PortfolioWatch automatically restores the Ubuntu-22.04 WSL agent and terminal.
  • Windows-native and WSL-native chats can remain open simultaneously.
  • Switching chats does not require changing a global setting or restarting Codex.
  • Changing the integrated terminal does not reinterpret the chat’s working directory.
  • The file browser never constructs invalid hybrid paths.
  • Existing file and attachment links continue working after switching between Windows and WSL chats.

This would make Codex substantially more reliable for Windows power users who work across both native Windows and WSL projects every day.

Additional information

No response

Activity

  1. added
    enhancement
    on Jul 30, 2026
  2. added
    app
    windows-os
    session
    config
    on Jul 30, 2026
  3. tidytorch commented on Aug 6, 2026

    @tidytorch

    I am running into this exact problem on Windows 11 with WSL2 and would like to add a concrete workflow proposal.

    I regularly work on both:

    • Windows-native projects that need PowerShell, Windows-installed tools, and Windows path semantics.
    • WSL-native repositories that need a Linux shell, Linux-installed tools, Linux paths, and repositories stored under /home/....

    Today, the Codex desktop app treats the Agent Environment as a global setting. Moving between these projects requires opening Settings, switching between Windows native and WSL, and restarting the app. This is disruptive and makes it easy to run a command in the wrong environment. It also makes it difficult to keep Windows and WSL chats open at the same time.

    The ideal solution would be similar to VS Code Remote - WSL:

    1. Let each saved project/workspace bind to an execution target, such as:
      • Windows native / PowerShell
      • WSL2 / a selected distribution (for example, Ubuntu)
      • SSH or another remote target in the future
    2. Automatically connect to or start the correct agent when the project is opened.
    3. Allow chats for Windows and WSL projects to remain open concurrently, without changing a global setting or restarting Codex.
    4. Persist the execution target, working directory, OS, shell, and path format as part of the project/chat identity.
    5. Keep the Agent Environment and Integrated Terminal Shell independently configurable, while allowing a project profile to set both together by default.
    6. Display the active target clearly in the UI and preserve correct Windows/WSL path translation for files, attachments, links, Git, and worktrees.

    As a fallback or complementary solution, please consider supporting independent local configuration roots for the stable and beta desktop apps. At present, the two Windows app variants share %USERPROFILE%\\.codex, so settings such as the WSL agent selection affect both. An app-specific setting or environment variable could allow, for example:

    • Stable: %USERPROFILE%\\.codex
    • Beta: %USERPROFILE%\\.codex-beta

    Ideally the desktop app would honor an app-specific CODEX_HOME (or provide an equivalent setting), with safe migration/copy support for auth, sessions, skills, and SQLite state.

    Per-project execution targets would solve the underlying workflow problem for most users; independent stable/beta configuration would provide a useful isolation mechanism for users who intentionally use the two builds for different environments.

    This is related to #23071 and #17173, but I wanted to add the VS Code Remote-style connection model and the stable/beta configuration fallback as one concrete user workflow.

  4. tidytorch commented on Aug 6, 2026

    @tidytorch

    One more important part of this request is the quality of the Windows-side WSL workflow itself. The current experience is not comparable to VS Code Remote - WSL.

    For a WSL-native repository, the Windows app currently makes users manually navigate or type paths such as \\wsl.localhost\\Ubuntu\\home\\<user>\\<repo> in the Windows file picker. Opening a folder through the Windows UI does not reliably establish a durable WSL project connection, and the app can still treat the project as a Windows-side folder with /mnt/c or other hybrid path semantics.

    The Open in VS Code workflow also does not behave like VS Code Remote - WSL: it should open a WSL remote window connected to the selected distribution and Linux working directory, rather than merely opening the UNC path as a Windows folder. For example, a project at /home/alice/src/project in Ubuntu should open as a VS Code WSL: Ubuntu workspace rooted at /home/alice/src/project.

    A complete Windows + WSL experience should therefore include:

    • A first-class WSL project picker that lists installed distributions and Linux home directories.
    • A persistent project connection containing the distro, Linux path, and execution target.
    • Automatic reconnection to the same WSL agent when the project is reopened.
    • An Open in VS Code (WSL) action that uses the WSL remote connection semantics, not a Windows UNC folder open.
    • Correct and explicit separation between /home/..., /mnt/c/..., and \\wsl.localhost\\... paths.
    • File previews, attachments, Git, worktrees, and clickable links that preserve the project’s native path identity.
    • The ability to keep a Windows-native project and a WSL-native project open concurrently.

    This would remove the repeated manual path selection and environment switching that currently makes Windows-side Codex much less convenient than VS Code for mixed Windows/WSL development.

  5. MikeeeGit commented on Aug 14, 2026

    @MikeeeGit
    Author

    Current-build reproducible failure: Windows-native task receives hybrid WSL/Windows runtime

    I reproduced a concrete failure on 14 August 2026 (Europe/London) in Codex Desktop package 26.803.10989.0. This turns the environment-selection problem described in this issue into a command-blocking runtime defect.

    Executive finding

    A task presented as Windows native received all of the following simultaneously:

    • a malformed mixed Windows/WSL working directory;
    • Linux shell commands dispatched through a Windows process boundary;
    • an explicit native PowerShell request rewritten to /bin/sh;
    • Browser/Chrome/Computer Use failures at the same bridge;
    • repeated approval prompts even after command prefixes were saved.

    This was not a Windows ACL/UAC or ComfyUI problem. No reviewed failure contained Access denied, UAC refusal, Windows error 1385, or a sandbox policy denial. Process creation failed before the approved command could start.

    Malformed task path

    The task workspace was shaped like this (username/project redacted):

    /mnt/c/Program Files/WindowsApps/OpenAI.Codex_26.803.10989.0_x64__2p2nqsd0c76g0/app/resources/C:\Users\<user>\Documents\Codex\...
    

    This concatenates:

    1. a WSL path to the Windows Store package;
    2. the app resources directory;
    3. a second absolute Windows C:\Users\... path.

    The task UI identified the task as Windows native, but its execution metadata and shell routing did not agree.

    Exact command failures

    A basic shell command failed before execution:

    exec_command failed for `/bin/bash -lc pwd`:
    CreateProcess { message: "Rejected(\"Failed to create unified exec process:
    No such file or directory (os error 2)\")" }
    

    Using an explicitly valid Linux work directory such as /tmp did not fix it, so the malformed default cwd was not the only fault.

    An explicit PowerShell request was still rewritten to a Linux shell and failed:

    exec_command failed for `/bin/sh -c '$PSVersionTable.PSVersion.ToString()'`:
    CreateProcess { message: "Rejected(\"Failed to create unified exec process:
    No such file or directory (os error 2)\")" }
    

    Another observed failure was:

    Unable to spawn /mnt/c/Users/<user>/.codex/tmp/arg0/.../codex-linux-sandbox
    because it doesn't exist
    

    Therefore the selected PowerShell executable was not being honoured. A Windows process boundary was trying to launch missing Linux paths.

    Approval/full-access behaviour

    Approvals were accepted and saved for ordinary commands and an explicit Windows PowerShell executable, including ls, find, jq, cp, ip, curl, and PowerShell itself. The task continued to prompt or fail.

    This is consistent with failure during environment classification/shell construction, before approval policy can make the requested process runnable. Repeatedly granting permissions cannot repair that state, which is why the UI made this look like a user permissions problem when it was not.

    Independent application proof

    The blocked task needed to reach a healthy local Windows service at http://127.0.0.1:8188.

    • WSL-side access through the inferred gateway timed out.
    • A separately forced native Windows PowerShell process reached 127.0.0.1:8188/system_stats successfully.
    • The Windows service reported healthy status and the expected GPU/runtime.
    • The same native route successfully submitted and completed the workload.

    That isolates the failure to Codex Desktop task/runtime routing rather than the local service, firewall, Windows account, or workload.

    Reproduction

    1. Run Codex Desktop on Windows and select Windows native.
    2. Create/open a projectless task under C:\Users\<user>\Documents\Codex.
    3. Observe a cwd shaped like /mnt/c/.../app/resources/C:\Users\....
    4. Run pwd, including with /tmp as explicit workdir.
    5. Observe /bin/bash -lc pwd failing through Windows CreateProcess with os error 2.
    6. Explicitly select/call powershell.exe and request $PSVersionTable.PSVersion.
    7. Observe dispatch rewritten to /bin/sh -c.
    8. Save/approve the executable prefix and retry; the pre-execution failure persists.
    9. Attempt Browser/Chrome/Computer Use against a healthy local Windows service; initialization fails through the same environment bridge.

    Expected behaviour

    Official documentation says the Windows app uses the Windows-native agent by default, where commands run in PowerShell; WSL is a separate agent selection that requires a restart. A Windows-native task must therefore have one coherent contract for host platform, agent platform, cwd namespace, shell, sandbox, plugins, and local-loopback access.

    Likely fault boundary

    High confidence: Desktop task creation/handoff plus app-server environment state, specifically:

    • platform identity;
    • cwd normalization;
    • unified-exec shell dispatch;
    • stale WSL state after switching back to Windows;
    • propagation of the same bad namespace into Browser/Computer Use.

    The task's local host ID was not sufficient to establish which OS runtime actually owned command execution.

    User impact

    • Multiple task handoffs failed to preserve the working Windows workflow.
    • Browser and local service access were unavailable.
    • A render that should take about one minute was blocked for hours.
    • Repeated approvals consumed user time without affecting the fault.
    • The resulting experience strongly suggested account/Windows permissions were at fault even though the evidence says otherwise.

    Closely matching open reports

    This remains reproducible in the 26.803 package family. Please treat it as a current runtime bug, not only an enhancement request. Private task/thread IDs and sanitized logs can be supplied directly to OpenAI Support rather than posted publicly.

  6. rbnrong commented on Nov 20, 2026

    @rbnrong

    A data point for the distro + Linux path proposal above: on Windows desktop 26.1117.31558, my Ubuntu project actually had that pair in desktop state: hostId = remote-wsl:Ubuntu and a Linux remotePath. What broke during the transition was the link from an existing chat to that project. Its saved assignment still referred to the old local project ID, even though both project entries described the same repository.

    I matched the legacy WSL UNC roots to the remote projects by distro and Linux path and repointed the surviving assignments. I could then open old chats under the Ubuntu project in Desktop and continue them from the WSL CLI. The matching and assignment preview shows which fields were involved.

    One acceptance test I’d add to this request is to reopen a pre-migration chat from its project, then check both its sidebar membership and which host executes the next turn. A newly created chat can pass while the old one still routes to Windows. I haven’t tested the per-chat override or simultaneous Windows/WSL sessions you propose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    appconfigenhancementsessionwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions