Skip to content

fix(weixin): avoid selecting a desktop CLI that cannot execute on Windows - #2239

Open
130040167 wants to merge 1 commit into
BigPizzaV3:mainfrom
130040167:codex/fix-weixin-cli-discovery
Open

130040167 wants to merge 1 commit into
BigPizzaV3:mainfrom
130040167:codex/fix-weixin-cli-discovery

Conversation

@130040167

@130040167 130040167 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

问题

在 Windows 上,通过 Microsoft Store 安装 Codex Desktop 后,点击微信连接设置中的「使用桌面版内置 CLI」,可能填入以下路径:

C:\Program Files\WindowsApps\OpenAI.Codex_<version>_x64__2p2nqsd0c76g0\app\resources\codex.exe

这个文件虽然存在,但管理器进程可能没有执行权限。随后收到微信消息时,启动 Codex app-server 失败,提示「拒绝访问。(os error 5)」。即使用户目录中已经有可正常运行的 Codex CLI,再次点击按钮也会选回不可执行的包内路径。

根因是 find_desktop_codex_cli 原先只查找桌面应用包内的 CLI 文件,没有验证其能否启动,也没有查找用户目录中的 standalone CLI。

修改后的行为

点击「使用桌面版内置 CLI」时:

  1. 优先对包内 CLI 执行 --version;只有进程成功退出才接受该路径。
  2. 如果包内 CLI 缺失或无法启动,查找 %LOCALAPPDATA%\OpenAI\Codex\bin 及其一级版本子目录中的 CLI,取文件修改时间最新的候选,并验证其能否启动。
  3. 两个候选都不可用时,显示未找到可用 CLI 的提示,不返回不可执行的路径。

启动验证设置 5 秒超时,超时后终止并回收探测进程;Windows 上隐藏探测进程的控制台窗口。新增测试覆盖版本子目录、bin 根目录和没有 CLI 文件的情况。

验证

  • 核心库单元测试:423 通过,1 忽略;新增路径发现测试 3 项通过。
  • 本地 TypeScript 检查及 234 项前端测试通过,Windows release 构建成功。
  • PR CI:Windows 测试与构建、macOS ARM64/x64 构建全部通过。
  • Windows 实机:运行修复版管理器后,实际点击按钮,界面及保存配置均使用用户目录中的 CLI;该 CLI 的 app-server 初始化成功。
  • 未验证完整微信消息收发流程。

@130040167 130040167 changed the title fix(weixin): fall back from inaccessible desktop CLI fix(weixin): avoid selecting a desktop CLI that cannot execute on Windows Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant