提交前确认 · Pre-submission checklist
问题类别 · Category
模型设置 / 切换 · Model config
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
阻塞使用 · Blocking (无法使用核心功能 / core function unusable)
复现频率 · Reproducibility
必现 · Always
问题描述 · Description
Repo Wiki generation always fails with fetch failed in an environment that requires an HTTP proxy to reach api.z.ai. Meanwhile, the agent chat (same provider builtin:zai, same model GLM-5.2, same endpoint https://api.z.ai/api/anthropic) works fine in the same session.
This indicates the httpProxy setting from Settings is applied to the agent runtime but not to the wiki generator, which runs in the host process and uses Node's undici/fetch.
Related: #187 — same root cause (httpProxy only applied to a subset of network clients), different affected component. #187 covers Token Plan + feedback upload; this issue covers repo-wiki generation.
Steps to reproduce
- Configure ZCode with a corporate HTTP proxy in Settings:
httpProxy: http://user:pass@proxy.corp.example:8080
httpProxyNoProxy: *.corp.example
- Open a repository in an air-gapped / proxy-only network where direct egress to
api.z.ai:443 is blocked.
- Trigger Repo Wiki generation (e.g. via the "Generate Wiki" / Knowledge Base action).
- Observe failure within ~10s.
Expected behavior
Wiki generation should use the configured httpProxy (same as agent chat does) and succeed.
Actual behavior
Every wiki task fails on the first (catalog) request with a TCP connect timeout to api.z.ai:443:
TypeError: fetch failed
cause: ConnectTimeoutError: Connect Timeout Error
(attempted address: api.z.ai:443, timeout: 10000ms)
at onConnectTimeout (node:internal/deps/undici/undici:1936:23)
at Immediate._onImmediate (node:internal/deps/undici/undici:1902:35)
The host-process log shows:
[repoWiki] Wiki 模型请求开始 {"kind":"catalog","providerId":"builtin:zai","model":"GLM-5.2","endpoint":"https://api.z.ai/api/anthropic","promptChars":20125}
[repoWiki] Wiki 模型请求失败 {"error":"fetch failed"}
[repoWiki] Wiki 生成失败 {"error":"fetch failed"}
At the same timestamp, the agent runtime successfully reaches the identical endpoint:
[zcode-agent-service] 开始请求 ZCode Protocol session/resume
runtimeModel.baseURL: "https://api.z.ai/api/anthropic" ← works
Root cause analysis
Two different HTTP stacks, two different proxy behaviors:
| Component |
Process |
HTTP client |
Reads httpProxy setting? |
Result |
| Agent chat |
ZCode Protocol (child) |
Electron/net |
✅ yes |
works |
| Repo Wiki generator |
Host process (main) |
Node undici/fetch |
❌ no |
ConnectTimeoutError |
Node undici ignores the application-level httpProxy setting — by default it only honors HTTP_PROXY/HTTPS_PROXY env variables, which are not set (and even if set at OS level, ZCode does not propagate them to the host process, per #187). As a result the wiki generator attempts a direct connection to api.z.ai:443, which the corporate firewall drops → 10s ConnectTimeoutError.
Note the failure is at the TCP handshake (before any HTTP body is sent), so request size is not a factor — even the smallest catalog request (~20K chars / ~5KB) fails identically.
Suggested fix
Propagate the httpProxy setting into an undici ProxyAgent / EnvHttpProxyAgent used by the wiki generator (and other host-process callers), the same way the agent runtime honors it. Alternatively, set process.env.HTTPS_PROXY from the setting on host-process boot so undici's default env-based proxy resolution picks it up.
Workaround (for affected users)
Set HTTPS_PROXY / HTTP_PROXY as a system/user environment variable (not just in ZCode Settings) and restart ZCode — undici will then read it. (Unverified in this specific setup due to air-gapped constraints; reported to help in similar cases.)
Environment
- ZCode version: 3.4.2 (Windows Desktop)
- OS: Windows 10 19045 x64
- Provider:
builtin:zai (Z.ai API Key), model GLM-5.2, format anthropic-messages
- Proxy: corporate forward proxy (HTTP), air-gapped network — direct egress to
api.z.ai blocked
- Node (bundled): v24.12.0
Logs
Full stack trace and timeline available from ~/.zcode/v2/logs/ (host-process log, [repoWiki] entries). Can attach sanitized excerpts on request.
复现步骤 · Steps to reproduce
-
In ZCode Settings, configure a corporate HTTP proxy:
-
Open any repository and confirm the agent chat works (it reaches
api.z.ai/api/anthropic through the configured proxy).
-
Trigger Repo Wiki generation (e.g. open the repository's Wiki /
Knowledge Base panel and click "Generate").
-
Wait ~10 seconds. Generation fails with "fetch failed".
期望表现 · Expected behavior
Repo Wiki generation should use the configured httpProxy (the same way
the agent chat already does) and complete successfully. All HTTP requests
made by the wiki generator — starting with the catalog request — should
go through the proxy, not attempt a direct connection to api.z.ai:443.
实际表现 · Actual behavior
Every wiki task fails on the first (catalog) request with a TCP connect timeout to api.z.ai:443:
TypeError: fetch failed
cause: ConnectTimeoutError: Connect Timeout Error
(attempted address: api.z.ai:443, timeout: 10000ms)
at onConnectTimeout (node:internal/deps/undici/undici:1936:23)
at Immediate._onImmediate (node:internal/deps/undici/undici:1902:35)
The host-process log shows:
[repoWiki] Wiki 模型请求开始 {"kind":"catalog","providerId":"builtin:zai","model":"GLM-5.2","endpoint":"https://api.z.ai/api/anthropic","promptChars":20125}
[repoWiki] Wiki 模型请求失败 {"error":"fetch failed"}
[repoWiki] Wiki 生成失败 {"error":"fetch failed"}
At the same timestamp, the agent runtime successfully reaches the identical endpoint:
[zcode-agent-service] 开始请求 ZCode Protocol session/resume
runtimeModel.baseURL: "https://api.z.ai/api/anthropic" ← works
ZCode 版本 · ZCode version
ZCode 3.4.2
设备 / 系统 / 浏览器 · Device / OS / Browser
Win10, Node 24.12, provider/proxy
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
No response
提交前确认 · Pre-submission checklist
问题类别 · Category
模型设置 / 切换 · Model config
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
阻塞使用 · Blocking (无法使用核心功能 / core function unusable)
复现频率 · Reproducibility
必现 · Always
问题描述 · Description
Repo Wiki generation always fails with
fetch failedin an environment that requires an HTTP proxy to reachapi.z.ai. Meanwhile, the agent chat (same providerbuiltin:zai, same modelGLM-5.2, same endpointhttps://api.z.ai/api/anthropic) works fine in the same session.This indicates the
httpProxysetting from Settings is applied to the agent runtime but not to the wiki generator, which runs in the host process and uses Node'sundici/fetch.Related: #187 — same root cause (
httpProxyonly applied to a subset of network clients), different affected component. #187 covers Token Plan + feedback upload; this issue covers repo-wiki generation.Steps to reproduce
httpProxy:http://user:pass@proxy.corp.example:8080httpProxyNoProxy:*.corp.exampleapi.z.ai:443is blocked.Expected behavior
Wiki generation should use the configured
httpProxy(same as agent chat does) and succeed.Actual behavior
Every wiki task fails on the first (catalog) request with a TCP connect timeout to
api.z.ai:443:The host-process log shows:
At the same timestamp, the agent runtime successfully reaches the identical endpoint:
Root cause analysis
Two different HTTP stacks, two different proxy behaviors:
httpProxysetting?undici/fetchConnectTimeoutErrorNode
undiciignores the application-levelhttpProxysetting — by default it only honorsHTTP_PROXY/HTTPS_PROXYenv variables, which are not set (and even if set at OS level, ZCode does not propagate them to the host process, per #187). As a result the wiki generator attempts a direct connection toapi.z.ai:443, which the corporate firewall drops → 10sConnectTimeoutError.Note the failure is at the TCP handshake (before any HTTP body is sent), so request size is not a factor — even the smallest catalog request (~20K chars / ~5KB) fails identically.
Suggested fix
Propagate the
httpProxysetting into anundiciProxyAgent/EnvHttpProxyAgentused by the wiki generator (and other host-process callers), the same way the agent runtime honors it. Alternatively, setprocess.env.HTTPS_PROXYfrom the setting on host-process boot soundici's default env-based proxy resolution picks it up.Workaround (for affected users)
Set
HTTPS_PROXY/HTTP_PROXYas a system/user environment variable (not just in ZCode Settings) and restart ZCode —undiciwill then read it. (Unverified in this specific setup due to air-gapped constraints; reported to help in similar cases.)Environment
builtin:zai(Z.ai API Key), modelGLM-5.2, formatanthropic-messagesapi.z.aiblockedLogs
Full stack trace and timeline available from
~/.zcode/v2/logs/(host-process log,[repoWiki]entries). Can attach sanitized excerpts on request.复现步骤 · Steps to reproduce
In ZCode Settings, configure a corporate HTTP proxy:
(Direct egress to api.z.ai:443 is blocked in this network — a proxy is required.)
Open any repository and confirm the agent chat works (it reaches
api.z.ai/api/anthropic through the configured proxy).
Trigger Repo Wiki generation (e.g. open the repository's Wiki /
Knowledge Base panel and click "Generate").
Wait ~10 seconds. Generation fails with "fetch failed".
期望表现 · Expected behavior
Repo Wiki generation should use the configured httpProxy (the same way
the agent chat already does) and complete successfully. All HTTP requests
made by the wiki generator — starting with the catalog request — should
go through the proxy, not attempt a direct connection to api.z.ai:443.
实际表现 · Actual behavior
Every wiki task fails on the first (catalog) request with a TCP connect timeout to
api.z.ai:443:The host-process log shows:
At the same timestamp, the agent runtime successfully reaches the identical endpoint:
ZCode 版本 · ZCode version
ZCode 3.4.2
设备 / 系统 / 浏览器 · Device / OS / Browser
Win10, Node 24.12, provider/proxy
截图 / 录屏 / 日志 · Screenshots / Recordings / Logs
No response