Codex Browser Use Fix

Windows guide for keeping Codex Desktop's bundled Browser Use plugin available after updates by pinning openai-bundled to Codex's bundled marketplace workspace.

!

为什么更新后会掉

Codex Desktop 更新后,安装目录中的版本号通常会变化。如果 config.toml 里的 openai-bundled marketplace 仍指向旧安装目录,Browser Use 就可能消失或加载失败。

这里选择把 openai-bundled 复制到 Codex 用户目录下的 bundled marketplace 工作区,并注册这个路径。

推荐路径:%USERPROFILE%\.codex\.tmp\bundled-marketplaces\openai-bundled

如果固定 marketplace 还在,但 codex debug prompt-input 不再显示 browser-use:browser,通常是插件 cache 被清理,或 config.toml 丢失了 browser-use@openai-bundled / remote_control 配置。

0

快速恢复

如果 %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
'@
}

codex features enable remote_control
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"
验证通过后重启 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

复制到 bundled marketplace 工作区

不要长期注册带版本号的 Codex 安装目录。把 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 清理或重建。如果发生这种情况,重新复制并注册即可。
4

重新注册固定 Marketplace

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

配置文件中应指向用户目录镜像,而不是带版本号的安装目录。

5

启用 Browser Use 配置

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。
EN

English Summary

Codex updates can change the versioned installation directory. If config.toml points to the old bundled marketplace source, Browser Use may disappear or fail to load.

Recommended fix: mirror openai-bundled into %USERPROFILE%\.codex\.tmp\bundled-marketplaces\openai-bundled, remove the old marketplace registration, then register that path.

If the marketplace mirror still exists but Browser Use disappears again, rebuild the plugin cache from the manifest version and confirm remote_control is enabled.

Core commands
codex plugin marketplace remove openai-bundled
codex plugin marketplace add "$env:USERPROFILE\.codex\.tmp\bundled-marketplaces\openai-bundled"
codex features enable remote_control
codex debug prompt-input "test browser use" | Select-String -Pattern "browser-use:browser|Browser Use|failed to load plugin|plugin is not installed"
?

FAQ

为什么使用 .codex\.tmp?

它不包含 Codex 安装包版本号,并且更接近 Codex 自己维护 bundled marketplace 的位置,后续更新更可能刷新这里的内容。

.tmp 有什么风险?

.tmp 可能被清理或重建。如果 Browser Use 再次消失,重新复制 bundled marketplace 并注册即可。

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.