Skip to content

Windows Desktop exec silently uses MSIX-virtualized AppData instead of the real user profile #41665

Open

Description

@kamkie

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

Codex Desktop MSIX 26.825.6671.0

What platform is your computer?

Windows 11 Pro, version 10.0.26200, build 26200, x64

What issue are you seeing?

In a Windows-native Codex Desktop task, commands executed by the agent silently see a package-private MSIX copy of %APPDATA% instead of the user's real profile data.

This happens with the Codex sandbox fully disabled:

approval_policy = "never"
sandbox_mode = "danger-full-access"

For example, an agent command opening this textual path:

C:\Users\<user>\AppData\Roaming\netlify\Config\config.json

actually opens this file according to GetFinalPathNameByHandle:

\\?\C:\Users\<user>\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Roaming\netlify\Config\config.json

The two files are different:

Real user profile file SHA-256:
073a2440c1f66fa4848f4490b37da409dca5fb76b82202ea0ae07e27b94059c7

Package-private LocalCache file SHA-256:
81acac35e22045db93ec5c512015623782c8fcf04b5f19b4a894c6e9d2867c54

A normal unpackaged Windows terminal sees the real file. Codex agent exec in Windows-native mode sees the package-private file. This is not an environment-variable mismatch: %APPDATA% contains the expected textual path in both processes. The redirection occurs when the path is opened.

The package-private profile already contains shadows for multiple unrelated programs, not just the CLI used in this example. This can silently split configuration, authentication state, caches, and application data between normal user processes and Codex agent commands.

The Codex exec process reported:

GetCurrentPackageFullName: no package identity
IsAppContainer: false
Token virtualization enabled: false

Despite that, the opened path was redirected into the Codex package's LocalCache.

What steps can reproduce the bug?

  1. Install Codex Desktop from the Microsoft Store/MSIX package.
  2. Select Windows native as the agent environment.
  3. Configure sandbox_mode = "danger-full-access" and start a new task.
  4. From a normal unpackaged Windows terminal, create an application config under %APPDATA% or use an existing CLI that stores authentication/configuration there.
  5. Run that CLI from a Codex agent command, causing it to access the same %APPDATA% path.
  6. Compare the file seen by the normal terminal and the file seen by Codex agent exec.
  7. For definitive evidence, open the file in the Codex exec process and call GetFinalPathNameByHandle on its handle.
  8. Observe that the Codex command opens %LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Roaming\... while the normal terminal opens the actual %APPDATA%\... file.

A deterministic variant is:

  1. From an unpackaged terminal, write a marker file under %APPDATA%\codex-msix-repro\probe.txt.
  2. From Codex agent exec, write a different value to the same textual path.
  3. Compare the file from the unpackaged terminal and Codex exec.
  4. Inspect the final opened path from Codex exec.

What is the expected behavior?

In Windows-native mode with danger-full-access, agent commands should operate on the same user profile and application configuration as commands launched from the user's normal Windows terminal.

At minimum, Codex must not silently present a second private %APPDATA% tree while reporting the normal user path in environment variables. If isolation is intentional, it should be explicit, documented, and controllable.

Actual behavior and impact

  • Existing CLI authentication appears to be missing inside Codex.
  • Logging in from Codex can create a second credential/configuration state that normal terminals do not see.
  • Programs can read and write stale or divergent settings without any visible path difference.
  • Disabling the Codex sandbox does not fix the behavior because this is MSIX filesystem virtualization, not the Codex sandbox.
  • The integrated terminal can behave differently from agent exec even within the same Codex Desktop window.

This makes Windows-native agent execution unreliable for any tool using %APPDATA% or %LOCALAPPDATA%.

Additional information

Microsoft documents that packaged desktop apps can redirect writes under AppData into a per-user, per-package location. Package authors can disable filesystem write virtualization in the package manifest. Codex Desktop should either disable this virtualization for agent execution or spawn agent commands through an unpackaged broker that sees the real user profile.

Related but distinct issues:

The issue was reproduced in a fresh Codex task. No credential contents or tokens are included in this report.

Activity

  1. added
    bug
    app
    windows-os
    exec
    on Aug 30, 2026
  2. github-actions commented on Aug 30, 2026

    @github-actions
    Contributor

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

    Powered by Codex Action

  3. kamkie commented on Aug 30, 2026

    @kamkie
    Author

    Thanks. I reviewed #41307; this is not a duplicate.

    #41307 reports several Codex Desktop UI problems: the app's own ChatGPT/OAuth session being lost, an OAuth loop, off-screen window bounds, and BOM parsing of Codex state. It speculates about synchronization between Codex authentication locations, but it does not reproduce agent exec opening arbitrary third-party application data through MSIX filesystem virtualization.

    #41665 is narrower and has a different reproduction and impact:

    • It affects arbitrary subprocesses launched by the Windows-native agent, demonstrated with an unrelated third-party CLI configuration file rather than Codex authentication.
    • It occurs with sandbox_mode = "danger-full-access" and approval_policy = "never".
    • %APPDATA% reports the normal textual user path, but GetFinalPathNameByHandle proves that the opened file is under the Codex package's LocalCache\Roaming tree.
    • An unpackaged terminal sees a different file at the same textual %APPDATA% location.
    • Therefore this can silently split configuration, credentials, caches, and state for any Windows program launched by agent exec, even when Codex Desktop authentication is working normally.

    The overlap is that both reports mention the Codex MSIX LocalCache. #41307 may describe one possible downstream symptom, but it does not cover the agent-execution filesystem redirection reported here. I am therefore keeping #41665 open as the minimal reproduction for the exec/MSIX virtualization issue.

  4. kamkie commented on Aug 30, 2026

    @kamkie
    Author

    Thanks — this narrowing was decisive. I inspected the installed manifest for OpenAI.Codex_26.825.6671.0_x64__2p2nqsd0c76g0 on Windows 11 build 26200.

    The package declares the older package-wide settings and capability:

    <desktop6:RegistryWriteVirtualization>disabled</desktop6:RegistryWriteVirtualization>
    <desktop6:FileSystemWriteVirtualization>disabled</desktop6:FileSystemWriteVirtualization>
    
    <rescap:Capability Name="unvirtualizedResources" />

    However, it also declares the Windows 11 granular form:

    <virtualization:FileSystemWriteVirtualization>
      <virtualization:ExcludedDirectories>
        <virtualization:ExcludedDirectory>
          $(KnownFolder:LocalAppData)\OpenAI
        </virtualization:ExcludedDirectory>
      </virtualization:ExcludedDirectories>
    </virtualization:FileSystemWriteVirtualization>

    The manifest has no corresponding exclusion for RoamingAppData\netlify or arbitrary third-party CLI configuration locations. Microsoft documents that the Windows 11 declarations take precedence over the older declarations when both are present. That matches the observation exactly: %LOCALAPPDATA%\OpenAI is explicitly unvirtualized, while %APPDATA%\netlify resolves private-first to the Codex package's LocalCache\Roaming tree.

    This means the cause on this installation is not simply a missing unvirtualizedResources capability or missing package-wide disabled setting. Both are present. The effective Windows 11 policy is narrowed by the granular declaration to the OpenAI LocalAppData subtree.

    I also tested launching the registered package's app\ChatGPT.exe directly from its WindowsApps installation path, after closing the existing app. The new process was created directly, but agent exec still opened the Netlify file from LocalCache\Roaming, so that simple direct-launch workaround did not change the effective filesystem view.

    The remaining launch-boundary question you identified is still important: the exec child reports no package identity, yet receives the package-private view. But the installed manifest now explains why the package context has this specific AppData policy once that context reaches the child.

    For terminal-equivalent execution of arbitrary third-party tools, an unpackaged/breakaway execution broker still appears semantically narrower than globally disabling isolation for the entire Desktop app. Alternatively, the package would need an effective unvirtualized policy covering arbitrary agent CLI paths rather than only LocalAppData\OpenAI.

  5. kamkie commented on Aug 30, 2026

    @kamkie
    Author

    Scope clarification: this report concerns the distributed Codex Desktop app for Windows. The Desktop application code and Store/MSIX packaging manifest do not appear to be present in this repository. I am reporting it in openai/codex because this is the public tracker used for Codex Desktop bugs as well, including issues carrying the app and windows-os labels.

  6. kamkie commented on Aug 30, 2026

    @kamkie
    Author

    Thanks — that boundary matches the local process evidence, and I now have a stronger identity probe than the earlier AUMID result.

    The observed process chain is:

    pwsh.exe
      -> codex.exe app-server
        -> ChatGPT.exe (packaged Desktop app)
    

    codex.exe itself is loaded from %LOCALAPPDATA%\OpenAI\Codex\bin\..., outside WindowsApps. In the current pwsh.exe child, both native package APIs return 15700 (APPMODEL_ERROR_NO_PACKAGE):

    GetCurrentPackageFullName   -> 15700
    GetCurrentPackageFamilyName -> 15700
    

    So this is stronger than GetApplicationUserModelId -> NO_APPLICATION: the shell child has no package identity visible through the package identity APIs. Nevertheless, opening the textual path:

    C:\Users\kamki\AppData\Roaming\netlify\Config\config.json
    

    and resolving the opened handle with GetFinalPathNameByHandle yields:

    \\?\C:\Users\kamki\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Roaming\netlify\Config\config.json
    

    This reproduces with danger-full-access and approvals disabled. In other words, the ordinary third-party child exposes no package identity, yet it still receives the package-private AppData filesystem view.

    That seems to support your placement of the discriminating boundary above spawn_child_async, around the packaged Desktop process launching codex.exe app-server or another inherited runtime/compatibility context. A unit test of the generic spawn function outside the distributed MSIX would indeed miss the decisive condition; this needs a Desktop/MSIX integration probe.

  7. kamkie commented on Aug 31, 2026

    @kamkie
    Author

    I ran the descendant-side version of that discriminator locally.

    The test created a PowerShell broker with CreateProcessW + STARTUPINFOEX, setting:

    PROC_THREAD_ATTRIBUTE_DESKTOP_APP_POLICY = 0x00020012
    PROCESS_CREATION_DESKTOP_APP_BREAKAWAY_ENABLE_PROCESS_TREE = 0x01
    

    The setup itself succeeded: InitializeProcThreadAttributeList, UpdateProcThreadAttribute, and CreateProcessW all returned success. A smoke child deliberately exiting with code 42 was created and observed correctly, so the attribute-bearing launch path was active.

    I then compared two disposable probes of the same textual path:

    C:\Users\kamki\AppData\Roaming\netlify\Config\config.json
    
    1. A normal direct child of the current Codex-launched pwsh.exe.
    2. A grandchild launched by the broker carrying BREAKAWAY_ENABLE_PROCESS_TREE.

    Each probe opened the file and classified the result from GetFinalPathNameByHandle. The result was:

    Baseline exit code:  11  (MSIX LocalCache shadow)
    Breakaway exit code: 11  (MSIX LocalCache shadow)
    Path class changed:  false
    

    Both resolved to the package-private OpenAI.Codex...\LocalCache\Roaming view.

    So applying BREAKAWAY_ENABLE_PROCESS_TREE from inside the already affected pwsh.exe subtree does not provide an escape hatch on this installation. This does not falsify DESKTOP_APP_POLICY as the mechanism at the original packaged ChatGPT.exe -> external codex.exe app-server boundary: the policy may need to be controlled at that launch, or another packaging/runtime mechanism may already be decisive by the time the descendant runs.

    The remaining useful discriminator is therefore still the distributed Desktop harness test at the original app-server creation boundary. The descendant result narrows the expectation: changing this attribute only after the app-server tree exists is insufficient.

  8. arussin commented on Oct 1, 2026

    @arussin

    I reproduced this with Wrangler 4.144.0 and verified a narrow workaround, including a check from a fresh Codex task.

    Both processes reported the same normal Windows user and the same apparent AppData path. A metadata-only GetFinalPathNameByHandle probe showed two different files:

    • An independently opened, non-admin terminal resolved the real Roaming Wrangler config, updated by that day's login.
    • Codex-launched commands resolved an older copy under the Codex package's LocalCache\Roaming tree, even when the command ran as the normal non-admin owner.

    For this specific stale-shadow case, the working sequence was:

    1. Confirm the real credential file already exists and distinguish the two physical files using path/timestamp metadata only. Stop other Wrangler/authentication operations.
    2. With explicit approval, rename only the stale physical shadow at %LOCALAPPDATA%\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Roaming\xdg.config.wrangler\config\default.toml to a same-directory backup. Do not rename the apparent merged AppData path or remove the directory.
    3. Through the supported, explicitly reviewed normal-owner execution route, use a fresh process to verify that the apparent path now resolves to the real Roaming file before running Wrangler.
    4. Run one Wrangler whoami with the existing session, then verify the real file/path and that no private shadow was recreated.

    The existing login successfully refreshed without another login. A separate fresh Codex task then passed whoami with the same limited scopes, resolved the real file, and left the shadow absent. No token contents were read/copied, and no ACLs, sandbox settings, or OAuth grants were changed.

    Important boundary: the sandbox identity itself was denied access to the real file. Our initial sandbox-based verification was stopped and rolled back. The successful sequence kept credential use entirely in the approved normal-owner context; it does not make sandbox credential access work.

    Scope and caution: this is a tested workaround for one existing plaintext Wrangler store, not a general MSIX fix. Reboot/upgrade behavior and future login/profile creation are untested. Later creation of a private shadow could reintroduce divergence. A same-directory rename can be reversed before authentication activity, but a subsequent OAuth refresh/token rotation is not undone by restoring an old backup. Never overwrite a newly created credential file or automatically restore stale credentials after refreshing.

    Microsoft's documented private-first/fallback behavior is consistent with the result: https://learn.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-scenes#common-file-system-operations

  9. immanuelgiulea commented on Oct 16, 2026

    @immanuelgiulea

    Is there any update on this?
    Codex moved my rclone.conf out of AppData\Roaming\rclone into AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Roaming\rclone!
    I wasted over 6 hours running file recovery with winfr thinking the file was deleting.

    please fix this bug. thank you.

  10. jeonghakhui-art commented on Oct 28, 2026

    @jeonghakhui-art

    Additional reproduction of the same MSIX AppData path divergence, this time under AppData\\Local (rather than Roaming).

    On 2026-10-28, a Codex/Work task was asked to create an empty JSON credential-store placeholder, with no real API keys or tokens, in a user-local path:

    C:\Users\<user>\AppData\Local\<app>\secrets\api_credentials.json
    

    What happened:

    1. The agent reported successful creation, an 18-byte file, and ACLs limited to the current user and SYSTEM. It initially characterized this as installed on the user's real Windows profile.

    2. In a separate, ordinary interactive Windows PowerShell session on the same PC/account, Test-Path -LiteralPath for that exact logical path returned False (retested).

    3. The agent subsequently used a Windows file handle and GetFinalPathNameByHandle to identify the actual resolved path:

      \\?\C:\Users\<user>\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\<app>\secrets\api_credentials.json
      
    4. The user independently located the 18-byte file at that LocalCache\\Local location in Explorer.

    5. The agent withdrew its earlier "installed in the real user profile" completion claim. A host-visible file at the requested logical path, and a shared file view between Work and normal PowerShell, were not verified.

    Why this matters: when an agent creates and checks a configuration/credential file entirely within its own virtualized view, both operations can appear successful, even though an unpackaged user process sees no file at the requested path. The misleading task-completion report is an additional user-facing impact beyond the underlying path redirection.

    No real keys or credentials were populated, and no exfiltration is alleged. Paths above are redacted; the desktop app build was not independently captured. This is a reproduction report, not a claimed fix. It would help if the agent/runtime could detect or explicitly disclose the effective opened path when it differs from the requested user-profile location.

  11. icebergvl commented on Nov 15, 2026

    @icebergvl

    Additional reproduction of the same AppData split with an unrelated Windows CLI, Hermes Agent v0.23.1 stable, on Windows 11.

    • In an ordinary Windows PowerShell session, running the user-installed C:\Users\<user>\AppData\Local\hermes\bin\hermes.exe --version reports Install directory: C:\Users\<user>\AppData\Local\hermes\hermes-agent. Hermes also opens its user profile there and a local test session persists after exit.
    • On the same machine, running Hermes by the same absolute launcher path from a Codex Desktop agent task exits successfully but reports Install directory: C:\Users\<user>\AppData\Local\Packages\OpenAI.Codex_2p2nqsd0c76g0\LocalCache\Local\hermes\hermes-agent.

    Is there a supported way for a Codex Desktop agent task to execute this external CLI against the real user AppData tree without changing the sandbox policy or moving either installation? If there is no supported Desktop route, is the standalone Codex CLI launched from an ordinary Windows terminal the recommended workaround? The current status of any shipped fix would also help.

  12. removed
    exec
    on Nov 29, 2026
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

    appbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions