Windows workspace-write sandbox can change project ownership to CodexSandboxOffline and cause persistent write failures

Open 💬 8 comments Opened Apr 9, 2026 by gsr-4325
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the IDE extension are you using?

VS Code extension version: 26.318.11754

What subscription do you have?

ChatGPT Plus

Which IDE are you using?

Antigravity, VS Code

What platform is your computer?

Windows

What issue are you seeing?

Title

Windows sandbox workspace-write can corrupt directory ownership to CodexSandboxOffline, causing persistent write failures until manual admin ACL repair

Summary

I hit a Windows-specific issue where Codex could write successfully in full access mode, but failed in workspace-write / custom sandbox mode for files inside my project.

The failure persisted across:

  • waiting and retrying later
  • restarting the computer
  • switching IDEs from Antigravity to VS Code

The problem was eventually traced to directory ownership / ACL corruption inside the project. Some directories and files had their owner changed to CodexSandboxOffline instead of the normal Windows user account. While that state remained, sandbox setup failed and Codex could not edit files in those locations.

Manual repair from an Administrator PowerShell session restored normal behavior.

Environment

  • OS: Windows
  • Codex sandbox mode: workspace-write
  • Approval policy: never
  • Windows sandbox setting: elevated
  • IDEs tested:
  • Antigravity
  • Visual Studio Code

Config

This is the relevant Codex config shape:

model = "gpt-5.4"
model_reasoning_effort = "low"
approval_policy = "never"
sandbox_mode = "workspace-write"

writable_roots = [
    '<PROJECT_ROOT>',
    '<ANOTHER_WORKSPACE_ROOT>'
]

[features]
multi_agent = true

[windows]
sandbox = "elevated"

What happened

I was working normally, and file edits had worked previously.

At some point:

  • the internet connection dropped
  • an IDE update had happened a few hours earlier
  • later, Codex started failing to edit a file inside the project in custom / workspace-write sandbox mode

I do not know whether the network interruption was causal, but the timeline suggests that sandbox state may have been left half-updated or recovered incorrectly after an interruption.

Initial symptoms

When Codex tried to edit a file with apply_patch, it failed with:

windows sandbox: setup refresh failed with status exit code: 1

When Codex tried a direct PowerShell rewrite of the same file, it failed with:

Access to the path '...AppConfig.ahk' is denied.

In full access mode, the same edit succeeded immediately.

Important behavior difference

  • full access: file edits succeeded
  • workspace-write / custom sandbox: file edits failed

This strongly suggested a sandbox setup / ACL issue rather than a file-content issue.

IDE switching did not fix it

I changed from Antigravity to Visual Studio Code and reopened the same chat/session context.

The failure reproduced in VS Code as well:

  • apply_patch still failed with sandbox setup refresh errors
  • direct file writes still failed with Access denied

This suggests the issue is not specific to one IDE frontend.

Restarting did not fix it

After a full machine reboot, the same write failure still happened in sandboxed mode.

In one attempt, a related launcher failure also appeared:

CreateProcessWithLogonW failed: 1056

Even after that, the underlying issue remained: sandboxed writes to the affected project path were broken.

Sandbox log evidence

The most important evidence came from the sandbox log. It showed that sandbox setup was trying to grant a write ACE to a project subdirectory and failing with Windows error 5 (Access is denied):

granting write ACE to <PROJECT_ROOT>\src\Core for sandbox group and capability SID
write ACE grant failed on <PROJECT_ROOT>\src\Core: SetNamedSecurityInfoW failed: 5
setup refresh completed with errors
setup error: setup refresh had errors

This lines up exactly with the user-visible apply_patch failure.

ACL / ownership inspection

Inspecting the project showed that:

  • the project root owner was the normal user account
  • some subdirectories were owned by CodexSandboxOffline
  • affected files under those directories were also owned by CodexSandboxOffline

Example pattern:

  • <PROJECT_ROOT> owner: normal user account
  • <PROJECT_ROOT>\src owner: CodexSandboxOffline
  • <PROJECT_ROOT>\src\Core owner: CodexSandboxOffline

This seems wrong and likely explains why sandbox ACL refresh could not proceed.

Scope of corruption

After scanning the whole project, many items had the wrong owner. In my case the scan found hundreds of mismatches, concentrated in directories like:

  • temp
  • tests
  • runtime
  • materials
  • some tracked files in project root and docs

The wrong owner observed was consistently:

CodexSandboxOffline

Repair attempt

Normal non-admin repair attempts failed:

  • icacls /setowner ... returned Access is denied
  • takeown reported that the current user did not have administrative privileges

Repair only worked from an Administrator PowerShell session.

These commands were used successfully:

takeown /F "<PROJECT_ROOT>" /R /D Y
icacls "<PROJECT_ROOT>" /setowner "<MACHINE>\<USER>" /T /C
icacls "<PROJECT_ROOT>" /inheritance:e /T /C

After that:

  • affected directories were owned by the normal user again
  • sandboxed apply_patch started working again
  • sandboxed writes to the previously failing file succeeded

Strong suspicion

My current suspicion is:

  1. Codex sandbox touched project ACLs / ownership during a degraded or interrupted state
  2. ownership on some paths was left as CodexSandboxOffline
  3. later sandbox setup attempts could no longer repair those paths
  4. full access worked because it bypassed the failing sandbox ACL setup path

I cannot prove that the network drop caused it, but the timing is suspicious. The IDE update may also have changed sandbox behavior or made a previously latent ACL problem visible.

Expected behavior

  • workspace-write should never leave project files or directories owned by a transient sandbox identity like CodexSandboxOffline
  • sandbox setup failure should not permanently poison a workspace until manual admin ACL repair is performed
  • if ACL modification fails, Codex should provide a more explicit diagnosis

Actual behavior

  • ownership of project files/directories changed to CodexSandboxOffline
  • sandbox setup started failing with SetNamedSecurityInfoW failed: 5
  • apply_patch failed with setup refresh failed
  • file writes in sandboxed mode became impossible until manual admin repair

Suggested areas to investigate

  • sandbox ownership / ACL mutation on Windows
  • recovery behavior after interrupted sandbox setup
  • behavior differences between normal online state and any offline / degraded fallback identity
  • why CodexSandboxOffline can become the owner of user project paths
  • whether IDE update + sandbox helper version change can expose or create this state

Minimal repro shape

I do not yet have a fully deterministic repro from scratch, but this was the observed sequence:

  1. Use Codex on Windows with workspace-write
  2. Successfully edit files in a project for a while
  3. Experience an interruption such as network drop and/or IDE update / restart during the same general period
  4. Later attempt an edit in the same project
  5. Observe sandbox refresh failure and Access denied
  6. Inspect owners on subdirectories and find CodexSandboxOffline

End result

The issue was only resolved after manual Administrator-level ownership repair of the project tree.

What steps can reproduce the bug?

I was using Codex on Windows with sandbox_mode = "workspace-write" and approval_policy = "never".

At first, file editing worked normally.

Later, after a period that included a network interruption and an IDE update, Codex stopped being able to edit files in the project when running in sandboxed mode.

Symptoms:

  • apply_patch failed with:

windows sandbox: setup refresh failed with status exit code: 1

  • direct file rewrite attempts failed with:

Access to the path '...AppConfig.ahk' is denied.

I confirmed that the same edit succeeded immediately in full access mode.

I also reproduced the same sandboxed write failure after:

  • waiting and retrying later
  • rebooting the computer
  • switching IDEs from Antigravity to VS Code

I inspected the sandbox log and found:

  • granting write ACE to <PROJECT_ROOT>\src\Core for sandbox group and capability SID
  • write ACE grant failed on <PROJECT_ROOT>\src\Core: SetNamedSecurityInfoW failed: 5

I then inspected file ownership and found that some project paths were owned by CodexSandboxOffline instead of my normal Windows user account.

Example:

  • <PROJECT_ROOT> owner: normal user
  • <PROJECT_ROOT>\src owner: CodexSandboxOffline
  • <PROJECT_ROOT>\src\Core owner: CodexSandboxOffline

After manually repairing ownership and ACLs from an Administrator PowerShell session, sandboxed writes started working again.

Uploaded thread: 019d6ccf-f4c0-72c2-9943-26f7321c67ad

What is the expected behavior?

workspace-write mode should not change project files or directories to be owned by a transient sandbox identity such as CodexSandboxOffline.

If sandbox ACL setup fails, it should not leave the workspace in a permanently broken state where Codex can no longer edit files until manual Administrator-level repair is performed.

Codex should either:

  • preserve the original ownership correctly, or
  • fail safely without corrupting ownership / ACL state, and
  • report a clearer diagnostic if Windows ACL mutation fails.

Additional information

The issue appeared to be environment-independent at the IDE layer:

  • it happened in Antigravity
  • it also happened in VS Code

Rebooting did not fix it.

The issue was only resolved after running Administrator-level repair commands on the project tree, for example:

takeown /F "<PROJECT_ROOT>" /R /D Y
icacls "<PROJECT_ROOT>" /setowner "<MACHINE>\<USER>" /T /C
icacls "<PROJECT_ROOT>" /inheritance:e /T /C

View original on GitHub ↗

8 Comments

github-actions[bot] contributor · 4 months ago

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

  • #15777
  • #17065
  • #16643
  • #16347
  • #15850

Powered by Codex Action

mickitty0511 · 4 months ago

For windows users, worktrees development are not functioning. this issue is applied to me currently since the first launch of codex. This situation getting us worse in productivity and ci/cd. Those who see this issue and are on the same situation, give thumbs up to the issue; otherwise we won't get a full functionality with codex.

floxrot · 3 days ago

I can provide a deterministic reproduction for this issue.

Environment:

  • Codex Desktop for Windows: 26.818.8289.0
  • command runner: 0.149.0-alpha.4.3
  • sandbox mode: workspace-write
  • Windows user: domain account
  • workspace on a local drive

Reproduction:

  1. Start with an existing empty directory owned by the normal Windows user:

``text
D:\Projects\secondary-repository
``

  1. Add it as an additional writable workspace root to an existing Codex task.
  1. Let Codex execute the following through a normal sandboxed command:

``powershell
git -C "D:\Projects\secondary-repository" init -b main
Copy-Item "D:\Projects\source\README.md"

"D:\Projects\secondary-repository\README.md"
```

  1. The command initially succeeds.
  1. Inspect ownership afterwards:
  • workspace root: normal Windows user
  • newly created .git tree: CodexSandboxOffline
  • copied README.md: CodexSandboxOffline
  1. Execute any subsequent sandboxed command.

The next sandbox refresh fails before the requested command starts:

deny ACE failed on D:\Projects\secondary-repository\.git:
SetNamedSecurityInfoW failed for D:\Projects\secondary-repository\.git: 5
setup refresh completed with errors
setup error: setup refresh had errors

A single affected additional write root then prevents commands from starting even when the current working directory is a different, healthy repository.

In this reproduction, multiple objects were owned by CodexSandboxOffline, including .git, its contents, and the copied README. The pre-existing workspace root remained owned by the normal user.

Recovery was possible only after fully closing Codex and running an owner-only repair from a separate elevated PowerShell:

icacls "D:\Projects\secondary-repository" `
    /setowner "DOMAIN\USERNAME" /T /C

No ACL reset, inheritance change, or DACL modification was required. After restarting Codex, the sandbox smoke tests succeeded again.

This was not caused by a Git or commit skill. The repository was initialized directly by a sandboxed git init command. The critical transition is creating a new repository or file inside an added write root under the sandbox identity.

Expected behavior:

  • Files and .git created through workspace-write should not be left owned by CodexSandboxOffline.
  • A newly created repository should remain usable by later sandbox refreshes.
  • One broken secondary write root should produce a precise path and ACL diagnostic instead of only helper_unknown_error.
alexanderfedyunin-bit · 3 days ago

Confirmed again on Codex Desktop for Windows, app package version 26.818.8289.0 (bundled command runner 0.149.0-alpha.4.3).

The local executor fails before creating even a read-only process:

helper_unknown_error: setup refresh had errors

The underlying sandbox log is explicit (workspace path redacted):

deny ACE failed on <WORKSPACE>\.codex: SetNamedSecurityInfoW failed: 5
setup refresh: processed 3 write roots (read roots delegated)
setup refresh completed with errors
setup error: setup refresh had errors

Filesystem inspection of the failing directory:

  • owner: CodexSandboxOffline
  • ACL inheritance: enabled
  • no explicit deny ACE present
  • not a junction or symlink
  • directory is empty
  • workspace root is owned by the normal Windows user

The failure repeats on every sandbox setup refresh. Running the same read-only command outside the broken sandbox succeeds, confirming that the command and workspace are otherwise accessible.

The user reports that this is not limited to the current release: the same class of failure has recurred across multiple Codex updates, and updating has not repaired the poisoned ownership state.

Manual Administrator-level takeown / icacls repair is not an acceptable product remediation. Codex created or retained the CodexSandboxOffline ownership state, so the sandbox setup must detect and recover from it itself. At minimum, setup should:

  1. avoid leaving user project paths owned by a transient sandbox identity;
  2. recover stale CodexSandboxOffline ownership safely during refresh;
  3. show the exact failing ACL operation in the UI instead of the opaque helper_unknown_error;
  4. provide a supported automatic repair path that does not require users to modify NTFS ACLs manually.

This currently makes Codex Desktop unable to run any local command in the affected workspace.

D1sconnected · 20 hours ago

This bug is so annoying, and it has started happening all the time with 5.6 Luna. Please prioritize fixing it, because it's getting really difficult to work with 🙏

alexanderfedyunin-bit · 20 hours ago

So, I canceled my Pro subscription to Codex today, no more ideas to accept such kind of quality in Win11, welcome back Claude :)

qubiq1337 · 19 hours ago

This issue is the only thing keeping me from subscribing to Codex.

xbzhang1994 · 10 hours ago

Confirming on codex-cli 0.150.1 (Windows 11 10.0.26200), same class as
the Aug 25 .codex comment and the Aug 24 git init repro.

Deterministic trigger here:

  1. Repo lives under a drive-root folder (C:\projects\<repo>), so it inherits

the default C:\ ACL (Authenticated Users:(M), no WRITE_DAC).

  1. A sandboxed command creates .codex (New-Item .codex\tasks).
  2. Owner becomes CodexSandboxOnline.
  3. Every later refresh fails:

deny ACE failed on C:\projects\<repo>\.codex: SetNamedSecurityInfoW ... : 5
helper_unknown_error: setup refresh had errors

Control: scanned 44 repos under C:\projects. The only repo that never failed
already had an explicit <user>:(OI)(CI)(F) ACE on the project root, so .codex
inherited WRITE_DAC even when created by the sandbox account.

Workaround: icacls C:\projects /grant "*<SID>:(OI)(CI)(F)" plus recreate any
already-poisoned .codex as the host user. This should not be required of users.