Windows Codex Desktop: Chrome profile detection and AppX launch conflict with Chrome
What version of the Codex App are you using (From “About Codex” dialog)?
26.616.71553
What subscription do you have?
pro 5x
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What issue are you seeing?
On Windows, Codex Desktop sometimes launches or focuses Google Chrome instead of Codex.
When I click Settings in the Codex Chrome extension, Chrome opens instead of Codex. Also, if Chrome is already running and I launch Codex from the Windows Start Menu, a new Chrome window/tab opens instead of the Codex app.
My Chrome profile is stored in a non-default location: D:\Chrome\User Data. This may also affect the Codex Chrome plugin, which appears to check the default Chrome profile path.
What steps can reproduce the bug?
Feedback ID: 019ef4dd-a879-71b2-af52-c54c6fbc3f74
What is the expected behavior?
Expected behavior:
Issue 1:
When Codex uses the Chrome plugin, it should detect and use the active Chrome profile where the Codex Chrome Extension is installed, even if the Chrome user data directory is not in the default location. It should not open an unexpected new Chrome window unless the user explicitly asks it to.
Issue 2:
When launching Codex from the Windows Start Menu while Chrome is already running, Codex Desktop should open or focus the existing Codex window. It should not open or focus a Google Chrome window.
Additional information
Additional information:
Environment:
- Windows 11
- Codex Desktop package: OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0
- Google Chrome executable:
C:\Program Files\Google\Chrome\Application\chrome.exe
- Chrome user data directory:
D:\Chrome\User Data
- Codex Chrome Extension ID:
hehggadaopoacecdllhhajmbjkdcmajg
Local investigation:
For Issue 1, the Codex Chrome plugin scripts appear to check the default Chrome profile path:
C:\Users\UserName\AppData\Local\Google\Chrome\User Data
However, my actual Chrome profile is located at:
D:\Chrome\User Data
When I set these environment variables, the plugin can detect the correct profile:
CODEX_CHROME_USER_DATA_DIR=D:\Chrome\User Data
CODEX_CHROME_PREFERENCES_PATH=D:\Chrome\User Data\Default\Preferences
The plugin's own check-extension-installed script reports the extension as installed and enabled when using D:\Chrome\User Data, but not when using the default C:\Users\UserName\AppData\Local\Google\Chrome\User Data path.
For Issue 2, launching Codex through the AppX/Start Menu entry:
shell:AppsFolder\OpenAI.Codex_2p2nqsd0c76g0!App
can open a new Chrome window when Chrome is already running.
However, directly launching Codex.exe with an explicit Codex user data directory does not open a Chrome window:
C:\Program Files\WindowsApps\OpenAI.Codex_26.616.9593.0_x64__2p2nqsd0c76g0\app\Codex.exe --user-data-dir=C:\Users\UserName\AppData\Roaming\Codex\web\Codex
This suggests the Start Menu/AppX activation path may be interacting incorrectly with Chrome/Chromium process singleton behavior.
Possibly related issues:
- #25221: Similar Start Menu / AppsFolder launch behavior where Codex unexpectedly opens Chrome, while direct Codex.exe launch works.
- #24379: Similar Chrome profile detection problem where the plugin checks the default Chrome user data path instead of the actual profile location.
- #21741: Related Windows Chrome extension/native host connection state inconsistency.
- #23831: Related Chrome plugin marketplace/cache issue.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Thanks. I reviewed #28584. It seems related to the Chrome extension/native messaging/profile-detection area, but I do not think this issue is a full duplicate.
#28584 is about Chrome Beta on macOS where the native messaging host is created only for Stable Chrome.
My case is on Windows with stable Google Chrome, where the Chrome user data directory has been moved to
D:\Chrome\User Data. The Codex Chrome plugin appears to check the default Windows Chrome profile path instead.This issue also includes a second Windows-specific problem: launching Codex from the Windows Start Menu/AppX entry while Chrome is already running opens or focuses a Chrome window instead of Codex. Directly launching
Codex.exewith an explicit Codex user data directory does not reproduce that behavior.So #28584 may be related, but this issue tracks Windows profile-path detection and AppX/Start Menu launch behavior specifically.
Update: I found the final root cause and resolved the issue on my machine.
The problem was caused by two global Windows user environment variables that I had set while trying to make the Chrome MCP/plugin detect my moved Chrome profile:
Codex/ChatGPT Desktop is itself a Chromium-based AppX desktop app. Because these variables were set globally at the Windows user level, the desktop app inherited them on startup and ended up using my regular Chrome profile directory. That made Codex/ChatGPT open as, or look like, a normal Chrome window instead of its own desktop app window.
Fix:
CODEX_CHROME_USER_DATA_DIRCODEX_CHROME_PREFERENCES_PATHAfter removing the global variables and rebooting, the desktop app launches normally again as an independent Codex/ChatGPT window.
Important note: these variables should not be set globally. If they are needed for a Chrome MCP server / Codex CLI workflow, they should be scoped only to that specific MCP server or CLI process, for example under that server's local env configuration, not in the Windows user environment.
Environment where this was fixed:
Follow-up: a second, distinct Windows cause after the environment-variable fix
The previous update fixed the global
CODEX_CHROME_USER_DATA_DIR/CODEX_CHROME_PREFERENCES_PATHcause. After updating the AppX package to26.707.3748.0, I saw the same visible symptom again even though both variables were confirmed absent.New evidence
ChatGPT.exedirectly starts the normal standalone Electron window. The application package itself is healthy.Start-Process 'codex://test'opens Google Chrome instead of the desktop app.HKCU\Software\Classes\codexexisted, but itsshell\open\commandsubkey was missing. This user-level, incomplete protocol key prevented Windows from routingcodex://to the packaged desktop app.Preferencesfile had an allowed protocol-handler entry for the Codex extension (hehggadaopoacecdllhhajmbjkdcmajg) that allowed it to handlecodex.This produces the following path:
Resolution / workaround
D:\Chrome\User Data\Default\Preferences.``
powershell
``Remove-Item 'HKCU:\Software\Classes\codex' -Recurse -Force
This removes the broken user override so that the packaged app's protocol registration can be used again.
Preferences, remove thecodexallowance for the extension under:``
text
``protocol_handler.allowed_origin_protocol_pairs
-> chrome-extension://hehggadaopoacecdllhhajmbjkdcmajg
Keep the JSON valid, then start Chrome again.
Start-Process 'codex://test'should no longer be taken over by Chrome.This is related to the original AppX/Chrome launch symptom, but it is distinct from the earlier global-environment-variable cause: in this case the desktop executable never started through the Start Menu path because
codex://had been intercepted.I can reproduce this on a newer Codex Windows build, and I captured deterministic AppX activation traces that may help narrow this down.
Environment
OpenAI.Codex_26.721.11231.0_x64__2p2nqsd0c76g0C:\Program Files\Google\Chrome\Application\chrome.exeD:\Apps\ChromeData(non-default location)OpenAI.Codex_2p2nqsd0c76g0!AppReproduction
This is repeatable and depends on application start order.
Activation evidence
IApplicationActivationManager.ActivateApplicationreturnsS_OK (0x00000000)and a valid PID, but the activated process exits before creating a window:A separate run produced the same ~2-second exit on the first three attempts. A fourth activation eventually stayed alive and created the Codex window.
Windows AppModel-Runtime logs show successful activation/container creation (events 201, 210, and 211), followed shortly by container destruction (event 217). There is no corresponding conventional Application Error or WER crash event.
Isolation already attempted
This looks closer to a Chromium profile/singleton or AppX startup conflict involving Chrome's non-default user-data directory than a simple foreground-window issue.
Expected behavior
Codex should launch with its own isolated Chromium profile/singleton regardless of whether Chrome is already running.
The log excerpts above are sanitized; I can provide additional sanitized AppModel-Runtime timing data if useful.