fix: 禁用 axios 自动代理读取,修复 HTTP_PROXY 导致 URL 拼接错误 (#493)#508
Conversation
evandance
left a comment
There was a problem hiding this comment.
The proxy fix itself looks correct and minimal — proxy: false on Lark.defaultHttpInstance.defaults is the right way to disable axios' auto-reading of HTTP_PROXY/HTTPS_PROXY, and the comment explaining global-agent ownership is good context.
The PR currently bundles two independent changes though: the proxy fix (src/core/lark-client.ts) and the Schema 2 operator.user_id fallback from #505 (src/channel/interactive-dispatch.ts, commit 8988258), because this branch is opened on top of #505 rather than main. Each fix is a separate concern with separate review state — #505 still needs a codebase sweep before it can land — so they should travel independently.
Could you rebase #508 onto main so it carries only the proxy commit (7b6be30)? The proxy fix can then land cleanly without being coupled to #505's progress.
7b6be30 to
94579ed
Compare
|
@evandance 已经重新rebase,只剩 proxy 一个 commit。 |
evandance
left a comment
There was a problem hiding this comment.
Thanks for the rebase — the branch is now clean (proxy fix + a small drive-by converting three lark-client.ts comments from Chinese to English, which aligns with the repo's English-comments convention).
One adjustment before this is mergeable: the commit messages currently carry a Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> trailer. That doesn't match the repo's standard commit-message style — none of the recent merged commits, including AI-assisted contributions from other contributors, include Co-Authored-By trailers. Please amend both commits to drop the trailer and force-push.
当系统设置 http_proxy 环境变量时,axios v1.x 自动读取并应用代理, 与 OpenClaw 核心的 global-agent 冲突,导致 API URL 被错误拼接 (如 http://127.0.0.1:7890https://open.feishu.cn/xxxx)。 在 Lark.defaultHttpInstance 上显式设置 proxy: false,禁用 axios 的自动代理读取,代理路由由 OpenClaw 核心的 global-agent 统一管理。 Fixes larksuite#493
62bea18 to
a27ea85
Compare
Summary
proxy: false),修复当系统设置http_proxy环境变量时 API URL 被错误拼接的问题global-agent统一管理,Lark SDK 不应自行处理代理Root Cause
@larksuiteoapi/node-sdk使用axios.create()作为默认 HTTP 客户端。Axios v1.x 会自动读取HTTP_PROXY/HTTPS_PROXY环境变量并应用代理,与 OpenClaw 核心的global-agent产生冲突,导致 URL 被拼接为类似http://127.0.0.1:7890https://open.feishu.cn/xxxx的无效格式。Fix
在
src/core/lark-client.ts中,于Lark.defaultHttpInstance上显式设置proxy: false,仅增加 1 行代码。Test plan
pnpm test— 271 tests passedpnpm lint— 0 errorshttp_proxy环境变量后,飞书 API 请求正常Fixes #493