Skip to content

Windows elevated sandbox re-provisioning fails on previously locked .sandbox-bin ACL after upgrade #46380

Open

Description

@Yuhanbravo

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

26.915.3509.0

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

Codex Feedback Session ID: 01a0b2b4-8970-7c40-9bce-1afa23215a09

Summary

Codex Windows elevated sandbox setup failed after an application upgrade because re-provisioning attempted to modify an existing .sandbox-bin directory whose ACL had previously been locked by Codex itself.

The failure was:

helper_sandbox_lock_failed

SetNamedSecurityInfoW sandbox dir failed: 5

Windows error 5 = Access Denied.

After investigation and remediation, I confirmed that this is not a general failure of using Codex from a standard Windows user account with UAC elevation through a separate Administrator account.

The same standard-user / separate-administrator security model works correctly when the sandbox generated state starts clean.

The issue appears to be an upgrade/reconfiguration idempotency problem against previously locked generated sandbox ACL state.


Environment

  • Codex App version: 26.915.3509.0
  • Windows 11 x64
  • Windows build: 26200
  • Interactive Windows account: standard user
  • Separate local Administrator account used for UAC credential elevation
  • Codex configuration:

[windows] sandbox = "elevated"

The interactive user remains a standard user and is not a member of BUILTIN\Administrators.


Initial failure

After the Codex upgrade, sandbox setup was triggered again because the previous setup marker was reported as missing or incompatible.

The elevated setup proceeded partially successfully:

  • sandbox accounts were created;
  • WFP / firewall setup succeeded;
  • approximately 12 filters were created;
  • UAC administrative elevation therefore completed successfully.

Setup then failed while attempting to secure the existing .sandbox-bin directory:

helper_sandbox_lock_failed

SetNamedSecurityInfoW sandbox dir failed: 5

The affected generated directory was:

C:\Users\<USER>\.codex\.sandbox-bin

At the time of failure, its relevant security state was:

  • owner: interactive standard user;
  • inheritance: disabled / protected;
  • interactive standard user could modify the ACL;
  • BUILTIN\Administrators had Modify, Synchronize;
  • BUILTIN\Administrators did not have ChangePermissions / WRITE_DAC.

Because UAC elevation was performed using a separate Administrator account, the elevated helper did not have sufficient permission to rewrite the DACL of this already-locked directory.

No Windows error 1385 was observed, so this did not appear to be a sandbox-account logon-right issue.


Investigation result

The original hypothesis was that Windows standard-user → separate-administrator credential elevation itself might be incompatible with the elevated sandbox setup.

That hypothesis was disproved.

I performed a clean-state remediation without changing the long-term Windows account security model and without manually patching the sandbox ACL.

Remediation procedure

  1. Fully stopped Codex.
  2. Preserved the existing sandbox evidence.
  3. Renamed the existing generated directory to:

.sandbox-bin.pre-20260918

  1. Did not perform a broad ACL reset.
  2. Did not change directory ownership.
  3. Did not grant Full Control.
  4. Did not add the standard user to Administrators.
  5. Did not access or modify .sandbox-secrets.
  6. Created a fresh empty .sandbox-bin directory with normal initial ACL inheritance.
  7. Reran elevated sandbox setup using the same:
  • standard interactive user;
  • separate Administrator account for UAC elevation.

The setup then completed successfully.


Successful post-remediation state

The repaired environment now passes elevated sandbox setup.

Observed result:

  • setup marker v5 created successfully;
  • provisioning binary completed;
  • WFP setup completed successfully;
  • final WFP state contains 12 filters;
  • subsequent setup refreshes report errors=[];
  • no new SetNamedSecurityInfoW ... error 5;
  • no new helper_sandbox_lock_failed;
  • sandbox service runs normally;
  • one Offline and one Online sandbox account are present;
  • temporary setup scheduled tasks cleaned themselves up successfully;
  • Codex App works normally after restart;
  • sandbox commands run successfully as CodexSandboxOffline;
  • workspace reading works;
  • workspace ACL grants CodexSandboxUsers Modify.

The interactive user still remains a standard Windows user.

No manual ACL patch was required.


Key root-cause observation

After successful clean provisioning, Codex once again locks the newly generated .sandbox-bin directory into essentially the same ACL state:

  • owner: interactive standard user;
  • inheritance: disabled / protected;
  • BUILTIN\Administrators: Modify, Synchronize;
  • no ChangePermissions / WRITE_DAC.

This means a successful setup recreates the ACL condition that caused the next upgrade-time re-provisioning to fail.

This strongly suggests the underlying problem is:

Codex Windows sandbox upgrade/re-provisioning is not idempotent against generated sandbox state previously locked by Codex itself.

A later version or setup-marker migration may attempt to provision the existing directory again, but the elevated helper running under a separate Administrator account can no longer rewrite its security descriptor because WRITE_DAC is absent.

The resulting failure is then:

helper_sandbox_lock_failed

SetNamedSecurityInfoW sandbox dir failed: 5


Additional recovery behavior observed

There was another relevant behavior during remediation.

Renaming the old .sandbox-bin was not sufficient by itself.

When .sandbox-bin was completely absent, the current Codex version first failed while attempting to open the missing directory.

Codex did not automatically recreate it.

Creating a new empty .sandbox-bin directory allowed provisioning to proceed successfully.

So the recovery/re-provisioning path appears to make two conflicting assumptions:

  1. .sandbox-bin already exists;
  2. the elevated helper can modify its security descriptor.

This makes recovery from stale or incompatible generated sandbox state fragile.


Expected behavior

When an upgrade or setup-marker migration requires Windows sandbox re-provisioning, Codex should safely handle generated state created by an older Codex version.

Ideally the setup process should be idempotent and support at least one of the following:

  • detect that the existing generated ACL is incompatible and safely recreate the generated directory;
  • temporarily obtain or arrange the ACL rights required for re-provisioning;
  • recreate generated sandbox state rather than attempting to mutate an ACL it previously locked;
  • automatically create .sandbox-bin when it is missing;
  • provide an explicit recovery action instead of leaving setup partially provisioned.

A standard Windows configuration where:

  • the developer uses a standard account; and
  • administrative operations are approved using a separate Administrator account

should remain supported across Codex upgrades.

This account model works correctly after clean provisioning.


Actual behavior

Upgrade-triggered re-provisioning against the existing Codex-generated sandbox state failed with Access Denied.

The setup had already created privileged sandbox resources and WFP rules before failing at the directory security stage.

A manual clean generated-state rebuild was required to recover.


Current assessment

Root cause classification:

Upgrade stale / non-idempotent generated ACL state

Not:

General incompatibility with standard-user → separate-administrator UAC elevation

The relevant sequence appears to be:

successful Codex sandbox setup
→ Codex locks .sandbox-bin
→ Administrators no longer have WRITE_DAC
→ later Codex upgrade requires re-provisioning
→ elevated helper attempts to modify the existing DACL
→ SetNamedSecurityInfoW returns error 5
→ elevated sandbox setup fails.


Remaining risk

The environment is currently fully operational, but the final successful setup has again removed WRITE_DAC from BUILTIN\Administrators.

Therefore a future Codex upgrade that requires another provisioning pass against the existing locked .sandbox-bin may reproduce the same failure.

No further local workaround is currently required, but the generated-state lifecycle appears capable of recreating the precondition for this bug.


Diagnostic evidence

I am attaching a sanitized sandbox log corresponding to the failed setup attempt.

The attachment has been sanitized as follows:

  • Windows username redacted;
  • machine name redacted;
  • local user paths redacted;
  • sandbox/local SID redacted;
  • diagnostic event ordering preserved;
  • sandbox setup events preserved.

The available sanitized log did not itself contain the Codex version or Windows build, so those values are provided explicitly in this report.

setup_error.json was observed during the failure but is transient and was removed by the Codex sandbox setup lifecycle before the sanitized submission package was generated.

The historical error recorded in that file was:

helper_sandbox_lock_failed

SetNamedSecurityInfoW sandbox dir failed: 5

I did not recreate or fabricate the missing file.

.sandbox-secrets was not accessed, read, modified, or attached.


Attached file

sandbox-36f753f1b0bc1d09.sanitized.log

Additional remediation evidence has been preserved locally and can be provided if required.

What steps can reproduce the bug?

  1. Use Codex App on Windows from a standard Windows user account.

  2. Configure:
    [windows] sandbox = "elevated"

  3. Approve UAC elevation using credentials for a separate local Administrator account.

  4. Successfully complete elevated sandbox provisioning once.

  5. After provisioning, .sandbox-bin is left with:

    • owner = standard interactive user
    • inheritance disabled/protected
    • BUILTIN\Administrators = Modify, Synchronize
    • no WRITE_DAC / Change permissions
  6. Upgrade Codex, or otherwise trigger sandbox re-provisioning because the setup marker is missing/incompatible.

  7. Allow elevated setup to run again using the same Administrator account.

  8. Sandbox account / WFP setup proceeds, but setup fails while securing the existing .sandbox-bin with:

    helper_sandbox_lock_failed
    SetNamedSecurityInfoW sandbox dir failed: 5

Recovery observation:

  • Renaming the old .sandbox-bin and creating a fresh empty .sandbox-bin allows provisioning to succeed.
  • No manual ACL patch, ownership change, or administrator-membership change is required.

What is the expected behavior?

Sandbox re-provisioning after a Codex upgrade should be idempotent against sandbox state created and locked by a previous successful Codex setup.

If the existing generated .sandbox-bin ACL is incompatible with re-provisioning, Codex should safely recreate or migrate that generated state rather than failing with Access Denied.

The setup path should also recreate .sandbox-bin automatically if the generated directory is missing.

Additional information

Codex Feedback Session ID:
01a0b2b4-8970-7c40-9bce-1afa23215a09

Clean-state remediation result:

  • PASS
  • interactive account remained a standard user
  • sandbox mode remained elevated
  • no broad ACL reset
  • no ownership change
  • no manual ACL patch
  • no addition of the user to Administrators

After clean provisioning, Codex again leaves .sandbox-bin protected with BUILTIN\Administrators lacking WRITE_DAC, so a future upgrade requiring re-provisioning may recreate the same failure condition.

I have a sanitized failure log:
sandbox-36f753f1b0bc1d09.sanitized.log

The log has Windows username, machine name, local paths, and SID values redacted. .sandbox-secrets was not accessed or included.

setup_error.json was transient and disappeared before the sanitized submission package was generated.

sandbox-36f753f1b0bc1d09.sanitized.log

Activity

  1. added
    app
    on Sep 18, 2026
  2. added
    bug
    windows-os
    sandbox
    on Sep 18, 2026
  3. Yuhanbravo commented on Sep 18, 2026

    @Yuhanbravo
    Author

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

    Powered by Codex Action

    Possibly related to #45734 and #40550.

    #45734 reports the same helper_sandbox_lock_failed / SetNamedSecurityInfoW ... failed: 5 failure on .sandbox-bin.

    My additional finding is that a clean generated-state rebuild succeeds
    under the same standard-user / separate-administrator elevation model,
    but successful provisioning recreates a protected .sandbox-bin ACL
    without WRITE_DAC for Administrators. This suggests an
    upgrade/re-provisioning idempotency issue rather than a general
    alternate-credential elevation failure.

  4. Yuhanbravo commented on Sep 18, 2026

    @Yuhanbravo
    Author

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

    Powered by Codex Action

    After reviewing the related reports, #45153 and #36475 appear especially relevant.

    #45153 contains a useful minimum-rights reproduction:
    adding only WRITE_DAC / ChangePermissions to .sandbox-bin allows
    sandbox initialization to succeed, after which Codex rewrites the ACL
    and removes WRITE_DAC; the next initialization then fails again with
    SetNamedSecurityInfoW ... error 5.

    #36475 documents the same failure in the CLI refresh path and discusses
    an idempotency / ownership-lifecycle issue. It also contains reproductions
    under different token/creation paths where a fresh .sandbox-bin can
    still fail.

    So I would narrow my report as follows:

    • The root cause on my machine is confirmed: upgrade-triggered
      re-provisioning encountered previously locked generated .sandbox-bin
      state.
    • I am not claiming that stale upgrade state explains every occurrence
      of helper_sandbox_lock_failed.
    • The broader common issue appears to be the .sandbox-bin
      ACL/ownership/WRITE_DAC lifecycle and non-idempotency between
      provisioning and subsequent refreshes.

    My clean-state A/B result still confirms that standard-user →
    separate-administrator credential elevation itself works in this
    environment and is not the general failure condition.

  5. cilantro7 commented on Sep 30, 2026

    @cilantro7

    0.159.0 的补充复现证据与候选修复建议

    目标问题:#46380

    用户名、机器名、个人 SID、工作项目、完整本机路径和聊天标识均未包含在材料中。未使用包含项目名称的原始截图。

    新增复现证据

    本机在 Codex CLI 0.158.0-alpha.2.1 中遇到 Windows elevated 沙盒安装失败。临时补充 .sandbox-bin 对 SYSTEM 和 Administrators 的 WRITE_DAC 后,官方安装流程成功;命令实际以 CodexSandboxOffline 执行。

    升级至 Codex CLI 0.159.0 后,于 2026-09-30 09:24(UTC+08:00)再次出现相同失败。已观察到的桌面包版本为 26.928.1915.0,来自沙盒服务可执行文件所在的包路径;没有从“关于 Codex”窗口独立核实桌面版本。

    Windows 11 x64,内部版本 26200。当前临时使用 [windows] sandbox = "unelevated" 恢复使用。

    实际日志(脱敏摘录)

    以下保留真实事件顺序,但去掉机器信息和无关详情:

    [2026-09-30T01:24:05.940297500+00:00] WFP setup succeeded for CodexSandboxOffline with 12 installed filters
    [2026-09-30T01:24:05.946431+00:00] setup error: helper_sandbox_lock_failed: lock sandbox bin dir <CODEX_HOME>/.sandbox-bin failed: open directory <CODEX_HOME>/.sandbox-bin
    

    setup_error.json 中记录:

    {
      "code": "helper_sandbox_lock_failed",
      "message": "lock sandbox bin dir <CODEX_HOME>/.sandbox-bin failed: open directory <CODEX_HOME>/.sandbox-bin"
    }

    最新记录没有保留底层 Windows 错误码,因此本次不声称日志已直接证明错误码为 5。

    失败时的权限状态

    身份 权限
    交互用户,同时是目录所有者 Modify、ChangePermissions、Synchronize
    SYSTEM Modify、Synchronize
    Administrators Modify、Synchronize
    CodexSandboxUsers ReadAndExecute、Synchronize

    目录禁止权限继承。SYSTEM 和 Administrators 均没有 ChangePermissions / WRITE_DAC。
    沙盒服务以 LocalSystem 身份运行。调查时 CodexSandboxOffline 和 CodexSandboxOnline 均已启用。

    对 0.159.0 源码的核对

    源码版本:https://github.com/openai/codex/blob/rust-v0.159.0/codex-rs/windows-sandbox-rs/src/setup_provisioning.rs

    lock_sandbox_dir 在 ProvisionOnly 模式下打开目录时请求:

    READ_CONTROL | WRITE_DAC

    但为 SYSTEM 和 Administrators 生成的访问掩码为:

    FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE

    该访问掩码不包含 WRITE_DAC。

    SetEntriesInAclW 的原权限表参数为 null,随后新表被写入目录。日常刷新也调用 lock_sandbox_bin_dir。因此,手动追加的 WRITE_DAC 会在之后的刷新中被覆盖;更新后再次触发安装时,服务无法打开先前已由 Codex 限制权限的目录。

    这是日志、当前权限和代码共同支持的根因判断。未在本次报告准备过程中再次修改系统权限或重新触发失败。

    最小修复建议

    下方附上用于讨论的候选补丁,基于 0.159.0。

    它仅在 DaclInheritance::Protected 情况下,为 SYSTEM 和 Administrators 增加 WRITE_DAC。已核对当前源码,调用 lock_sandbox_dir 时传入 Protected 的位置仅对应 .sandbox-bin。

    现有交互用户权限、沙盒用户组权限以及其他目录的权限保持不变。

    该补丁只处理“正确权限被后续刷新删除”的复发问题,不包含旧安装状态的迁移,也不能单独作为完整修复发布。具体 API 和实现仍应由维护者评估。

    旧安装状态需要额外处理

    已存在的目录可能在新代码写入权限前就拒绝服务打开。正式修复还需要一个受控迁移步骤:

    1. 验证目标确实是该用户的 Codex 生成目录,并拒绝路径替换、重解析点等异常情况。
    2. 通过经过授权的交互用户或受控的提升流程,一次性恢复服务所需的目录权限。
    3. 不对整个用户目录执行权限重置,不授予沙盒用户组修改权限,不自动删除生成目录。
    4. 成功安装后保存完整有效的状态,并确认后续刷新继续保留服务所需权限。

    验证情况

    已完成:候选补丁通过 git apply --check,能应用到 0.159.0 对应源码。

    未完成:Windows 构建、SYSTEM 身份的权限回归测试、旧目录迁移测试和产品集成验证。本次未创建 CI/CD 自动化,未改变或删除现有测试。

    建议维护者手工验证:

    • 初次安装成功。
    • 日常权限刷新后,SYSTEM 和 Administrators 仍拥有所需的 WRITE_DAC。
    • 对已有受限目录再次执行安装仍成功。
    • 使用独立管理员账户批准提升时仍成功。
    • 沙盒用户组仍只有 ReadAndExecute。
    • 路径替换、重解析点及错误用户目录被拒绝。
    • 从旧权限状态升级时,一次迁移后不再需要手动补权限。

    相关问题

    同一根因的已有报告:#46380

    另一个报告同时涉及 full-access 权限配置阻止 setupStart 和目录权限恢复:#49299

    本补充材料聚焦目录权限复发,不把两个失败入口当成已证实的同一问题。

    候选补丁全文

    diff --git a/codex-rs/windows-sandbox-rs/src/setup_provisioning.rs b/codex-rs/windows-sandbox-rs/src/setup_provisioning.rs
    --- a/codex-rs/windows-sandbox-rs/src/setup_provisioning.rs
    +++ b/codex-rs/windows-sandbox-rs/src/setup_provisioning.rs
    @@ -365,21 +365,29 @@
         let system_sid = resolve_sid("SYSTEM")?;
         let admins_sid = resolve_sid("Administrators")?;
         let real_sid = resolve_sid(real_user)?;
    +    // 仅为受保护的辅助程序目录保留管理员身份再次配置所需的修改权限。
    +    // 当前 Protected 调用仅对应 .sandbox-bin,其他目录沿用既有权限。
    +    let privileged_access_mask =
    +        FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE
    +            | match dacl_inheritance {
    +                DaclInheritance::Protected => WRITE_DAC,
    +                DaclInheritance::Inherited => 0,
    +            };
         let entries = [
             (
                 sandbox_group_sid.to_vec(),
                 sandbox_group_mask,
                 sandbox_group_access_mode,
             ),
             (
                 system_sid,
    -            FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE,
    +            privileged_access_mask,
                 GRANT_ACCESS,
             ),
             (
                 admins_sid,
    -            FILE_GENERIC_READ | FILE_GENERIC_WRITE | FILE_GENERIC_EXECUTE | DELETE,
    +            privileged_access_mask,
                 GRANT_ACCESS,
             ),
             (real_sid, real_user_mask, GRANT_ACCESS),
         ];
  6. Yuhanbravo commented on Sep 30, 2026

    @Yuhanbravo
    Author

    I reproduced the same failure condition again after the latest Codex Desktop upgrade and performed a minimal ACL-only recovery test.

    Before remediation, .sandbox-bin had the following effective ACL state:

    Owner: interactive standard user
    DACL inheritance: protected
    
    CodexSandboxUsers      = ReadAndExecute
    SYSTEM                 = Modify
    Administrators         = Modify
    interactive user       = Modify + WRITE_DAC
    

    This matches the failure precondition described in the original report: SYSTEM and Administrators did not have WRITE_DAC.

    I then made only the following change:

    SYSTEM          += WRITE_DAC
    Administrators  += WRITE_DAC
    

    I did not change ownership, enable inheritance, grant Full Control, modify the sandbox user group, or recreate .sandbox-bin.

    Immediately before rerunning the official sandbox setup, the ACL was:

    CodexSandboxUsers      = RX
    SYSTEM                 = M,WDAC
    Administrators         = M,WDAC
    interactive user       = M,WDAC
    

    The official Codex sandbox setup then completed successfully.

    However, immediately after the setup completed, the ACL had been rewritten to:

    CodexSandboxUsers      = RX
    SYSTEM                 = M
    Administrators         = M
    interactive user       = M,WDAC
    

    So the normal Codex sandbox setup itself removed WRITE_DAC again from both SYSTEM and Administrators.

    This provides a minimal before/after reproduction of the ACL lifecycle problem:

    existing protected .sandbox-bin without WRITE_DAC
    → reprovisioning cannot proceed
    → add only WRITE_DAC to SYSTEM / Administrators
    → official sandbox setup succeeds
    → Codex rewrites the ACL and removes WRITE_DAC again
    → the precondition for a future reprovisioning failure is recreated
    

    This also further supports that the issue is not caused by using a standard interactive account with a separate Administrator account for UAC elevation. The same account model works once the required ACL permission is temporarily restored.

    The remaining problem appears to be that the sandbox ACL written by Codex is not compatible with the access required by a later provisioning pass.

  7. spidikor commented on Oct 1, 2026

    @spidikor

    Your WRITE_DAC before/after result matches what I saw in a related LocalSystem service case. In this test, adding the missing right to SYSTEM alone was enough; other helper identities may need a different scoped repair.

    On Codex Desktop 26.928.2636.0 / Windows 11 Home, build 26300, the service was running as LocalSystem, while SYSTEM had Modify but lacked WRITE_DAC on the protected .sandbox-bin directory.

    After saving the DACL and checking that the path wasn't redirected, I added only SYSTEM's WRITE_DAC, additively on that directory itself, and retried the normal setup. Actual sandbox PowerShell commands then exited 0, and workspace/ACL reads worked! Ownership, Administrators' rights and the sandbox user group's rights stayed unchanged.

    Full anonymized steps, backup/path checks, and source comparison.

    The catch: Codex removed the temporary permission afterward. Shell startup and reads were verified; workspace writes, an upgrade and another provisioning cycle weren't. So this is a temporary workaround for the matching LocalSystem/ACL case, with recurrence still possible.

  8. Titor01 commented on Oct 2, 2026

    @Titor01

    I can reproduce what appears to be the same issue on a newer Codex build, and it has happened more than once on the same machine.

    Environment:

    • Codex CLI: 0.160.0
    • Codex Desktop: 26.930.2377.0
    • Platform: Windows 11 Core x64
    • OS version reported by codex doctor: 10.0.26300
    • Install method: npm
    • Sandbox backend: elevated
    • Approval policy: OnRequest

    Failure from codex doctor:

    ✗ sandbox      elevated Windows sandbox provisioning recorded a structured failure
        approval policy          OnRequest
        filesystem sandbox       restricted
        network sandbox          restricted
        sandbox backend          elevated
        sandbox provisioning     failed
        error code               helper_sandbox_lock_failed
      → rerun elevated setup for the authoritative Codex home or ask IT
    

    This was not the first occurrence. The Windows sandbox had previously completed setup successfully, but later Codex again showed that Windows setup was not completed. During the broken state, I also observed that agent actions required approval much more frequently.

    Troubleshooting:

    1. Enabled inheritance on the existing directory:

      $bin = "$env:USERPROFILE\.codex\.sandbox-bin"
      icacls $bin /inheritance:e

      This succeeded, but codex doctor still reported helper_sandbox_lock_failed.

    2. Checked ACLs. The interactive user, SYSTEM, and Administrators already had access, including inherited Full Control for the interactive user.

    3. The existing .sandbox-bin contained many old codex-command-runner-*.exe binaries from previous Codex versions plus codex.exe.

    4. Renamed the generated directory:

      Rename-Item "$env:USERPROFILE\.codex\.sandbox-bin" ".sandbox-bin.old"
    5. Reopened Codex Desktop and retried Windows setup.

    Result:

    • Setup completed successfully.
    • A fresh sandbox state was created.
    • codex doctor now reports:
      ✓ sandbox      restricted fs + restricted network · approval OnRequest
          sandbox backend          elevated
          sandbox provisioning     complete
      

    So on this system, simply allowing Codex to recreate .sandbox-bin fixed the problem, while enabling inheritance on the existing directory did not.

    Because this has recurred after the sandbox had previously been configured successfully, this looks consistent with a re-provisioning / stale generated-state problem rather than a one-time setup failure. It would be useful if Codex could automatically detect and safely recover from an unusable generated .sandbox-bin state instead of requiring the user to rename or delete it manually.

  9. Yuhanbravo commented on Oct 15, 2026

    @Yuhanbravo
    Author

    Follow-up: Recurrence on Codex Desktop 26.1007.9446.0 — SYSTEM-only WRITE_DAC recovery successful

    I encountered the same Windows elevated sandbox provisioning failure again on my development workstation after upgrading Codex Desktop to 26.1007.9446.0.

    This is a recurrence on the same machine previously documented in this issue.

    Environment

    • Codex Desktop: 26.1007.9446.0
    • Windows 11, build 26200
    • Interactive account: standard Windows user
    • UAC elevation: separate local Administrator account
    • Sandbox mode: elevated
    • Sandbox service: CodexSandboxService.OpenAI.Codex
    • Service identity: LocalSystem
    • Service state: Running

    Failure observed

    The current setup_error.json contained:

    helper_sandbox_lock_failed
    
    lock sandbox bin dir \\?\C:\Users\<USER>\.codex\.sandbox-bin failed:
    open directory \\?\C:\Users\<USER>\.codex\.sandbox-bin
    

    Unlike my original September report, the current structured error did not explicitly include Windows error code 5.

    However, the ACL inspection identified the same relevant missing permission.

    ACL state before remediation

    Owner: interactive standard user
    DACL inheritance: Protected
    
    SYSTEM                 Modify, Synchronize
    Administrators         Modify, Synchronize
    CodexSandboxUsers      ReadAndExecute, Synchronize
    Interactive user       Modify, ChangePermissions, Synchronize
    

    Both SYSTEM and Administrators lacked WRITE_DAC, while the sandbox service was running as LocalSystem.

    Minimal remediation

    This time, instead of renaming or recreating .sandbox-bin, I used a narrowly scoped ACL repair.

    First, I preserved the original ACL and setup error evidence.

    Then I added only WRITE_DAC to the SYSTEM identity on the existing .sandbox-bin directory:

    icacls.exe "$bin" /grant '*S-1-5-18:(WDAC)'

    No recursive permission changes were performed.

    I did not:

    • change ownership or enable ACL inheritance;
    • grant Full Control;
    • modify Administrators' permissions;
    • modify the CodexSandboxUsers permissions;
    • recreate .sandbox-bin;
    • add the interactive user to Administrators;
    • change the sandbox mode to unelevated;
    • modify .sandbox-secrets.

    Result

    The remediation succeeded and Codex functionality was restored.

    This provides another successful recovery using only the specific permission required by the LocalSystem setup path.

    It also confirms that a full generated-state rebuild is not necessary for this failure condition on my machine.

    Updated assessment

    Across two incidents on the same workstation:

    1. The earlier failure was resolved by rebuilding the generated .sandbox-bin state.
    2. The latest failure on 26.1007.9446.0 was resolved by adding only SYSTEM's WRITE_DAC to the existing directory.

    These results further support an ACL lifecycle / re-provisioning issue affecting .sandbox-bin, rather than a general failure of Windows alternate-credential UAC elevation.

    The latest test establishes that the missing permission can be repaired minimally. It does not yet establish whether the successful setup subsequently removed SYSTEM's WRITE_DAC again.

    Related independent findings:

    A durable upstream solution should preserve the necessary authority across provisioning and refresh, while supporting safe migration of existing restricted ACL state.

  10. Yuhanbravo commented on Oct 28, 2026

    @Yuhanbravo
    Author

    Follow-up: Recurrent sandbox ACL failure on Codex Desktop 26.1023.6123.0 — SYSTEM-only WRITE_DAC recovery

    I encountered the same Windows elevated sandbox provisioning failure again on October 28, 2026, following another Codex Desktop upgrade.

    This is another recurrence on the same workstation previously documented in this issue.

    1. Environment

    • Codex Desktop: 26.1023.6123.0
    • Windows: Windows 11 x64, build 26200
    • Interactive account: Standard Windows user
    • UAC elevation: Separate local Administrator account
    • Sandbox backend: Elevated
    • Sandbox service: CodexSandboxService.OpenAI.Codex
    • Service identity: LocalSystem
    • Service state: Running
    • AppX package status: OK

    2. Failure evidence

    The structured setup_error.json contained:

    code: helper_sandbox_lock_failed
    
    lock sandbox bin dir \\?\C:\Users\<USER>\.codex\.sandbox-bin failed:
    open directory \\?\C:\Users\<USER>\.codex\.sandbox-bin:
    NtCreateFile: Access is denied. (os error 5)
    

    Unlike my October 15 report, the current error explicitly includes NtCreateFile and Windows error 5 (Access Denied).

    The affected .sandbox-bin was an ordinary directory, not a reparse point.

    3. ACL before remediation

    Owner: Interactive standard user
    DACL inheritance: Protected
    
    SYSTEM                 Modify, Synchronize
    Administrators         Modify, Synchronize
    CodexSandboxUsers      ReadAndExecute, Synchronize
    Interactive user       Modify, ChangePermissions, Synchronize
    

    As in the previous incidents, SYSTEM and Administrators lacked WRITE_DAC, while the interactive account retained ChangePermissions.

    4. Minimal remediation performed

    Before changing permissions, I:

    • Verified the target directory and its parent paths were not reparse points.
    • Backed up the original ACL using icacls /save.
    • Saved the readable ACL and the original setup_error.json.
    • Preserved the existing directory and its contents.

    I then executed only:

    icacls.exe "$bin" /grant '*S-1-5-18:(WDAC)'

    Result:

    Successfully processed 1 files; Failed processing 0 files
    

    Immediately afterward, the ACL showed:

    SYSTEM                 ChangePermissions
    SYSTEM                 Modify, Synchronize
    Administrators         Modify, Synchronize
    CodexSandboxUsers      ReadAndExecute, Synchronize
    Interactive user       Modify, ChangePermissions, Synchronize
    

    No ownership changes, inheritance changes, recursive grants, Full Control grants, directory recreation, or sandbox configuration downgrade were performed.

    5. Post-remediation result

    Following the remediation:

    • setup_error.json was no longer present.
    • setup_marker.json was readable and reported version 5.
    • The .sandbox-bin ACL had been rewritten to its previous protected state:
    SYSTEM                 Modify, Synchronize
    Administrators         Modify, Synchronize
    CodexSandboxUsers      ReadAndExecute, Synchronize
    Interactive user       Modify, ChangePermissions, Synchronize
    

    In particular, the temporary SYSTEM WRITE_DAC grant had disappeared again.

    The structured provisioning error was cleared and the setup marker was valid. A separate post-restart sandbox command execution test has not yet been documented in this follow-up.

    6. Updated assessment

    This recurrence provides additional evidence for the same ACL lifecycle problem:

    Successful prior provisioning
        ↓
    Codex leaves .sandbox-bin protected
        ↓
    SYSTEM lacks WRITE_DAC
        ↓
    A later upgrade triggers re-provisioning
        ↓
    NtCreateFile fails with Access Denied (5)
        ↓
    Adding only SYSTEM WRITE_DAC allows recovery
        ↓
    Codex rewrites the ACL and removes WRITE_DAC
        ↓
    The same failure precondition is recreated
    

    This is now a repeated failure across multiple Codex Desktop upgrades on the same workstation, with reproducible recovery using a minimal ACL change.

    The issue is not resolved by the latest tested version, 26.1023.6123.0.

    7. Request to maintainers

    Could the Windows sandbox maintainers review the .sandbox-bin ACL lifecycle across provisioning and subsequent refresh operations, particularly:

    1. Whether the LocalSystem provisioning path can consistently obtain its required WRITE_DAC access.
    2. Why the generated protected DACL removes a permission required by subsequent provisioning.
    3. Whether existing installations with this restricted ACL can be migrated safely without manual intervention.
    4. Whether regression coverage can include repeated upgrades and re-provisioning under standard-user / separate-Administrator UAC configurations.

    The repeated local workaround restores provisioning state, but does not constitute a durable upstream fix.

    Current local outcome: Provisioning-state recovery observed.
    Remaining issue: Recurrent ACL self-lockout on later provisioning attempts.
    Upstream status: Unresolved in the latest tested build.

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