Skip to content

fix(wechat): Windows 系统上 doctor 误判微信公众号渠道不可用#263

Open
Pgooone wants to merge 1 commit intoPanniantong:mainfrom
Pgooone:fix-wechat-windows-encoding
Open

fix(wechat): Windows 系统上 doctor 误判微信公众号渠道不可用#263
Pgooone wants to merge 1 commit intoPanniantong:mainfrom
Pgooone:fix-wechat-windows-encoding

Conversation

@Pgooone
Copy link
Copy Markdown

@Pgooone Pgooone commented Apr 12, 2026

问题描述

修复 Windows 中文系统上 agent-reach doctor 因编码问题误判微信公众号文章渠道不可用的 bug。

根因分析

agent_reach/channels/wechat.py_exa_available() 使用 subprocess.run(..., text=True, ...),在未指定编码时,Windows 中文环境默认使用 gbk 解码 mcporter config list 的输出。当输出中包含 UTF-8 特殊字符(如 0x94)时,抛出 UnicodeDecodeError,异常被捕获后函数返回 False,导致 doctor 显示 [X]。但这是假阴性,mcporter + Exa 实际完全可用。

改动内容

  • text=True 改为 encoding="utf-8", errors="replace"
  • exa_search.py 中的处理方式保持一致

验证结果

修复前:

  • UnicodeDecodeError: 'gbk' codec can't decode byte 0x94
  • doctor 状态:8/16,微信公众号显示 [X]

修复后:

  • doctor 无异常
  • doctor 状态:9/16,微信公众号显示 ✅
  • exa.web_search_exaexa.web_fetch_exa 读取公众号文章功能正常

Fixes #262

在 Windows 中文系统上,subprocess.run 使用 text=True 时默认以
gbk 编码读取 mcporter config list 的输出,当输出中包含特殊
字符(如 UTF-8 的 0x94)时会抛出 UnicodeDecodeError,导致
_exa_available() 返回 False,进而使 agent-reach doctor 误判
微信公众号文章渠道为 [X] 不可用。

本修复将 text=True 替换为 encoding="utf-8", errors="replace",
与 exa_search.py 中的做法保持一致。

Closes #ISSUE_ID
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.

fix: Windows 中文系统上 agent-reach doctor 误判微信公众号渠道不可用

1 participant