Codex Browser Use Fix

Windows guide for diagnosing and recovering Codex Desktop Browser and Chrome plugins while keeping Desktop's native AppX marketplace lifecycle intact.

!

为什么更新后会掉

Codex Desktop 更新后,AppX 包、bundled 插件和 runtime marketplace 分别有自己的版本。如果 config.toml 仍指向旧安装目录或手工快照,Browser、Chrome 或 Computer Use 就可能加载失败。

当前 Desktop 会把 AppX 内的 marketplace 同步到用户目录并自动注册,不需要固定到单一目录名。

健康路径形态:%USERPROFILE%\.codex\.tmp\bundled-marketplaces\openai-bundled-appx-<desktop-version>

插件 manifest 版本应与当前 AppX 中同名插件一致;插件版本不要求等于 Desktop 版本。

0

先让 Desktop 原生同步

完整退出并重新启动 Codex Desktop,让它生成当前 AppX 专用 runtime marketplace。然后执行:

PowerShell
codex plugin marketplace list
codex plugin list
powershell -ExecutionPolicy Bypass -File .\scripts\check-codex-browser-health.ps1

如果 openai-bundled 仍指向旧快照,先备份 config.toml,移除旧注册,再完整重启 Desktop:

PowerShell
codex plugin marketplace remove openai-bundled
当前 CLI 已移除 remote_control。不要在新配置中添加 remote_control = true
L

旧版 Browser Use 恢复

仅当安装包仍提供 browser-use,并且 codex features list 仍列出 remote_control 时使用本节。

如果 %USERPROFILE%\.codex\.tmp\bundled-marketplaces\openai-bundled\plugins\browser-use 已存在,优先运行这个脚本。它会动态读取 manifest 版本、重建 cache,并补齐 Browser Use 必需启用项。

PowerShell
$ErrorActionPreference = "Stop"

$marketplace = "$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled"
$pluginSrc = Join-Path $marketplace "plugins\browser-use"
$manifestPath = Join-Path $pluginSrc ".codex-plugin\plugin.json"
$configPath = "$env:USERPROFILE\.codex\config.toml"

if (!(Test-Path -LiteralPath $manifestPath)) {
  throw "browser-use manifest not found: $manifestPath"
}

$version = (Get-Content -LiteralPath $manifestPath -Raw | ConvertFrom-Json).version
$cacheDst = "$env:USERPROFILE\.codex\plugins\cache\openai-bundled\browser-use\$version"

New-Item -ItemType Directory -Force -Path $cacheDst | Out-Null

$srcRoot = (Resolve-Path -LiteralPath $pluginSrc).Path.TrimEnd('\')
$dstRoot = (Resolve-Path -LiteralPath $cacheDst).Path.TrimEnd('\')

Get-ChildItem -LiteralPath $srcRoot -Force -Recurse -Directory | ForEach-Object {
  $rel = $_.FullName.Substring($srcRoot.Length).TrimStart('\')
  New-Item -ItemType Directory -Force -Path (Join-Path $dstRoot $rel) | Out-Null
}

Get-ChildItem -LiteralPath $srcRoot -Force -Recurse -File | ForEach-Object {
  $rel = $_.FullName.Substring($srcRoot.Length).TrimStart('\')
  $target = Join-Path $dstRoot $rel
  New-Item -ItemType Directory -Force -Path (Split-Path -Parent $target) | Out-Null
  [System.IO.File]::WriteAllBytes($target, [System.IO.File]::ReadAllBytes($_.FullName))
}

$config = Get-Content -LiteralPath $configPath -Raw

if ($config -notmatch '(?m)^\[marketplaces\.openai-bundled\]') {
  Add-Content -LiteralPath $configPath -Value @"

[marketplaces.openai-bundled]
source_type = "local"
source = '\\?\$marketplace'
"@
}

if ($config -notmatch '(?m)^\[plugins\."browser-use@openai-bundled"\]') {
  Add-Content -LiteralPath $configPath -Value @'

[plugins."browser-use@openai-bundled"]
enabled = true
'@
}

$features = codex features list
if ($features | Select-String -Pattern "^remote_control\s") {
  codex features enable remote_control
}
$features | Select-String -Pattern "remote_control|browser_use|in_app_browser|computer_use|plugins"
codex debug prompt-input "test browser use" | Select-String -Pattern "browser-use:browser|Browser Use|failed to load plugin|plugin is not installed"
验证通过后重启 Codex Desktop。
1

确认本机存在 browser-use

先确认当前 Codex Desktop 安装目录里有 bundled 插件:

Path
<Codex安装目录>\app\resources\plugins\openai-bundled\plugins\browser-use
PowerShell
$browserUsePath = "<Codex安装目录>\app\resources\plugins\openai-bundled\plugins\browser-use"
Test-Path $browserUsePath
返回 True 才能继续。
2

读取插件版本号

PowerShell
Get-Content "$browserUsePath\.codex-plugin\plugin.json"

示例:

plugin.json
{
  "name": "browser-use",
  "version": "0.1.0-alpha2"
}

后续命令里的 $version 要使用 manifest 中的实际值,不要硬编码教程里的示例版本。

3

兼容恢复:复制 Marketplace

仅当 Desktop 多次完整重启后仍无法生成 AppX 专用 runtime 时,才把 bundled marketplace 镜像到无版本用户目录:

PowerShell
$src = "<Codex安装目录>\app\resources\plugins\openai-bundled"
$dst = "$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled"

New-Item -ItemType Directory -Force -Path $dst | Out-Null

$srcRoot = (Resolve-Path -LiteralPath $src).Path.TrimEnd('\')
$dstRoot = (Resolve-Path -LiteralPath $dst).Path.TrimEnd('\')

Get-ChildItem -LiteralPath $srcRoot -Force -Recurse -Directory | ForEach-Object {
  $rel = $_.FullName.Substring($srcRoot.Length).TrimStart('\')
  New-Item -ItemType Directory -Force -Path (Join-Path $dstRoot $rel) | Out-Null
}

Get-ChildItem -LiteralPath $srcRoot -Force -Recurse -File | ForEach-Object {
  $rel = $_.FullName.Substring($srcRoot.Length).TrimStart('\')
  $target = Join-Path $dstRoot $rel
  New-Item -ItemType Directory -Force -Path (Split-Path -Parent $target) | Out-Null
  [System.IO.File]::WriteAllBytes($target, [System.IO.File]::ReadAllBytes($_.FullName))
}
.tmp 被 Codex 清理或重建属于正常生命周期。始终先让 Desktop 原生同步,手工复制只作最后恢复。
4

兼容恢复:重新注册 Marketplace

PowerShell
codex plugin marketplace remove openai-bundled
codex plugin marketplace add "$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled"

此用户目录镜像只用于旧版兼容。新版 Desktop 自动改回 openai-bundled-appx-* 是正常行为。

5

旧版兼容:启用 Browser Use 配置

仅当 codex features list 仍列出 remote_control 时执行。
PowerShell
codex features enable remote_control

确认 %USERPROFILE%\.codex\config.toml 包含:

config.toml
[plugins."browser-use@openai-bundled"]
enabled = true

[features]
remote_control = true
6

如果安装失败,补齐插件 Cache

如果 cache 目录缺少 manifest,从固定 marketplace 复制:

PowerShell
$src = "$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled\plugins\browser-use"
$version = (Get-Content -LiteralPath "$src\.codex-plugin\plugin.json" -Raw | ConvertFrom-Json).version
$dst = "$env:USERPROFILE\.codex\plugins\cache\openai-bundled\browser-use\$version"

New-Item -ItemType Directory -Force -Path $dst | Out-Null

$srcRoot = (Resolve-Path -LiteralPath $src).Path.TrimEnd('\')
$dstRoot = (Resolve-Path -LiteralPath $dst).Path.TrimEnd('\')

Get-ChildItem -LiteralPath $srcRoot -Force -Recurse -Directory | ForEach-Object {
  $rel = $_.FullName.Substring($srcRoot.Length).TrimStart('\')
  New-Item -ItemType Directory -Force -Path (Join-Path $dstRoot $rel) | Out-Null
}

Get-ChildItem -LiteralPath $srcRoot -Force -Recurse -File | ForEach-Object {
  $rel = $_.FullName.Substring($srcRoot.Length).TrimStart('\')
  $target = Join-Path $dstRoot $rel
  New-Item -ItemType Directory -Force -Path (Split-Path -Parent $target) | Out-Null
  [System.IO.File]::WriteAllBytes($target, [System.IO.File]::ReadAllBytes($_.FullName))
}
7

验证

PowerShell
codex features list | Select-String -Pattern "remote_control|browser_use|in_app_browser|computer_use|plugins"
codex debug prompt-input "test browser use" | Select-String -Pattern "browser-use:browser|Browser Use|failed to load plugin|plugin is not installed"
看到 browser-use:browserBrowser Use,且没有 failed to load plugin,说明已恢复。最后重启 Codex Desktop。
C

Chrome 插件修复

如果 @browser@chrome 已启用但不可用,先确认用户侧 cache 是否还停留在旧版本。Codex 更新后,安装包里的 browser / chrome 插件可能变成类似 26.519.41501 的版本,而 cache 仍是旧版本或缺少 latest

PowerShell
$package = Get-AppxPackage -Name OpenAI.Codex | Sort-Object Version -Descending | Select-Object -First 1
$browserPlugin = Join-Path $package.InstallLocation "app\resources\plugins\openai-bundled\plugins\browser"
$chromePlugin = Join-Path $package.InstallLocation "app\resources\plugins\openai-bundled\plugins\chrome"
Get-Content (Join-Path $browserPlugin ".codex-plugin\plugin.json") -Raw
Get-Content (Join-Path $chromePlugin ".codex-plugin\plugin.json") -Raw

Get-Content "$env:USERPROFILE\.codex\plugins\cache\openai-bundled\browser\latest\.codex-plugin\plugin.json" -Raw
Get-Content "$env:USERPROFILE\.codex\plugins\cache\openai-bundled\chrome\latest\.codex-plugin\plugin.json" -Raw

如果版本不一致,把安装包里的 plugins\browserplugins\chrome 复制到对应 cache 位置。Chrome 正在运行时,extension-host.exe 可能被锁住;不要先删除整个 chrome\latest,使用哈希感知的覆盖同步,只复制缺失或哈希不同的文件。

Paths
%USERPROFILE%\.codex\plugins\cache\openai-bundled\browser\<version>
%USERPROFILE%\.codex\plugins\cache\openai-bundled\browser\latest
%USERPROFILE%\.codex\plugins\cache\openai-bundled\chrome\<version>
%USERPROFILE%\.codex\plugins\cache\openai-bundled\chrome\latest

同时确认当前插件启用配置仍包含:

config.toml
[plugins."chrome@openai-bundled"]
enabled = true

[plugins."browser@openai-bundled"]
enabled = true
不要用会整体重写 config.toml 的脚本处理包含中文路径的配置。编码不一致时,中文 project table 可能变成乱码并导致 TOML parse error。

如果插件 cache 已经是新版但仍无法启动,继续检查 %LOCALAPPDATA%\OpenAI\Codex\bin\<hash> 下的 helper binary,尤其是 node_repl.execodex.exenode.exerg.exe。修复后完整重启 Codex Desktop,并新开线程测试 @browser / @chrome

@chrome 还需要 Chrome 使用装有 Codex 扩展的正确 profile。profile 名包含空格时要这样启动:

PowerShell
Start-Process -FilePath "C:\Program Files\Google\Chrome\Application\chrome.exe" -ArgumentList '--profile-directory="Profile 1" --new-window about:blank'
不要写成 --profile-directory=Profile 1。未加引号时 Chrome 可能进入错误 profile,扩展 backend 不会出现在 agent.browsers.list() 里。
最终验证应看到 browser:browserchrome:Chrome 都指向 plugins\cache\openai-bundled\...\latest,并且 Browser 与 Chrome 扩展通道都能打开 https://example.com/,标题为 Example Domain
EN

English Summary

Current Codex Desktop builds should own the bundled marketplace lifecycle. A healthy source is the AppX-specific runtime under %USERPROFILE%\.codex\.tmp\bundled-marketplaces\openai-bundled-appx-<desktop-version>.

Fully restart Desktop first, then compare the package and runtime plugin manifests. Use the non-versioned mirror and direct cache copying only as compatibility or last-resort recovery.

remote_control has been removed from the current CLI and must not be added to new configurations.

Core commands
codex plugin marketplace list
codex plugin list
powershell -ExecutionPolicy Bypass -File .\scripts\check-codex-browser-health.ps1
?

FAQ

为什么使用 .codex\.tmp?

这是 Desktop 物化 runtime marketplace 的工作区。新版通常使用带 AppX 版本的 openai-bundled-appx-* 目录,应以当前注册结果为准。

.tmp 有什么风险?

.tmp 可能被清理或重建,这是正常生命周期。先完整重启 Desktop 让它自动恢复;只有原生同步持续失败时才手工复制和注册。

Why does the sample version change?

The cache version must come from the plugin manifest. Codex stores cache entries as <marketplace>\<plugin>\<version>, so use the value from your local plugin.json.