- 沧海2026-09-0716650
Windows MSIX 下的文件锁/沙盒权限与 Codex 的原子重命名机制冲突。
启动时 Codex 会:
- 将 cua_node、openai-bundled marketplace 和插件复制到 staging 目录;
- 用目录原子 rename 切换到正式路径;
- Windows 返回 EPERM / os error 5,导致切换失败;
- Desktop 不断重试、扫描和清理 staging 目录。
因此产生了:
- Bundled executable relocation failed
- plugin_cache_windows_file_lock
- failed to activate plugin cache entry
- browser_use_setup_failed: node-repl-missing
- 大量 staging 目录和磁盘 IO(曾占用约 5GB)
Browser 插件包含大量 node_modules 和原生 .node 文件,进一步放大了 Windows Defender/文件锁扫描问题。旧的会话、项目索引,也增加了次要启动负担。
解决方法:直接把上面的的复制给AI,让AI修就完了。
下面是我的修复过程:反正整完不卡了。
Windows MSIX Codex Desktop 卡顿与 Browser Use 修复方法
一、根因
本次卡顿的核心原因不是 PATH,也不是模型速度,而是 Windows MSIX 环境下的文件锁、沙盒权限与 Codex 原子重命名机制冲突。
Codex 启动时会把
cua_node、bundled marketplace 和插件复制到 staging 目录,然后通过目录rename切换到正式路径。Windows 返回EPERM或os error 5后,Desktop 会反复重试、扫描和清理,造成大量磁盘 IO、启动延迟和界面卡顿。典型日志包括:
-
Bundled executable relocation failed during rename_staging-
EPERM: operation not permitted, rename-
plugin_cache_windows_file_lock-
failed to activate plugin cache entry-
browser_use_setup_failed ... node-repl-missingBrowser 插件还包含大量
node_modules和原生.node文件,会进一步放大 Windows 文件扫描和锁竞争问题。二、先完全退出 Desktop
以管理员 PowerShell 或终端执行:```
taskkill /IM ChatGPT.exe /T /F
taskkill /IM codex.exe /T /F
``确认没有残留进程:``
tasklist | findstr /I "ChatGPT.exe codex.exe"
```不要在 Desktop 仍运行时复制、删除或重命名插件目录。三、准备稳定的 cua_node runtime
不要依赖 WindowsApps 内部目录作为最终运行路径。建立用户目录下的稳定副本:```
C:\Users\Administrator\AppData\Local\OpenAI\Codex\cua-runtime\bin\node.exe
C:\Users\Administrator\AppData\Local\OpenAI\Codex\cua-runtime\bin\node_repl.exe
``验证:``
"C:\Users\Administrator\AppData\Local\OpenAI\Codex\cua-runtime\bin\node.exe" --version
"C:\Users\Administrator\AppData\Local\OpenAI\Codex\cua-runtime\bin\node_repl.exe" --help
``设置用户级环境变量:``
[Environment]::SetEnvironmentVariable(
"CODEX_BROWSER_USE_NODE_PATH",
"$env:LOCALAPPDATA\OpenAI\Codex\cua-runtime\bin\node.exe",
"User"
)[Environment]::SetEnvironmentVariable(
"CODEX_NODE_REPL_PATH",
"$env:LOCALAPPDATA\OpenAI\Codex\cua-runtime\bin\node_repl.exe",
"User"
)
```重新登录或重启 Desktop 后才能保证新环境变量被读取。四、准备 bundled marketplace
用户目录中的 marketplace 应位于:```
C:\Users\Administrator\.codex\.tmp\bundled-marketplaces\openai-bundled
``至少应存在:``
.agents\plugins\marketplace.json
.materialization-key
plugins\codex-app-tools
plugins\browser
plugins\unified-computer-use
plugins\computer-use
plugins\visualize
```marketplace.json必须与当前 Desktop 版本匹配,不能随意复制其他版本的.materialization-key。当前版本的 marketplace 被 Desktop 接受后,日志应出现:```
bundled_plugins_runtime_marketplace_reused
bundled_plugins_marketplace_added
``不要给整个.codex\.tmp` 目录授予写权限;源 marketplace 保持可读即可。五、绕过插件 cache 的 Windows 原子 rename 失败
插件缓存目录:```
C:\Users\Administrator\.codex\plugins\cache\openai-bundled
``将完整插件目录复制到对应的版本目录,不能只复制plugin.json:``
codex-app-tools\0.1.3
browser\26.901.51231
unified-computer-use\26.901.51231
computer-use\26.901.51231
visualize\1.0.29
``每个插件都应包含:``
.codex-plugin\plugin.json
``Browser 还必须包含:``
scripts\browser-service.mjs
scripts\browser-client.mjs
``为 sandbox 用户组授予插件 cache 的限定修改权限:``
icacls "%USERPROFILE%\.codex\plugins\cache" /grant:r "%COMPUTERNAME%\CodexSandboxUsers:(OI)(CI)(M)" /T /C
``不要把 bearer token、auth.json或整个.codex` 目录复制到其他位置。六、在 config.toml 中声明已安装插件
文件:```
C:\Users\Administrator\.codex\config.toml
``在已有[plugins]配置中补充以下条目,不要删除其他配置:``
[plugins."browser@openai-bundled"]
enabled = true[plugins."codex-app-tools@openai-bundled"]
enabled = true[plugins."computer-use@openai-bundled"]
enabled = true
``已有的条目应保留:``
[plugins."unified-computer-use@openai-bundled"]
enabled = true[plugins."visualize@openai-bundled"]
enabled = true
```原因是:仅仅存在 cache 目录并不一定会被 Codex 判定为已安装;配置中的插件 key 也必须存在。这样 Desktop 会跳过失败的重复安装流程。七、Browser skill 的 Windows workaround
当前 Desktop 版本可能会在启动同步时删除 Browser 插件的标准路径:```
skills\control-in-app-browser
``但 Browser service 本身不会受影响。为了保留 Browser 使用说明,可在 Desktop 启动后复制到非标准递归路径:``
skills\browser-use\SKILL.md
skills\browser-use\agents\openai.yaml
``文件内容复制自:``
C:\Users\Administrator\.codex\.tmp\bundled-marketplaces\openai-bundled\plugins\browser\skills\control-in-app-browser
```非标准路径仍会被插件的递归 skill discovery 发现,而且不会被当前 Desktop 的清理逻辑删除。八、重新启动 Desktop
不要直接访问 WindowsApps 内部的
ChatGPT.exe,使用 AppsFolder AppID 启动:```
Start-Process explorer.exe -ArgumentList 'shell:AppsFolder\OpenAI.Codex_2p2nqsd0c76g0!App'
``如果 AppID 发生变化,可用以下命令查找:``
Get-StartApps | Where-Object { $_.Name -match 'Codex|ChatGPT' }
```九、验证是否修复1. Runtime```
"%LOCALAPPDATA%\OpenAI\Codex\cua-runtime\bin\node.exe" --version
"%LOCALAPPDATA%\OpenAI\Codex\cua-runtime\bin\node_repl.exe" --help
```2. 文件确认以下文件存在:```
C:\Users\Administrator\.codex\plugins\cache\openai-bundled\browser\26.901.51231\scripts\browser-service.mjs
C:\Users\Administrator\.codex\plugins\cache\openai-bundled\browser\26.901.51231\skills\browser-use\SKILL.md
```3. 日志日志目录:```
C:\Users\Administrator\AppData\Local\Codex\Logs\2026\09\07
``成功时应出现:``
browser_use_iab_backend_startup_ready
browser_use_availability_resolved available=true
bundled_plugins_reconcile_completed
``以下错误应为 0:``
bundled_plugin_install_requested
bundled_plugins_marketplace_install_failed
plugin_cache_windows_file_lock
plugin_marketplace_folder_write_failed
browser_use_setup_failed
bundled_executable_relocation_failed
```4. MCP 启动新建或切换项目后,
node_repl和cua_repl都应显示为ready。十、不要做的事情
- 不要删除整个
C:\Users\Administrator\.codex,否则可能丢失登录状态和必要运行时。- 不要在 Desktop 运行时删除插件 cache。
- 不要把
config.toml中的 bearer token 发给任何人。- 不要把暴露过的
experimental_bearer_token继续使用,应单独轮换。- 不要把 WindowsApps 目录中的 runtime 当作长期可写目录。
- 不要留下诊断用的临时
CODEX_HOME、截图和测试目录。十一、与本问题无关的项目
以下问题不会直接造成 Desktop 启动卡顿:
-
Artifact Session host Unix-socket transport is not available on Windows:Windows 平台限制。- 云端已归档聊天:本地清理不会删除云端数据,需要在 ChatGPT 设置中手动删除。
- Provider 返回
401 Unauthorized:会影响模型请求或远程功能,但不是本次插件初始化卡顿的根因。主楼 - ✨林尼克斯✨2026-09-088968
已经使用defendnot干掉了