Skip to content

Codex Desktop Windows PowerShell cwd / PSDrive Initialization Bug #29688

Open

Description

@kyzr-dev

What version of the Codex App are you using (From “About Codex” dialog)?

26.616.71553

What subscription do you have?

Plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Codex Desktop on Windows appears to initialize the PowerShell shell tool with split and inconsistent filesystem state. The managed/.NET current directory is set to the requested workspace, but PowerShell's provider/session state and native child-process cwd are not. This causes commands to run from an unrelated drive (F:/, in my case) or temp directory, prevents normal PowerShell cmdlets from resolving, and prevents native tools like git from seeing the workspace. Additionally, the PowerShell FileSystem provider lacks the C: drive entirely, even though .NET APIs can access C:\... paths.

Initial Symptoms With F: Mounted

The shell tool was invoked with:

workdir = C:\Users\user.name\Documents\Codex\2026-06-23\i

Observed:

[System.IO.Directory]::GetCurrentDirectory()
# C:\Users\user.name\Documents\Codex\2026-06-23\i

$ExecutionContext.SessionState.Path.CurrentFileSystemLocation
# F:\

cmd.exe /c cd
# F:\

PowerShell filesystem drives were:

Temp | FileSystem | C:\Users\U9974~1.NAM\AppData\Local\Temp\
F    | FileSystem | F:\

Missing expected drives:

C:
I:

Core PowerShell management cmdlets were unavailable:

Get-Location
# The term 'Get-Location' is not recognized...

Get-PSDrive
# The term 'Get-PSDrive' is not recognized...

PSModulePath included the expected PowerShell 7 module directory:

C:\Program Files\PowerShell\7\Modules

The module file existed according to .NET APIs:

[System.IO.Directory]::Exists('C:\Program Files\PowerShell\7\Modules\Microsoft.PowerShell.Management')
# True

[System.IO.Directory]::GetFiles('C:\Program Files\PowerShell\7\Modules\Microsoft.PowerShell.Management')
# C:\Program Files\PowerShell\7\Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1

But importing failed:

Import-Module Microsoft.PowerShell.Management
# The specified module 'Microsoft.PowerShell.Management' was not loaded because no valid module file was found in any module directory.

PowerShell provider path resolution failed for absolute C:\... paths:

$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath('C:\Users\user.name\Documents\Codex\2026-06-23\i')
# Cannot find drive. A drive with the name 'C' does not exist.

After Relaunching Codex And Ejecting F:

I fully relaunched Codex and ejected the removable F:\ drive.

Observed:

[System.IO.Directory]::GetCurrentDirectory()
# C:\Users\user.name\Documents\Codex\2026-06-23\i

$ExecutionContext.SessionState.Path.CurrentFileSystemLocation
# Temp:\

$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath('.')
# C:\Users\U9974~1.NAM\AppData\Local\Temp\

cmd.exe /c cd
# C:\Users\U9974~1.NAM\AppData\Local\Temp\

PowerShell filesystem drives then included only:

Temp | FileSystem | C:\Users\U9974~1.NAM\AppData\Local\Temp\

Still missing:

C:
I:

Core management cmdlets were still unavailable:

Get-Location
# The term 'Get-Location' is not recognized...

Get-PSDrive
# The term 'Get-PSDrive' is not recognized...

Native commands could not access the workspace:

cmd.exe /c "dir C:\Users\user.name\Documents\Codex\2026-06-23\i"
# Access is denied.

git -C C:\Users\user.name\Documents\Codex\2026-06-23\i status --short
# fatal: not a git repository (or any of the parent directories): .git

But .NET APIs inside the shell could still see the workspace:

[System.IO.Directory]::Exists('C:\Users\user.name\Documents\Codex\2026-06-23\i')
# True

[System.IO.Directory]::GetFileSystemEntries('C:\Users\user.name\Documents\Codex\2026-06-23\i')
# C:\Users\user.name\Documents\Codex\2026-06-23\i\outputs
# C:\Users\user.name\Documents\Codex\2026-06-23\i\work

What steps can reproduce the bug?

Reproducibility

These commands will reproduce the important state:

$ExecutionContext.SessionState.Drive.GetAll() | ForEach-Object { "$($_.Name)|$($_.Provider.Name)|$($_.Root)|$($_.CurrentLocation)" }
[System.IO.Directory]::GetCurrentDirectory()
$ExecutionContext.SessionState.Path.CurrentFileSystemLocation
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath('.')
cmd.exe /c cd
Get-Location
Get-PSDrive -PSProvider FileSystem
git status --short

What is the expected behavior?

When the shell tool is invoked with workdir = C:\Users\user.name\Documents\Codex\2026-06-23\i:

  • PowerShell provider cwd should be the workspace, not F:\ or Temp:\
  • Native child processes should inherit the workspace cwd
  • The FileSystem provider should expose at least the workspace drive, C:
  • Built-in cmdlets from Microsoft.PowerShell.Management, such as Get-Location, Get-ChildItem, and Get-PSDrive, should be available or importable
  • Native commands such as git status should execute in the workspace

Additional information

Why Care?

This breaks normal Codex repository workflows on Windows:

  • git, cmd, and other native tools run from the wrong directory
  • Relative paths resolve to the wrong location
  • Absolute workspace paths may fail through PowerShell provider/native tooling
  • Common PowerShell commands fail because core modules/cmdlets are unavailable
  • The assistant may misdiagnose cwd/env-var issues as repo problems

Potential Culprit(s)

This looks like a Codex Windows shell-host or sandbox initialization issue. The host seems to patch the managed/.NET current directory to the requested workspace but does not initialize PowerShell's FileSystem provider drives, provider cwd, or native subprocess cwd consistently.

The presence of a removable F:\ drive influenced the wrong cwd, but after ejecting it the issue persisted with Temp:\, which suggests F:\ was a symptom or selected fallback rather than the root cause.

My workstation does have a dual PowerShell/PwSh installation (5.1.26100.8655 and 7.5.5), which may be a contributing environment detail, but even that should not normally cause a PowerShell 7 runspace to omit C: from FileSystem PSDrives while .NET can access C:\.

Suggested Areas of Concern

  • How Codex Desktop creates Windows PowerShell runspaces for the shell tool
  • Whether sandboxing/brokering strips or fails to add the workspace drive as a FileSystem PSDrive
  • Whether the host sets only [System.IO.Directory]::CurrentDirectory but not PowerShell provider location
  • Whether native child process cwd is initialized from a stale parent cwd rather than the requested workdir
  • Whether removable or mapped drives affect initial drive selection/fallback

Activity

  1. added
    app
    on Jun 23, 2026
  2. added
    bug
    windows-os
    sandbox
    tool-calls
    on Jun 23, 2026
  3. arturohernandez10 commented on Oct 9, 2026

    @arturohernandez10

    Additional reproduction: PowerShell InitializeDefaultDrives error only inside Codex Windows sandbox

    I'm seeing a related PowerShell filesystem-provider initialization warning in Codex Desktop for Windows when running commands inside its sandbox.

    Environment

    • Codex Desktop app version: not yet collected
    • Windows version/build: not yet collected
    • Workspace: local folder on C:\ (not a mapped drive)
    • Two mapped drive letters, H: and Z:, point to the same Azure Files SMB share. Storage account and local username omitted for privacy.

    Exact warning

    Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed.
    

    Steps and observations

    1. In regular Windows PowerShell, Get-PSDrive -PSProvider FileSystem returns C:, H:, and Z:, without the startup warning.
    2. In Codex Desktop's normal sandboxed command execution, Get-PSDrive -PSProvider FileSystem returns C: and H: but not Z:. The InitializeDefaultDrives warning appears before the output; the command still runs.
    3. In Codex, powershell.exe -NoProfile -Command "'PowerShell started successfully'" completes and prints the expected output, but the warning is still shown. Since Codex may launch an outer PowerShell before this nested process, this does not conclusively rule out profiles.
    4. Run Write-Output "sandbox comparison" outside the sandbox, using Codex's approval/escalation mechanism. It prints sandbox comparison, exits successfully, and does not show the initialization warning.

    Expected: PowerShell's FileSystem provider initializes without a warning for commands executed in the Windows sandbox.

    Actual: The warning occurs in sandboxed execution, not in normal PowerShell or in the approved unsandboxed Codex command. Commands still execute successfully.

    Interpretation: The sandbox environment is the demonstrated trigger, but the root cause is not confirmed. Differences in sandboxed process context, filesystem permissions, or drive visibility may be relevant. There is no evidence yet that either Azure Files mapping is broken. No drives, PowerShell settings, or system permissions were changed during testing.

    This is related to #29688, but C: remains available and the warning is non-fatal in my reproduction.

  4. arturohernandez10 commented on Oct 9, 2026

    @arturohernandez10

    Environment details for the reproduction above

    Collected from a normal, unsandboxed PowerShell session:

    Component Version / Details
    Codex Desktop 26.1002.7124.0
    Codex package OpenAI.Codex_26.1002.7124.0_x64__2p2nqsd0c76g0
    Windows Windows 11 Pro, 64-bit
    Windows OS version 10.0.26200
    Windows build 26200
    Windows PowerShell 5.1.26100.9549
    PowerShell 7 7.6.6
    .NET Framework 4.8.9345.0
    Codex CLI Not installed / not on PATH
    SystemRoot C:\WINDOWS
    Process architecture 64-bit

    Additional context

    • Both Windows PowerShell 5.1 and PowerShell 7 are installed.
    • The issue occurs in the Codex Windows desktop app, not the standalone CLI.
    • The SystemRoot value above was verified outside the sandbox; its value inside the sandbox has not yet been checked.
    • The previously reported sandboxed-versus-unsandboxed reproduction remains unchanged.

    These details correspond to Codex Desktop version 26.1002.7124.0 and Windows build 26200.

  5. sylw114 commented on Oct 11, 2026

    @sylw114

    Additional reproduction on 2026-10-11: explicit workspace cwd, PowerShell falls back to C:\

    I reproduced the missing workspace PSDrive / split-cwd behavior in the current Codex Desktop executor. The assistant's environment context and the exec_command payload both specified G:\agent, but relative PowerShell commands ran at C:\.

    Environment:

    • Bundled executor: codex-cli 0.162.0-alpha.17.2 (from the executable used by the running desktop session).
    • Windows: Microsoft Windows NT 10.0.29680.0, x64.
    • PowerShell: 7.6.5.
    • Workspace: G:\agent, on a local fixed ReFS volume, not a mapped/network drive.
    • About-dialog Desktop version: not collected.

    The same read-only probe with the same explicit workdir produced:

    Observation Normal sandboxed execution Approved execution outside the sandbox
    Get-Location C:\ G:\agent
    [Environment]::CurrentDirectory G:\agent G:\agent
    Get-PSDrive -Name G absent present
    [IO.Directory]::Exists('G:\') false true
    [IO.Directory]::Exists('G:\agent') true true
    Set-Location -LiteralPath 'G:\agent' fails: drive G does not exist succeeds

    The mismatch reproduced with both the default startup and login: false (-NoProfile). A direct cmd.exe tool invocation using the same sandbox/workdir returned G:\agent for cd, so the process cwd and the PowerShell provider cwd must be distinguished.

    Minimal probe (no directory enumeration, no writes):

    # exec_command: workdir = G:\agent, login = false
    $location = Get-Location
    [ordered]@{
        powershellLocation = $location.Path
        processCurrentDirectory = [Environment]::CurrentDirectory
        workspaceDriveRegistered = [bool](Get-PSDrive -Name G -ErrorAction SilentlyContinue)
        workspaceRootExists = [IO.Directory]::Exists('G:\')
        workspaceDirectoryExists = [IO.Directory]::Exists('G:\agent')
    } | ConvertTo-Json

    Actual sandboxed output:

    {
      "powershellLocation": "C:\\",
      "processCurrentDirectory": "G:\\agent",
      "workspaceDriveRegistered": false,
      "workspaceRootExists": false,
      "workspaceDirectoryExists": true
    }

    The practical impact was observed: an initial unqualified, non-recursive Get-ChildItem listed the C: root even though the tool explicitly requested the project workdir. This looks like an execution-environment mismatch rather than the model lacking the project's cwd.

    I also inspected freshly updated official main, 8c0f7011674145da7e10627769fb221c74fbf7a0:

    Source inspection is not a claim that I built and reproduced this on main; the runtime reproduction is on the bundled executor version above. The exact cause of the missing drive/root visibility still needs investigation.

    Please validate the PowerShell provider cwd before allowing a user script to run, initialize the workspace drive/location where supported, and fail clearly if it cannot be established. Regression coverage should include a workspace on a non-system fixed volume and the missing-PSDrive case; checking only the OS process cwd will miss this behavior.

  6. laipeng101 commented on Oct 15, 2026

    @laipeng101

    Reproduction with a concrete Win32 error: sandboxed network-drive resolution aborts PowerShell PSDrive initialization

    Adding diagnostic evidence to the sandbox-only InitializeDefaultDrives reports above. This is a read-only reproduction on Windows 11 using PowerShell 7.6.6 in the Codex Windows command executor. The Codex desktop build number was not collected. It is related to the PSDrive initialization aspect of this issue; I have not reproduced the separate split-CWD symptom.

    Observed behavior

    • A regular Windows Terminal PowerShell 7.6.6 session starts cleanly, with FileSystem PSDrives C:, D: and Temp:.
    • Each independent Codex PowerShell invocation starts with the same warning (garbled Chinese text, but recognizable FileSystem / InitializeDefaultDrives). Commands then run and return exit code 0.
    • Within Codex, Get-PSDrive -PSProvider FileSystem shows C:, D:, W:, X:, Y:, Z: but no Temp:. The additional four drives have network type according to .NET and names/descriptions associated with other mounts.
    • [IO.DriveInfo]::GetDrives() succeeds: C: and D: are Fixed, while W: through Z: are Network, each with IsReady = True. net use and subst show no mappings.
    • The sandbox's TEMP/TMP point to an AppContainer-specific temporary directory. [IO.Path]::GetTempPath() resolves successfully and Test-Path confirms that directory exists.
    • Test-Path on the local workspace returned True (existence only; no file-read test was performed). Ordinary Chinese output from PowerShell/Python displays correctly. A failed drive-initialization warning appears before script execution and does not appear in the later $Error collection.

    Focused repro: invoke PowerShell's own network-drive resolver

    This read-only probe locates and invokes the same FileSystemProvider helper used during initialization, reporting the deepest exception without modifying mounts or ACLs:

    $flags = [Reflection.BindingFlags]::Static -bor [Reflection.BindingFlags]::NonPublic
    $method = [Microsoft.PowerShell.Commands.FileSystemProvider].GetMethod(
        'GetRootPathForNetworkDriveOrDosDevice', $flags
    )
    foreach ($drive in [IO.DriveInfo]::GetDrives()) {
        if ($drive.DriveType -ne [IO.DriveType]::Network) { continue }
        try {
            $null = $method.Invoke($null, [object[]]@($drive))
            "$($drive.Name): OK"
        } catch {
            $ex = $_.Exception
            while ($ex.InnerException) { $ex = $ex.InnerException }
            $code = if ($ex -is [ComponentModel.Win32Exception]) {
                $ex.NativeErrorCode
            } else { 'n/a' }
            "$($drive.Name): $($ex.GetType().Name), Win32=$code"
        }
    }

    Result (the probe catches the errors, so its process exit code was 0):

    W:\: Win32Exception, Win32=5
    X:\: Win32Exception, Win32=5
    Y:\: Win32Exception, Win32=5
    Z:\: Win32Exception, Win32=5
    

    Win32 error 5 = ERROR_ACCESS_DENIED.

    Why this likely explains the startup warning

    In PowerShell v7.6.6, FileSystemProvider.GetRootPathForNetworkDriveOrDosDevice first tries the UNC resolver. On Win32Exception with driveInfo.IsReady == true, it falls back to GetSubstitutedPathForNetworkDosDevice. InitializeDefaultDrives calls that helper for each Network drive, but the per-drive catch only handles IOException, SecurityException, and UnauthorizedAccessException; Temp: is added after the drive loop. The fallback implementation can throw Win32Exception on a failed QueryDosDeviceW call.

    Thus, a permission-denied exception during fallback resolution is consistent with both the startup warning and missing Temp:. The probe invokes the combined helper, not each underlying API separately; it does not by itself prove that QueryDosDeviceW is the exact failing API, or which drive is first to abort initialization.

    This looks like an interaction between the Codex Windows sandbox's visible network-type drives/permissions and PowerShell's insufficiently isolated per-drive error handling. Potential fixes to investigate: make drive visibility/resolution consistent within the sandbox, and/or ensure one inaccessible mapped/pseudo-network drive cannot abort all FileSystem PSDrive initialization. No system settings, drive mappings, ACLs, or project files were changed.

  7. GravuTrad commented on Oct 22, 2026

    @GravuTrad

    Tested PowerShell fix candidate: isolate access-denied errors per drive

    Following the network-drive resolver findings above, we reproduced the warning with bundled PowerShell 7.6.5, then rebuilt the actual System.Management.Automation engine twice (original and patched) and tested both inside the affected Codex Windows sandbox. Bundled executor: 0.163.0-alpha.10.2.

    This targets the InitializeDefaultDrives warning and missing Temp: symptom. We have not reproduced or fixed this issue's separate split-CWD symptom.

    Mechanism and proposed patch

    GetRootPathForNetworkDriveOrDosDevice throws Win32Exception, native error 5 / ERROR_ACCESS_DENIED, in the sandbox; the same helper succeeds outside it. The existing per-drive catches in InitializeDefaultDrives handle IOException, SecurityException and UnauthorizedAccessException, but not Win32Exception. This aborts initialization before Temp registration.

    Proposed patch against PowerShell v7.6.5:

    --- a/src/System.Management.Automation/namespaces/FileSystemProvider.cs
    +++ b/src/System.Management.Automation/namespaces/FileSystemProvider.cs
    @@ -987,6 +987,11 @@ namespace Microsoft.PowerShell.Commands
                         catch (System.UnauthorizedAccessException)
                         {
                         }
    +                    catch (Win32Exception e) when (e.NativeErrorCode == 5) // ERROR_ACCESS_DENIED
    +                    {
    +                        // A mapped drive may be visible but its metadata inaccessible in a sandbox.
    +                        // Skip this drive without aborting initialization of other drives and Temp:.
    +                    }
                     }
                 }
     

    This skips one inaccessible drive without changing permissions or swallowing other Win32 codes. The helper probe does not establish which underlying native API fails.

    Actual engine validation in the affected sandbox

    Each rebuilt engine was loaded in a private copy of the same bundled host/runtime/modules, using -NoLogo -NoProfile -NonInteractive, the same workspace and the same probe. Loaded engine hashes were distinct. Child stderr was captured separately from the unchanged parent shell's warning.

    Shell Initialization warning Temp registered Workspace read/create/move/overwrite
    Installed control Yes No Pass
    Rebuilt original Yes No Pass
    Rebuilt patched engine No; child stderr empty Yes Pass

    All three exited 0 and reported the correct provider and process CWD. The installed engine's SHA256 was verified unchanged.

    Six extracted-method checks also passed: original reproduces native error 5; patched method completes; original resolver still denies access afterward; a denied first drive does not prevent later-drive/Temp registration; accessible network drives remain registered; unrelated Win32 error 6 propagates. These are supplementary harness checks, not upstream provider tests.

    Build adaptations, identical for both variants: local SDK 10.0.402 instead of 10.0.303; empty root Directory.Build.props/targets to isolate enclosing-project settings; skip git describe when explicit ReleaseTag=7.6.5 is supplied for the source archive. Official resource/type generation was run. Both engine builds completed with zero warnings/errors. This rebuilt the engine, not the entire distribution.

    Separate temporary-file problem remains

    Both engines can create a file in the sandbox-provided temporary directory, but File.Move(source, target, overwrite: true) fails there with UnauthorizedAccessException / 0x80070005, including when the destination is new. The same operations succeed inside the workspace.

    With process-scoped TEMP/TMP pointing to a private workspace subdirectory, the patched-engine probe passes create/move/overwrite/cleanup in both locations. Separately, the existing application test executable passes 94/94 tests under the installed shell with that scoped temporary directory. An earlier redirected suite run under the candidate was interrupted before completion and is not counted as a completed suite.

    No persistent environment changes, drive disconnections, ACL changes or security relaxation were made for these comparisons. The PowerShell patch does not fix the temporary-directory restriction or pre-start sandbox errors.

    Please review this narrowly filtered catch with PowerShell maintainers, add upstream provider regression coverage, and assess integrating a corrected bundled engine into Codex. The sandbox temporary-directory rename behavior merits separate investigation.

    Only this sanitized report and source diff are shared; no private logs, binaries, machine identifiers or project paths are attached.

  8. GravuTrad commented on Oct 22, 2026

    @GravuTrad

    Follow-up: temporary-file rename failure isolated; explicit filesystem grant fixes the tested directory

    We investigated the separate temporary-file problem mentioned in the previous comment. This is now more specific than moving TEMP to the workspace.

    Native reproduction

    In the sandbox-provided AppContainer temporary directory, using fresh disposable files:

    • Create/write succeeds.
    • Opening the source with DELETE access succeeds.
    • Deleting the source succeeds.
    • MoveFileExW with flags 0, REPLACE_EXISTING, COPY_ALLOWED or WRITE_THROUGH fails with error 5.
    • Extended-length paths and SetFileInformationByHandle(FileRenameInfo) also fail with error 5.
    • NtSetInformationFile(FileRenameInformation), with an absolute NT destination path, returns 0xC0000022 / STATUS_ACCESS_DENIED.

    The same probes succeed in the workspace. Outside the sandbox, they also succeed against the exact same recorded AppContainer temp directory, not a different user temp directory. No ACL changes were made. This rules out a failure unique to PowerShell/.NET and does not support simply adding DELETE rights to the source.

    Tested policy correction

    We launched a fresh Codex sandbox with:

    • features.prefer_mxc=true;
    • --include-managed-config retained;
    • a temporary named permission profile inheriting from :workspace;
    • an explicit write entry for only the exact previously recorded AppContainer temp directory;
    • a read-only control directory inside the workspace.

    Conceptual configuration (placeholder path; not a broad grant to Packages or a user profile):

    [permissions.temp_probe]
    extends = ":workspace"
    
    [permissions.temp_probe.filesystem]
    "C:/.../Packages/sandbox.{recorded-id}/AC/Temp" = "write"
    "D:/.../readonly-control" = "read"

    In that single sandbox invocation:

    Location Create / open DELETE / delete Native rename Replace existing target, verify new content
    Recorded temp with explicit write grant Pass Pass Pass
    Workspace Pass Pass Pass
    New sandbox's own implicit temp Pass Access denied Access denied
    Explicit read-only control Write denied as expected Not attempted Not attempted

    All eight rename variants, including replacement and the absolute native NT call, pass on the explicitly granted temp path. The read-only control confirms the sandbox was enforcing restrictions. The command exited 0; all disposable probe directories were cleaned up.

    This is a successful fresh-sandbox policy experiment, not a live mutation or repair of the original sandbox. It demonstrates that explicit filesystem authorization makes the affected recorded directory support normal rename semantics. It does not identify the exact Windows enforcement implementation responsible for the implicit-temp inconsistency.

    Integration recommendation

    Ensure that the final per-sandbox temporary directory actually used by child processes is consistently included in the explicit native filesystem policy when the canonical permission profile permits temporary writes. Resolve/provision this directory before final policy construction where supported, and keep the child's effective TEMP/TMP aligned with that directory. Do not grant the entire Packages directory, weaken read-only exclusions, or authorize a temp path when the selected policy forbids temporary writes.

    Add an integration test that launches the real sandbox and exercises create, rename to a new name, replacement with content verification, deletion, and a read-only negative control. Checking only directory existence or successful file creation misses this defect.

    Relevant source inspection (not a rebuilt Codex claim): temporary-path materialization uses the supplied command environment. Maintainers should compare those resolved paths with the effective AppContainer TEMP/TMP after process launch. A mismatch is a hypothesis to verify, not asserted as the proven internal cause.

    One experiment detail: adding legacy sandbox_workspace_write.writable_roots while selecting :workspace did not supply the needed explicit grant. The named profile above did. The current built-in profile resolver explicitly ignores that legacy roots field for the built-in profile.

    No installed binary, persistent configuration, ACL, or drive mapping was changed. The earlier 94/94 application-suite result used workspace TEMP/TMP; it was not rerun for this narrower policy experiment. The PowerShell initialization patch remains a separate fix.

  9. jorgebaptista commented on Nov 4, 2026

    @jorgebaptista

    The same split state happens with the CLI on a second local drive, not only on network or missing drives. Setup:

    • Windows 11, codex-cli 0.159.3, codex exec;
    • [windows] sandbox = "elevated"; the sandbox log shows MXC;
    • PowerShell 7.6.9;
    • the workspace is a git repository on a local NTFS D: drive;
    • sandbox read-only or workspace-write.

    Output of one command in the sandbox:

    dotnet=D:\...\repo           [IO.Directory]::GetCurrentDirectory()
    location=C:\                 (Get-Location).Path
    cmd=C:\                      cmd /c cd
    drives=C,D,E,F,G,H,Temp      Get-PSDrive -PSProvider FileSystem
    

    Unlike the reports above, the D drive does exist in the PowerShell session. Even so, the provider location and the native child cwd still start at C:\.

    Consequence under workspace-write: relative writes go to C:\ and are refused (Access to the path 'C:\probe.txt' is denied), so a delegated task cannot write to its worktree.

    With -s danger-full-access, the same run starts in the workspace: (Get-Location).Path is the repository. Reproduced on 4 November 2026.

  10. denelon commented on Nov 5, 2026

    @denelon

    A Microsoft MXC issue documents a closely matching PowerShell working-directory mismatch:

    Both reports observe that the process-level current directory is set to the requested workspace while PowerShell’s provider location points elsewhere, causing relative paths and native tooling to operate from the wrong directory. The Codex report additionally describes missing filesystem PSDrives and unavailable PowerShell modules, so its full symptom set is broader. The shared split between process cwd and PowerShell provider location suggests the MXC issue may be directly relevant, without establishing that every reported symptom has the same cause.

    Drafted with GitHub Copilot assistance.
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

    appbugsandboxtool-callswindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions