openai / openai/codex

Windows Sandbox setup fails with helper_sandbox_lock_failed / SetNamedSecurityInfoW failed: 5

Open
#45,734 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug sandbox windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

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

26.908.9136.0

What subscription do you have?

ChatGPT Go

What platform is your computer?

Windows NT 10.0.22621.0 x64

What issue are you seeing?

When I try to finish Windows setup in the Codex desktop app, I approve the UAC prompt, but the setup fails with helper_failed.

The sandbox setup error is:

helper_sandbox_lock_failed
lock sandbox bin dir <USER_PROFILE>\.codex\.sandbox-bin failed:
SetNamedSecurityInfoW sandbox dir failed: 5

<img width="1082" height="750" alt="Image" src="https://github.com/user-attachments/assets/9f03f220-80bc-4fea-a187-b52e5e545cf0" />

### What steps can reproduce the bug?

1. Install and launch the Codex desktop app on Windows 11.
2. Open the Windows setup / sandbox setup prompt.
3. Click "Yes" on the UAC prompt.
4. Wait for the setup process to complete.
5. The setup fails with `helper_failed`.
6. The Codex sandbox log reports:

text:
helper_sandbox_lock_failed
SetNamedSecurityInfoW sandbox dir failed: 5

### What is the expected behavior?

I expect the Windows setup to complete successfully after approving the UAC prompt.
The Codex Windows sandbox should be configured successfully without returning `helper_failed` or `SetNamedSecurityInfoW ... failed: 5`.

### Additional information

Installed Codex CLI:

0.154.0-alpha.6.2
windows-x86_64

Codex Desktop:

26.908.9136.0

The installed package is:

OpenAI.Codex_26.908.9136.0_x64__2p2nqsd0c76g0

The helper has a valid Authenticode signature from:

OpenAI OpCo, LLC
Windows environment
Windows 11 Pro
Version 22H2
OS Build 22621.6060
64-bit
OS language: ru-RU

Codex Doctor reports:

Windows 10.0.22621 (Windows 11 Professional) [64-bit]
Sandbox directory ACL

The affected directory is:

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

Current ACLs are:

NT AUTHORITY\SYSTEM        Modify
BUILTIN\Administrators     Modify
<user>                     Modify
CodexSandboxUsers          ReadAndExecute

icacls confirms:

CodexSandboxUsers:(OI)(CI)(RX)
SYSTEM:(OI)(CI)(M)
Administrators:(OI)(CI)(M)
<user>:(OI)(CI)(M)

The directory is a normal directory and does not have an unusual reparse/link type.

Sandbox accounts

The expected Codex sandbox accounts are present:

CodexSandboxOffline
CodexSandboxOnline

Both accounts are enabled and belong to:

CodexSandboxUsers
Manual security descriptor test

The following operation was successfully executed from an elevated Administrator PowerShell:

$path = "$env:USERPROFILE\.codex\.sandbox-bin"
$acl = Get-Acl $path
$acl.SetSecurityDescriptorSddlForm($acl.Sddl)
Set-Acl -Path $path -AclObject $acl

The command completed without an error.

This demonstrates that an elevated Administrator process can modify the security descriptor of .sandbox-bin.

SeSecurityPrivilege

The elevated PowerShell token contains:

SeSecurityPrivilege

but its current state is:

Отключен

The privilege is assigned to the built-in Administrators group according to the local security policy.

Therefore, the privilege exists on the system, but it is not enabled by default in the current process token.

Defender investigation

Current Microsoft Defender exclusions are:

C:\Users\<user>\Desktop\memesense
C:\Users\<user>\Downloads

There are currently no Codex-specific exclusions.

A search of Defender threat detections for:

Codex
codex-windows-sandbox-setup

returned no results.

A search of the Microsoft Defender Operational event log for the last two hours for:

Codex
sandbox-setup
codex-windows
Access Denied
blocked
Controlled Folder

also returned no results.

Therefore, there is currently no direct evidence that Microsoft Defender is blocking the Codex sandbox helper.

Helper execution tests

The packaged helper exists and is correctly signed, but direct execution of the packaged helper from the WindowsApps installation directory results in:

Access Denied

The locally installed helper can start successfully and reports:

helper_request_args_failed: expected payload argument

This indicates that the local helper executable itself is capable of launching and is expecting its normal setup payload.

Codex Doctor

codex doctor reports:

Security:
Microsoft Defender can interfere with Codex. Verify Codex exclusions.

However, this is a diagnostic warning and there is no corresponding Defender detection or blocking event.

Other diagnostics are healthy:

Disk space: OK
Configuration: OK
Authentication: OK
Network connectivity: OK
State databases: OK
Desktop installation: OK

Codex Doctor reports the configured sandbox mode as:

restricted fs + restricted network
approval OnRequest

but also reports:

sandbox backend = disabled
Configuration

The Codex configuration file is successfully parsed:

C:\Users\<user>\.codex\config.toml

No [windows] sandbox = ... override was found in the inspected configuration.

Workspace

The problem is not limited to a particular project. The sandbox provisioning failure occurs at the Codex sandbox directory level:

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

Therefore, the failure occurs before normal project-specific sandbox operation.

Troubleshooting already performed

The following actions have already been tested:

Windows reboot
Elevated PowerShell
Verification of .sandbox-bin ACLs
Manual Set-Acl security descriptor test
Verification of CodexSandboxOffline
Verification of CodexSandboxOnline
Verification of CodexSandboxUsers
Verification of the packaged helper
Authenticode signature verification
Direct helper execution test
Local helper execution test
Microsoft Defender threat detection search
Microsoft Defender Operational event log search
Codex Doctor diagnostics
Configuration parsing verification
Network/authentication checks

No manual takeown operation was performed.

.sandbox-bin was not deleted.

The Codex sandbox accounts were not manually deleted or recreated.

No broad Windows security permissions were manually granted.

Current conclusion

The system already has the expected Codex sandbox accounts and ACL entries, and an elevated Administrator can manually modify the .sandbox-bin security descriptor.

However, the official Codex sandbox setup helper fails when performing its own security descriptor operation:

SetNamedSecurityInfoW sandbox dir failed: 5

There is currently no evidence of a Microsoft Defender detection or explicit Defender block.

The failure therefore appears to be specifically related to the Codex Windows sandbox helper's security-descriptor operation, potentially involving Windows privilege handling, rather than a simple missing NTFS permission.

Further investigation of the Codex Windows sandbox helper is required.

Короткая суть для разработчиков Codex:

The Windows Codex sandbox provisioning helper consistently fails with helper_sandbox_lock_failed / SetNamedSecurityInfoW ... failed: 5 when locking .codex\.sandbox-bin. The expected sandbox accounts and ACLs already exist, and an elevated Administrator can successfully modify the directory security descriptor manually. No Defender detection or blocking event was found. This appears to be a helper-level Windows security descriptor/privilege handling_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Windows sandbox helper operation that calls SetNamedSecurityInfoW on .codex.sandbox-bin, including how the process handles SeSecurityPrivilege. Reproduce on Windows 11 with the reported ACLs and helper setup flow. Done means setup completes without helper_sandbox_lock_failed or SetNamedSecurityInfoW error 5.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, operating-systems, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.