Windows Codex 插件修复
适用范围
用于修复 Windows 版 Codex Desktop 更新后,用户目录里的 bundled 插件状态异常。重点处理 ~/.codex 插件缓存、openai-bundled marketplace 指向、Chrome native messaging 注册、chrome-native-hosts.json,config.toml 里的插件启用状态,以及便携版 Codex 的 cua_node 运行时依赖解析问题。
不要调用 MSIX repatch 脚本,不要编辑 C:\Program Files\WindowsApps。除非运行时验证明确出现 OS error 740 或 spawn setup refresh 失败,否则不要修改 [windows] sandbox。
工作流
- 在 PowerShell 中运行内置脚本:
powershellpowershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.codex\skills\codex-plugin-repair-windows-skill\scripts\repair-openai-bundled-plugins.ps1"
- 阅读脚本末尾的 JSON summary。
- 如果
marketplaceMirrorManifest为false,但marketplaceManifest为true且toml.openaiBundledMarketplace.source指向当前 Desktopresources\plugins\openai-bundled,这是可接受状态。便携版 Codex 下不要强行依赖.codex\.tmp\bundled-marketplaces\openai-bundled,该目录可能被 Desktop 同步逻辑覆盖成残缺镜像。 - 如果
computerUseHelper为false,先确认当前版本是否已经改为scripts\computer-use-client.mjs+@oai\sky运行时。新版 Computer Use 不一定在插件目录内包含helper_transport.js。 - 如果
computerUseRuntimeExe或cuaNodeSetupOk为false,优先修复cua_node\bin\node_modules中%40.../%24...编码路径导致的 Node 模块解析问题。 - 如果 sandbox 启动失败并出现 OS error 740,再备份
config.toml后考虑设置[windows] sandbox = "unelevated"。不要预先盲改。
脚本会修复什么
- 备份
config.toml、.codex-global-state.json、chrome-native-hosts.json和已有本地 marketplace 状态。 - 自动发现当前 Desktop resources 路径,支持 AppX 安装和
D:\...\versions\current\resources这类便携版/自定义安装。 - 将当前 Desktop 包内置的
openai-bundledmarketplace 增量同步到~/.codex\.tmp\bundled-marketplaces\openai-bundled作为备份镜像。 - 确保
[marketplaces.openai-bundled]指向当前 Desktop 的稳定 bundled 源目录resources\plugins\openai-bundled,避免便携版环境中.tmp镜像被覆盖成残缺目录后导致 Browser / Chrome / Computer Use 插件不可发现。 - 将
chrome@openai-bundled安装或刷新到~/.codex\plugins\cache\openai-bundled\chrome\<version>,并更新chrome\latest。 - 如果当前 bundled marketplace 里有
computer-use,同步到~/.codex\plugins\cache\openai-bundled\computer-use\<version>,并更新computer-use\latest。 - 修复
cua_node\bin\node_modules中 URL 编码目录或文件名导致的 Node 解析失败:%40oai、%40statsig、%40npmcli等目录补充为对应@...junction。%24...文件补充为对应$...hardlink。
- 运行当前 Desktop 自带的
cua_node\bin\setup.ps1,验证@oai/sky、codex-computer-use.exe、helper_transport.js、npm和node_repl.exe。 - 修复
config.toml中失效的notify = [...codex-computer-use.exe, "turn-ended"]路径,指向当前cua_noderuntime。 - 运行 Chrome 插件自带的
installManifest.mjs,写入 native host manifest 和 HKCU Chrome 注册表项。 - 用当前有效路径更新
~/.codex\chrome-native-hosts.json。 - 启用
[plugins."chrome@openai-bundled"],并在可用时启用[plugins."computer-use@openai-bundled"],同时保留原有配置。 - 验证 Chrome native host manifest、Chrome Extension 安装状态、Computer Use helper 路径和 TOML 语法。
验证预期
成功修复后,summary 中通常应看到:
marketplaceManifest = truechromeLatest = truechromeBrowserClient = truenativeHostManifestOk = truechromeExtensionInstalled = truechromeEnabledInConfig = truebrowserEnabledInConfig = truecomputerUseEnabledInConfig = truewhen Computer Use is installedcomputerUseClient = truecomputerUseRuntimeExe = truecuaNodeSetupOk = true,非DiagnoseOnly模式下应为 truetoml.openaiBundledMarketplace.source指向当前 Desktopresources\plugins\openai-bundled
修复后提醒用户重启 Codex Desktop 和 Chrome,让两个应用重新加载 native host 和插件状态。


