MoonshotAI / MoonshotAI/kimi-cli
FetchURL 未读取系统代理,在被墙环境下无法访问外网,而 Shell/curl 正常 || FetchURL has not read the system proxy and cannot access the external network in a blocked environment, but Shell/curl is normal
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What version of Kimi Code CLI is running?
kimi, version 1.43.0
Which open platform/subscription were you using?
managed:kimi-code(Kimi Code 账号登录)
Which model were you using?
K2.7 Code (kimi-for-coding)
What platform is your computer?
Linux 6.18.33.1-microsoft-standard-WSL2 x86_64 x86_64
What issue are you seeing?
在存在 GFW 的网络环境下,系统代理已正确配置,Shell 中的 curl 可以正常访问 YouTube/Google,但 FetchURL 工具会失败。
Shell 环境变量:
HTTP_PROXY=http://127.0.0.1:7890
HTTPS_PROXY=http://127.0.0.1:7890
http_proxy=http://127.0.0.1:7890
https_proxy=http://127.0.0.1:7890
curl 测试通过:
curl -I https://www.youtube.com # 200 OK
curl -I https://www.google.com # 200 OK
但 FetchURL 访问同样的 URL 会失败。
~/.kimi/logs/kimi.log 中的相关日志:
kimi_cli.tools.web.fetch:_fetch_with_service:158 - FetchURL service HTTP error: status=403, url=https://www.youtube.com
kimi_cli.tools.web.fetch:fetch_with_http_get:87 - FetchURL network error: Cannot connect to host www.youtube.com:443 ssl:default [Connection reset by peer], url=https://www.youtube.com
kimi_cli.tools.web.fetch:_fetch_with_service:158 - FetchURL service HTTP error: status=403, url=https://www.google.com
kimi_cli.tools.web.fetch:fetch_with_http_get:87 - FetchURL network error: Cannot connect to host www.google.com:443 ssl:default [Connection reset by peer], url=https://www.google.com
另外,执行 curl --noproxy "*" 会返回 Connection reset by peer,说明直连确实被墙,只有走代理才能访问。
What steps can reproduce the bug?
1.配置本地 HTTP 代理,并导出 HTTP_PROXY/HTTPS_PROXY。
2.执行:
curl -I https://www.youtube.com
curl -I https://www.google.com
结果正常(200 OK)。
3.在同一会话中,使用 FetchURL 工具访问 https://www.youtube.com 和 https://www.google.com。
4.观察到失败:Connection reset by peer。
What is the expected behavior?
FetchURL 应该读取 HTTP_PROXY/HTTPS_PROXY 环境变量,或者支持在 ~/.kimi/config.toml 中配置代理,从而像 curl 一样正常访问外网。
Additional information
当前临时 workaround:用 Shell 工具执行 curl/wget 代替 FetchURL。
本地代理为 Clash Verge 的 HTTP 代理,地址是 127.0.0.1:7890。
What version of Kimi Code CLI is running?
kimi, version 1.43.0
Which open platform/subscription were you using?
managed:kimi-code (Kimi Code account login)
Which model were you using?
K2.7 Code (kimi-for-coding)
What platform is your computer?
Linux 6.18.33.1-microsoft-standard-WSL2 x86_64 x86_64
What issue are you seeing?
In a network environment with GFW, the system proxy has been configured correctly, and curl in the Shell can access YouTube/Google normally, but the FetchURL tool will fail.
Shell environment variables:
HTTP_PROXY=http://127.0.0.1:7890
HTTPS_PROXY=http://127.0.0.1:7890
http_proxy=http://127.0.0.1:7890
https_proxy=http://127.0.0.1:7890
The curl test passes:
curl -I https://www.youtube.com # 200 OK
curl -I https://www.google.com # 200 OK
But FetchURL will fail when accessing the same URL.
Relevant logs in ~/.kimi/logs/kimi.log:
kimi_cli.tools.web.fetch:_fetch_with_service:158 - FetchURL service HTTP error: status=403, url=https://www.youtube.com
kimi_cli.tools.web.fetch:fetch_with_http_get:87 - FetchURL network error: Cannot connect to host www.youtube.com:443 ssl:default [Connection reset by peer], url=https://www.youtube.com
kimi_cli.tools.web.fetch:_fetch_with_service:158 - FetchURL service HTTP error: status=403, url=https://www.google.com
kimi_cli.tools.web.fetch:fetch_with_http_get:87 - FetchURL network error: Cannot connect to host www.google.com:443 ssl:default [Connection reset by peer], url=https://www.google.com
In addition, executing curl --noproxy "*" will return Connection reset by peer, indicating that the direct connection is indeed blocked and can only be accessed through a proxy.
What steps can reproduce the bug?
-
Configure the local HTTP proxy and export HTTP_PROXY/HTTPS_PROXY.
-
Execution:
curl -I https://www.youtube.com
curl -I https://www.google.com
The result is normal (200 OK). -
In the same session, use the FetchURL tool to visit https://www.youtube.com and https://www.google.com.
-
Failure observed: Connection reset by peer.
What is the expected behavior?
FetchURL should read the HTTP_PROXY/HTTPS_PROXY environment variable, or support configuring the proxy in ~/.kimi/config.toml to access the external network normally like curl.
Additional information
Current temporary workaround: Use shell tool to execute curl/wget instead of FetchURL.
The local proxy is Clash Verge’s HTTP proxy at 127.0.0.1:7890.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with kimi_cli.tools.web.fetch, especially fetch_with_http_get and _fetch_with_service, and reproduce the failure using the documented HTTP_PROXY and HTTPS_PROXY environment variables. Done means FetchURL can access the tested URLs through the configured proxy, or the supported ~/.kimi/config.toml proxy setting, while preserving the existing direct-connection behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 57/100