Skip to content

Windows sandbox denies writes inside a workspace configured as writable #51476

Open

Description

@hazemsaker400-prog

Hello. I’m using the Codex desktop app on Windows with a local project at C:\jarvis.

This workspace is configured for writing (workspace-write), but write attempts inside the project fail with “Access to the path is denied.” I reproduced this when trying to create a new file with both Set-Content and the patch tool. The Windows ACL lists Modify access for Authenticated Users.

I fully restarted Codex and tried again, but the error persists. The Windows sandbox setting in my Codex config is:

[windows]
sandbox = "unelevated"

What is the supported way to diagnose or repair the sandbox so Codex can write to its configured workspace? I do not want to change Windows security policies.

Activity

  1. added
    bug
    app
    windows-os
    sandbox
    on Oct 6, 2026
  2. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. dngtech commented on Oct 25, 2026

    @dngtech

    Additional reproduction: write access denied with elevated Windows sandbox

    I am seeing a similar write-denial symptom on Windows, but with a different sandbox configuration. I am sharing the observations here in case they are related; I have not established that the root cause is the same.

    Environment

    • Codex CLI: codex-cli 0.164.0
    • Windows version/build: not yet recorded
    • User configuration previously observed: [windows] sandbox = "elevated"
    • Active agent execution metadata: workspace-write, with the project workspace reported as the writable root.

    Observed behavior

    1. Read-only access to the test workspace succeeded.
    2. The inspected ACLs showed inherited Modify permissions for CodexSandboxUsers and Authenticated Users. This ACL output does not establish effective sandbox authorization.
    3. The runner attempted to create a missing tests\fixtures\runs directory and reported Access to the path ... is denied.
    4. A separate one-time temporary-file probe, executed through the same Codex agent command path inside the existing tests\fixtures directory, failed during .NET File.WriteAllText with:
      • Outer exception: System.Management.Automation.MethodInvocationException
      • FullyQualifiedErrorId: UnauthorizedAccessException
      • Message: Access to the path ... is denied
      • Reported outer exception HRESULT: 0x80131501
    5. The temporary file was confirmed absent after cleanup.
    6. The probe printed PROBE_RESULT=FAIL, but the execution tool returned exit code 0 because the script caught the exception and did not explicitly exit nonzero. This was a probe exit-status handling issue, not a successful write.
    7. The runner startup handler requests exit code 78, while the earlier execution tool reported 1; the propagation path remains unverified.
    8. A direct codex sandbox read-only command succeeded. An MXC compatibility probe failed with native MXC is unavailable on this executor. No relevant sandbox denial log was available, so the denying layer could not be identified.

    The test workspace path and project files have been omitted from this report for privacy. No ACLs, sandbox settings, or security settings were changed, and the 11-case test batch was not rerun.

    Current assessment: The observed write-denial behavior is reproducible through the Codex agent execution path, but the root cause remains inconclusive. I have not established whether Windows filesystem authorization, the Codex sandbox, or another execution layer denied the operation. I also have not performed an equivalent write test outside Codex to compare the behavior.

    Could the maintainers advise which non-destructive diagnostic is supported for distinguishing these possibilities under the Windows elevated sandbox, without disabling sandbox protection or switching to Full Access?

  4. dngtech commented on Oct 25, 2026

    @dngtech

    Follow-up: Host PowerShell write test succeeds, Codex agent write test fails

    I performed a one-time A/B comparison against the same existing tests\fixtures directory.

    Outside Codex — ordinary VS Code PowerShell Extension terminal

    • Windows identity: DESKTOP-DCE4NA1\Admin
    • Workspace path verified.
    • Result: WRITE_OK, READBACK_OK, CLEANUP_OK; TEMP_FILE_ABSENT
    • Overall: PROBE_RESULT=PASS

    Through the Codex agent command-execution path

    • The same target directory was used.
    • .NET File.WriteAllText failed with UnauthorizedAccessException and Access to the path ... is denied.
    • The temporary file was confirmed absent afterward.
    • Overall: PROBE_RESULT=FAIL

    The host-side test used a unique temporary filename, created it without overwriting an existing file, verified its contents, and removed it successfully. Neither test modified the project source, ACLs, or sandbox configuration.

    Additional read-only inspection found:

    • The workspace root is owned by the interactive Windows user.
    • tests and tests\fixtures are owned by CodexSandboxOffline.
    • The displayed ACLs contain inherited Modify allow rules.
    • The latest available sandbox log shows repeated SetFileAttributesW failures for C:\Users\Default, but the subsequent setup-refresh entries report errors=[]. I found no log record that directly links that warning to the write failure in tests\fixtures.

    Assessment: Host-side file creation, readback, and deletion succeed, while the equivalent write through the Codex agent path fails. This strongly suggests a difference in effective execution permissions or sandbox enforcement, but does not establish the exact cause. The owner difference is an observation, not a confirmed cause.

    Could maintainers recommend the supported diagnostic for identifying the effective Windows security context and the specific layer denying the Codex agent's write, without disabling the sandbox or switching to unrestricted access?

  5. dngtech commented on Oct 25, 2026

    @dngtech

    Environment detail: Windows version/build confirmed

    I have now recorded the Windows environment details that were missing from my earlier report:

    • Windows product: Windows 10 Pro
    • Windows release: 22H2, based on OS build 19045
    • OS build number reported by Get-ComputerInfo: 19045
    • Architecture: 64-bit
    • Get-ComputerInfo reports WindowsVersion = 2009; I am including this as the raw property value rather than interpreting it as the marketing release.

    The previously reported A/B result remains unchanged: a temporary-file create/read/delete probe succeeds in the ordinary VS Code PowerShell terminal but fails with UnauthorizedAccessException through the Codex agent execution path.

    No ACLs, ownership, sandbox settings, or project files have been changed during this additional environment check. The underlying cause remains undetermined.

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

    appbugsandboxwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions