先说结论:如果你是新手,或者只是想赶紧把 Computer Use 修好,不建议一上来就跟着一堆命令慢慢排查。最省事的方法是先用下面的“傻瓜式一键修复”:把提示词复制给你自己的 Codex,让它在你的 Windows 电脑上自动检查、备份、修复、验证。
如果自动修复成功,你基本不用看后面的长教程。让 Codex 给你一份修复报告,确认 computer-use@openai-bundled 已经 installed, enabled,并且 list_apps 能返回 Windows 应用列表,就可以收工。
如果自动修复失败,或者你想知道到底坏在哪里,再回头看后面的详细教程。后半部分会一步步解释原因、路径、缓存、marketplace、插件安装和运行时验证。
本文以 Windows 版 Codex Desktop 为例。不同版本的路径和版本号可能会变,但排查思路基本一致。
零、先用傻瓜式一键修复:复制给你的 Codex
建议新开一个 Codex 线程,把下面这段完整发给它。它会先诊断,再备份,再修复,最后做真实验证。注意:这里说的“一键”不是让你下载什么来路不明的修复工具,而是让你本机已经安装的 Codex 去处理它自己的插件环境。
请帮我修复 Windows 版 Codex 中 Computer Use 插件不可用的问题。请按低风险方式执行,不要删除整个 .codex 目录,不要回滚无关配置。
目标:
1. 让 openai-bundled marketplace 恢复可用。
2. 安装并启用 computer-use@openai-bundled。
3. 用真实运行验证证明 Computer Use 可用,而不是只看插件列表。
请按以下步骤处理:
1. 先检查当前插件状态:
- 运行 codex plugin marketplace list
- 运行 codex plugin list
- 检查 %USERPROFILE%\.codex\config.toml 中 openai-bundled 的 source 是否指向 .codex\.tmp\bundled-marketplaces 之类的临时目录。
2. 先做备份:
- 创建 %USERPROFILE%\.codex\backups\computer-use-fix-<时间戳>
- 备份 %USERPROFILE%\.codex\config.toml
- 后续移动任何缓存目录时,都移动到这个备份目录,不要直接删除。
3. 检查并停止可能占用插件缓存的 extension-host.exe。
4. 如果 %USERPROFILE%\.codex\.tmp\bundled-marketplaces 存在,并且 openai-bundled 指向这里或内容不完整,把它移动到备份目录。
5. 恢复 openai-bundled marketplace:
- 优先让 Codex 重启后自动恢复。
- 如果仍然没有 openai-bundled,请从 Codex 应用安装目录中找到完整的 app\resources\plugins\openai-bundled。
- 确认其中存在 .agents\plugins\marketplace.json 和 plugins\computer-use。
- 将完整 openai-bundled 源复制到 %USERPROFILE%\.codex\plugins\cache\openai-bundled\marketplace-source。
- 更新 %USERPROFILE%\.codex\config.toml 的 [marketplaces.openai-bundled],让 source 指向这个稳定路径。
6. 安装 Computer Use:
- 运行 codex plugin add computer-use@openai-bundled
- 再运行 codex plugin list
- 确认 computer-use@openai-bundled 显示 installed, enabled。
7. 做真实验证:
- 使用 Computer Use 插件自己的 scripts\computer-use-client.mjs 初始化运行时。
- 调用 list_apps。
- 如果能返回 Windows 应用列表,说明修复完成。
8. 如果验证时报 package exports 错误,例如:
Package subpath './dist/.../computer_use_client_base.js' is not defined by "exports"
请先备份对应 runtime 里的 @oai\sky\package.json,然后仅补充 exports:
{
".": "./dist/project/cua/sky_js/src/index.js",
"./dist/*": "./dist/*"
}
修改后重新验证 list_apps。
最后请给我一份简短报告,包含:
1. 原因判断。
2. 你改了哪些文件或目录。
3. 备份放在哪里。
4. computer-use@openai-bundled 的最终版本和状态。
5. list_apps 是否验证成功。这段提示词的重点是:它要求 Codex 先备份,再移动缓存,不直接删除整个 .codex 目录;最后还要求真实运行验证。对新手来说,这比自己手敲一堆路径稳得多。
下面开始是详细教程。只有在自动修复失败、你想自己理解原因、或者你想确认 Codex 到底做了什么时,才需要继续往下看。
一、适用症状
如果你遇到下面任意一种情况,可以参考这套流程:
- Codex 里看不到 Computer Use 插件,或插件显示不可用。
computer-use@openai-bundled没有出现在插件列表中。- Chrome 插件已安装,但 Codex 无法连接 Chrome 扩展。
openai-bundledmarketplace 没有显示,或者指向了.codex\.tmp里的临时目录。- 插件安装后仍报运行时错误,例如
Package subpath './dist/...' is not defined by "exports"。 - 重装 Codex 或重启后仍然无法恢复。
核心判断标准不是“界面上有没有按钮”,而是最终能否验证到:
computer-use@openai-bundled installed, enabled并且 Computer Use 能成功枚举本机应用,例如返回当前系统里的应用列表。
二、先理解问题:为什么会坏
Codex 的一些官方插件不是普通的个人 skill,而是 bundled plugin。它们来自 openai-bundled 这个 marketplace。Computer Use、Browser、Chrome 等能力都可能在这里。
在 Windows 上,某些情况下 openai-bundled 会被指向一个临时缓存目录,例如:
%USERPROFILE%\.codex\.tmp\bundled-marketplaces\openai-bundled如果这个目录残缺、被旧的 extension-host.exe 占用、或者只剩下部分文件,Codex 就可能无法正确识别 bundled 插件。结果就是:插件看起来不存在、不可安装、不可用,或者安装状态和实际文件不匹配。
所以修复思路是:
- 停掉可能占用插件缓存的扩展宿主进程。
- 备份当前配置。
- 清理损坏的临时 bundled marketplace。
- 让 Codex 重新识别完整的
openai-bundledmarketplace。 - 安装并启用
computer-use@openai-bundled。 - 做真实运行验证,而不是只看列表。
三、如果自动修复失败,再按这个教程手动排查
下面步骤是给自动修复失败、或者想自己弄明白原因的读者准备的。建议按顺序来,不要一上来就删除整个 .codex 目录,那会扩大影响面。
第 1 步:确认插件列表
打开 PowerShell,运行 Codex 的插件列表命令。如果你的 codex 已经在 PATH 里,可以直接运行:
codex plugin list如果没有在 PATH 里,可以在 Codex 安装目录中找到 codex.exe,再运行:
& "$env:LOCALAPPDATA\OpenAI\Codex\bin\<版本哈希>\codex.exe" plugin list你要重点看两件事:
Marketplace `openai-bundled`以及:
computer-use@openai-bundled健康状态应该类似:
computer-use@openai-bundled installed, enabled如果完全没有 openai-bundled,或者 Computer Use 显示 not installed,继续往下。
第 2 步:备份 Codex 配置
先建一个备份目录:
$backup = "$env:USERPROFILE\.codex\backups\computer-use-fix-$(Get-Date -Format yyyyMMdd-HHmmss)"
New-Item -ItemType Directory -Force -Path $backup | Out-Null
Copy-Item "$env:USERPROFILE\.codex\config.toml" "$backup\config.toml.bak" -Force后面涉及移动缓存、修改配置,都应该先备份。
第 3 步:停掉 extension-host.exe
如果旧的扩展宿主进程还在跑,它可能会占用损坏缓存。可以先查看:
Get-Process extension-host -ErrorAction SilentlyContinue如果有结果,再停止:
Get-Process extension-host -ErrorAction SilentlyContinue | Stop-Process -Force这一步通常不会影响你的系统,只是停掉 Codex 插件相关的扩展宿主。之后 Codex 会在需要时重新拉起。
第 4 步:移动损坏的 bundled marketplace 缓存
不要直接删除,建议移动到刚才的备份目录:
$tmpBundled = "$env:USERPROFILE\.codex\.tmp\bundled-marketplaces"
if (Test-Path $tmpBundled) {
Move-Item $tmpBundled "$backup\bundled-marketplaces"
}然后重启 Codex,再看插件列表。
很多时候,做到这里就够了。Codex 会重新生成完整 marketplace,Computer Use 可以重新安装。
第 5 步:如果 openai-bundled 仍然缺失,手动指向完整 bundled 源
如果重启后还是没有 openai-bundled,可以从 Codex 应用安装目录里找完整的 bundled 插件源。常见位置类似:
C:\Program Files\WindowsApps\OpenAI.Codex_<版本号>_x64__2p2nqsd0c76g0\app\resources\plugins\openai-bundled这个目录里应该包含:
.agents\plugins\marketplace.json
plugins\browser
plugins\chrome
plugins\computer-use建议把它复制到一个稳定缓存路径,例如:
%USERPROFILE%\.codex\plugins\cache\openai-bundled\marketplace-source然后在:
%USERPROFILE%\.codex\config.toml中确认或添加:
[marketplaces.openai-bundled]
source_type = "local"
source = '\\?\C:\Users\<你的用户名>\.codex\plugins\cache\openai-bundled\marketplace-source'注意把 <你的用户名> 改成你的实际用户名。路径前面的 \\?\ 是 Windows 长路径前缀,保留即可。
改完后运行:
codex plugin marketplace list确认能看到:
openai-bundled C:\Users\<你的用户名>\.codex\plugins\cache\openai-bundled\marketplace-source第 6 步:安装 Computer Use 插件
marketplace 恢复后,安装 Computer Use:
codex plugin add computer-use@openai-bundled再检查:
codex plugin list理想结果:
computer-use@openai-bundled installed, enabled同时你应该能在本地看到类似目录:
%USERPROFILE%\.codex\plugins\cache\openai-bundled\computer-use\<版本号>里面应该包含:
scripts\computer-use-client.mjs
skills\computer-use\SKILL.md第 7 步:新开一个 Codex 线程做真实验证
不要只看安装状态。最可靠的验证是新开一个 Codex 线程,让它执行一个很轻的 Computer Use 测试,例如:
请用 Computer Use 做一次轻量验证:初始化 Computer Use 运行时,然后调用 list_apps,告诉我是否能成功枚举当前 Windows 应用。不要点击或操作任何应用。如果 Codex 能返回应用列表,说明 Computer Use 的 native pipe 链路已经通了。
第 8 步:如果已安装但运行时报 exports 错误
有些环境里,Computer Use 插件已经安装启用,但启动时报类似错误:
Package subpath './dist/project/cua/sky_js/src/targets/windows/internal/computer_use_client_base.js'
is not defined by "exports" in ...\node_modules\@oai\sky\package.json这说明 Computer Use 插件脚本引用了 @oai/sky 包里的内部 Windows 客户端文件,但当前 runtime 的 package.json 只导出了顶层入口。
优先建议:
- 先升级或重启 Codex。
- 再重新安装 Computer Use 插件。
- 再新开线程验证。
如果仍然是同一个错误,可以做一个本地 workaround。先备份:
$skyPackage = "$env:LOCALAPPDATA\OpenAI\Codex\runtimes\cua_node\<runtime哈希>\bin\node_modules\@oai\sky\package.json"
Copy-Item $skyPackage "$backup\sky-package.json.before-exports-fix" -Force然后把里面的:
"exports": {
".": "./dist/project/cua/sky_js/src/index.js"
}改成:
"exports": {
".": "./dist/project/cua/sky_js/src/index.js",
"./dist/*": "./dist/*"
}这个补丁只是在本机 runtime 包里补充 dist 文件的导出规则。它不改变 Computer Use 的业务逻辑,但可能会被未来的 Codex 更新覆盖。更新后如果问题复现,再按同样思路验证即可。
四、修复后的健康状态应该是什么样
最终你要看到三层都通过。
第一层:marketplace 正常。
openai-bundled第二层:插件正常。
computer-use@openai-bundled installed, enabled第三层:运行时正常。
Codex 能通过 Computer Use 枚举 Windows 应用,而不是报 unavailable、native pipe missing、package exports 错误。
如果只通过前两层,仍然不能说明 Computer Use 真的可用。一定要做第三层验证。
五、如果你只想诊断,不想让 Codex 自动修复
前面开头那段是推荐的全自动修复流程。如果你比较谨慎,想先知道问题在哪里,但暂时不想让 Codex 移动或修改任何文件,可以用这个更保守的版本:
请只诊断我这台 Windows 电脑上 Codex 的 Computer Use 插件为什么不可用。请检查 marketplace、plugin list、config.toml、bundled-marketplaces 缓存、extension-host.exe、computer-use 插件文件是否存在。不要修改、移动、删除任何文件。最后告诉我最可能的原因和建议修复步骤。六、几个容易踩坑的点
1. Browser、Chrome、Computer Use 不是普通个人 skill
不要只去看:
%USERPROFILE%\.codex\skills这些能力通常来自插件缓存:
%USERPROFILE%\.codex\plugins\cache\openai-bundled所以“skills 目录里找不到”不等于插件不存在。
2. 不要直接删除整个 .codex
.codex 里可能有你的配置、插件、技能、缓存和历史状态。只为了修 Computer Use,通常不需要清空整个目录。更稳妥的做法是只移动损坏的 bundled marketplace 缓存,并保留备份。
3. 安装成功不等于运行成功
installed, enabled 只是插件状态。真正可用还要看 Computer Use 能不能连到 Windows helper,并成功返回应用列表。
4. 更新 Codex 后可能需要重新验证
如果 Codex 自动更新,runtime 哈希、插件版本、应用安装路径都可能变化。更新后如果 Computer Use 又不可用,先重新跑插件列表和轻量 list_apps 验证,不要直接套旧路径。
七、我的一次实际修复结果
这次实际排查中,问题分成两层。
第一层是 openai-bundled marketplace 指向了临时缓存目录,而且缓存内容不完整。处理方式是停掉 extension-host.exe,备份并移走损坏的 bundled marketplace,再把完整 bundled 源放到稳定缓存路径,并更新 config.toml。
第二层是 Computer Use 安装后启动时报 @oai/sky 的 exports 错误。处理方式是备份 runtime 里的 package.json,然后补充 ./dist/* 导出规则。
最终验证结果:
computer-use@openai-bundled installed, enabled并且 Computer Use 成功调用 list_apps,返回了 Windows 应用列表。到这一步,才算真正修好。
结语
这类问题看起来像“插件不可用”,但本质上更像是 Codex 本地插件目录、marketplace 缓存、运行时包版本之间的状态不一致。修复时最重要的是三件事:
- 先备份。
- 只动明确损坏的 bundled marketplace 和对应运行时文件。
- 最后一定做真实运行验证。
如果你已经在用 Codex,最省事的方式其实是把上面的任务提示词丢给 Codex,让它在你的 Windows 机器上检查、备份、修复、验证。人负责确认方向,Codex 负责细活,这才是这个工具最舒服的用法。