Repository navigation
Description
Summary
Windows Codex Desktop elevated sandbox setup fails for a non-admin Windows user when UAC elevation uses a separate admin account. The helper appears to resolve %USERNAME% as an unqualified account name instead of using the real user's fully qualified account name or SID.
Environment
- Codex App: 26.608.1337.0
- Codex CLI: 0.138.0-alpha.7
- OS: Windows 11 Enterprise
- Normal user: domain-backed / Entra-backed non-admin Windows account
- Admin/UAC account: separate privileged account
- Config:
[windows]
sandbox = elevatedError
helper_setup_marker_write_failed:
resolve real user SID for setup marker failed:
LookupAccountNameW failed for User.Name: 1332
Reproduction
- Log into Windows as a non-admin domain-backed user whose username contains a dot, for example
User.Name. - Configure Codex Desktop:
[windows]
sandbox = elevated- Start Codex normally.
- Click retry/update sandbox.
- Enter a separate admin account in the UAC prompt.
- Sandbox setup fails with
LookupAccountNameW failed for User.Name: 1332.
Expected behavior
The elevated sandbox helper should resolve the real non-admin user correctly and write the setup marker.
Actual behavior
The helper tries to resolve only the unqualified username:
User.Name
This fails from the elevated helper context. The same account is resolvable when qualified as:
DOMAIN\User.Name
Confirmed workaround
Launching Codex Desktop directly with %USERNAME% set to the fully qualified username fixes setup:
$env:USERNAME = 'DOMAIN\User.Name'
$env:USERDOMAIN = 'DOMAIN'
& 'C:\Program Files\WindowsApps\OpenAI.Codex_<version>_x64__2p2nqsd0c76g0\app\Codex.exe'After launching this way, elevated sandbox setup succeeds and writes:
%USERPROFILE%\.codex\.sandbox\setup_marker.json
Launching via codex.exe app did not preserve the environment override because it activated the MSIX packaged app. Directly launching the packaged Codex.exe did preserve it.
Additional details
The same failure was reproduced from the bundled CLI with:
codex.exe sandbox -c 'windows.sandbox=elevated' powershell.exe -NoProfile -Command whoamiUsing the unqualified username failed with error 1332. Setting %USERNAME% to DOMAIN\User.Name before launching made the elevated sandbox run successfully as the Codex sandbox user.
Suggested fix
Do not pass/resolve bare %USERNAME% for the real user in elevated sandbox setup. Prefer one of:
- fully qualified
DOMAIN\USERNAME - the current user's SID captured before elevation
- a Windows token/user API rather than environment variables
This seems related to other Windows sandbox issues where name-based resolution fails and SID-based resolution is more robust.
Activity
github-actions commentedon Jun 10, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
thevarsek-k3-advisory-group commentedon Jun 10, 2026
Not a duplicate IMO
Silviu-Chirila commentedon Jun 24, 2026
I agree, I have the same issue and have to use a workaround, definitely not the same issue as implied above.
anacision commentedon Sep 15, 2026
I can reproduce this on a Windows 11 corporate device with an Entra ID-backed user.
Environment:
AzureAD\USERwhoami /userSID:S-1-12-1-4289045924-1174938078-3217778590-1691163228AzureAD\USERelevatedSandbox setup successfully creates:
CodexSandboxOfflineCodexSandboxOnlinebut setup then fails before
setup_marker.jsonis created.%USERPROFILE%\.codex\.sandbox\setup_error.jsoncontains:{ "code": "helper_setup_marker_write_failed", "message": "resolve real user SID for setup marker failed: LookupAccountNameW failed for User: 1332" }The important detail is that the helper is trying to resolve:
instead of the actual account name:
The SID itself can be resolved correctly to
AzureAD\USER.So this appears to be the same root cause described in this issue: the elevated sandbox setup relies on an unqualified username rather than retaining/resolving the original user's SID or fully qualified account name before elevation.
Using the original user's SID directly would probably be the most robust solution, especially for Entra ID / AzureAD joined Windows devices.