# Codex Bundled Plugin Doctor Error Fix **Repository Path**: cih/codex-bundled-plugin-doctor-error-fix ## Basic Information - **Project Name**: Codex Bundled Plugin Doctor Error Fix - **Description**: 修复Codex Bundled Plugin Doctor 无法正常使用,报错提示:状态: error 判定: runtime-error 说明: 诊断失败。 错误: 本地桥接服务不可用(http://127.0.0.1:57393),请确认 codex-pp-doctor-bridge 正在运行: Failed to fetch (127.0.0.1:57393) 的解决方案, - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-10-19 - **Last Updated**: 2026-10-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Codex 插件修复存档 本仓库只保留可复刻的核心文件和最短操作步骤,适用于 Windows 上的官方 Codex 桌面端 + Codex++。 ## 目录 ```text doctor-bridge/ Doctor 诊断/修复的本地桥接服务、看门狗、schedule 脚本 codex-plus/ Statsig 灰开关补丁和 user_scripts.json 示例 ``` ## 先看结论 | 现象 | 根因 | 处理 | |---|---|---| | Doctor 提示脚本环境没有 Node/Electron | 用户脚本运行在页面沙箱里,没有 Node/Electron 和直接本地网络能力 | 用 `doctor-bridge/` 的本地桥接服务 | | Chrome / Computer Use 开关灰色 | Statsig 门为 `NoValues=false` | 用 `codex-plus/user-scripts/market-codex-local-plugin-gates.js` 覆盖四个门 | | Chrome 扩展显示“未安装” | 扩展装到了 Thorium 或其他 Chromium 配置,不是 Google Chrome | 在真正的 Google Chrome 里安装扩展 | --- ## 1. Doctor 桥接修复 ### 症状 点击 Doctor 的“诊断/修复”后出现: ```text 当前 Codex++ 脚本环境没有开放 Node/Electron 能力 ``` 或者: ```text 本地桥接服务不可用 等待本地桥接服务执行超时 ``` ### 原理 Codex++ 用户脚本被注入到官方 Codex 的页面里执行,不能直接用 Node/Electron,也不能直接访问本机网络。这个桥接服务的做法是: ```text 页面按钮 -> Codex++ 官方桥写日志 -> 本地 Node watcher 读取命令 -> PowerShell 执行 Doctor -> 通过 Codex 的 CDP 端口把结果送回页面 ``` ### 安装 1. 把 `doctor-bridge/` 复制到: ```text C:\Users\Public\CodexPPDoctorBridge ``` 2. 生成一个本地 token: ```powershell $token = -join ((1..32) | ForEach-Object { '{0:x}' -f (Get-Random -Max 16) }) $token ``` 3. 复制 `bridge-config.example.json` 为 `bridge-config.json`,把 `` 换成刚生成的 token。 4. 打开 `market-codex-bundled-plugin-doctor.js`,把其中的 `BRIDGE_TOKEN` 也换成同一个 token。 5. 安装开机启动和看门狗任务: ```powershell powershell -ExecutionPolicy Bypass -File .\install-tasks.ps1 ``` 如果当前用户没有任务计划写入权限,脚本会自动改用当前用户的 `Startup\CodexPPDoctorBridge.lnk`,以 `-Watchdog` 模式启动用户级看门狗, 每 60 秒检查一次桥接端口。watchdog 通过 WMI 独立创建, 不会挂在 Codex++ 的更新进程树下。 6. 把改好的 `market-codex-bundled-plugin-doctor.js` 放到: ```text %APPDATA%\Codex++\user_scripts\ ``` 7. 在 `%APPDATA%\Codex++\user_scripts.json` 中启用脚本,然后重启 Codex++。 ### 验证 ```powershell Get-NetTCPConnection -LocalPort 57393 -State Listen Get-Content .\bridge.log -Tail 10 ``` 端口在监听,并且在 Codex++ 中点击 Doctor 的“诊断”能收到报告,就说明桥接正常。 启动脚本会自动查找 `node.exe`(PATH、Program Files、LocalAppData、nvm),不再依赖固定用户名和版本目录。 桥接会自动扫描 `.codex-session-delete` 下的全部 `codex-plus.log`,包括 Codex++ 多开实例的 `codex-multi\relay-*\worker-home` 日志目录。 如果同时运行多个 Codex 实例,桥接会遍历所有 CDP 端口,只把报告交给真正返回 `delivered=true` 的 Codex++ 页面。 Codex 升级可能结束桥接进程;用户级看门狗会在下一次检查时自动恢复。 --- ## 2. 灰开关:本地覆盖 Statsig 四个门 ### 症状 设置页显示: ```text 已被你的组织停用,或在你所在地区不可用 ``` Chrome 或 Computer Use 开关灰色不可点。 ### 四个门 | Gate | 用途 | |---|---| | `410262010` | app 内 Browser | | `410065390` | 外部 Chrome | | `1506311413` | Computer Use | | `419294242` | locked Computer Use | ### 安装 1. 把脚本复制到: ```text %APPDATA%\Codex++\user_scripts\market-codex-local-plugin-gates.js ``` 2. 在 `%APPDATA%\Codex++\user_scripts.json` 中加入: ```json "user:market-codex-local-plugin-gates.js": true ``` 3. 重载 Codex++ 用户脚本,或直接重启 Codex++。 当前版本可在 Codex++ 设置页点击“重新加载用户脚本”;也可以在桥接已连接时执行: ```js window.__codexSessionDeleteBridge("/user-scripts/reload", {}) ``` ### 为什么有效 脚本在页面里找到 `window.__STATSIG__` 客户端,覆盖: - `getFeatureGate` - `checkGate` - `_getFeatureGateImpl` 只对上面四个 gate 返回 `value=true` 和 `details.reason="LocalOverride"`,然后清空 `_memoCache` 并发出 `values_updated` 事件。React 会重新读取门状态,设置页和下面的 native 功能开关随之刷新。 这是本地页面补丁,不修改官方 `app.asar`,也不调用 OpenAI 云端服务。官方升级后如果 gate ID 或 Statsig 方法变化,需要重新确认。 --- ## 3. Chrome 扩展显示“未安装” 先确认扩展确实在 Google Chrome,而不是 Thorium、Edge 或另一个 Chromium 分支。 官方插件目录通常可以用 `latest`: ```powershell $p = "$env:USERPROFILE\.codex\plugins\cache\openai-bundled\chrome\latest" node "$p\scripts\check-extension-installed.js" --browser chrome --json node "$p\scripts\check-native-host-manifest.js" --browser chrome --json ``` 期望结果: ```text installed: true enabled: true correct: true ``` 扩展 ID: ```text hehggadaopoacecdllhhajmbjkdcmajg ``` Chrome Web Store: ```text https://chromewebstore.google.com/detail/chatgpt/hehggadaopoacecdllhhajmbjkdcmajg ``` 当前经验中,扩展装在 Thorium 的 `Default` 配置里,而 Codex 只检查 Google Chrome/Edge 等受支持浏览器,所以显示“未安装”。解决方法是: 1. 在真正的 Google Chrome 中安装扩展; 2. 确认 `chrome://extensions` 中扩展已启用; 3. 保持 Chrome 运行; 4. 重新打开 Codex 的设置页。 native host manifest 正常位置: ```text %LOCALAPPDATA%\OpenAI\extension\com.openai.codexextension.json HKCU\Software\Google\Chrome\NativeMessagingHosts\com.openai.codexextension ``` Thorium 不是官方 Chrome 插件的受支持目标。即使扩展在 Thorium 里启用,Codex 也不会扫描它,除非另外做非官方的浏览器兼容补丁。 --- ## 4. config.toml 注意 不要写: ```toml browser_use = true computer_use = true ``` 这两个顶层键的实际类型是结构体,写成布尔值会导致 Codex 启动失败。保留 `[features]` 下的合法布尔项即可;它们不是灰开关的直接控制项。 --- ## 5. 使用边界 - 这些修改用于本机学习、研究和自定义环境复刻。 - 不修改官方 `app.asar`,不绕过账号登录,也不调用 OpenAI 云端服务。 - 升级 Codex、Codex++ 或 Chrome 插件后,先重新运行上面的诊断命令。 --- ## 6. 排障复盘 本次问题涉及多开实例日志、WindowsApps 安装源发现、插件目录结构变化、junction 重建、 计划任务权限和用户脚本热重载。完整根因、排查顺序、限制条件与通过标准见: [docs/troubleshooting-notes.md](docs/troubleshooting-notes.md)