fix(cli): use EnvHttpProxyAgent in channel proxy to respect NO_PROXY (#6401) - #6405
Conversation
…6401) The channel proxy path used ProxyAgent, which unconditionally routes all requests through the proxy and ignores NO_PROXY. This caused requests to hosts listed in NO_PROXY (e.g. localhost, internal IPs) to fail when a corporate proxy was configured. Switch to EnvHttpProxyAgent, matching the main CLI config path that already handles NO_PROXY correctly.
E2E Report — Issue #6401SummaryIssue: ProxyAgent does not support NO_PROXY Verification ResultsAll checks passed:
Changes
Commit |
|
Thanks for the autofix PR! Template looks good ✓ Problem: This is an observed bug — issue #6401 documents that Direction: Aligned. This is a straightforward proxy correctness fix. The channel runtime was the only path still using Size: Not applicable — no core module paths touched. Files are Approach: The scope is minimal and correct — one import swap in production code, corresponding test updates. No drive-by refactors, no scope creep. This is exactly the kind of focused fix we want. Moving on to code review. 🔍 中文说明感谢 autofix PR! 模板完整 ✓ 问题:这是一个已观测到的 bug — issue #6401 记录了 channel 运行时路径中的 方向:对齐。这是一个直接的代理正确性修复。Channel 运行时是唯一仍在使用 规模:不适用 — 未触及核心模块路径。文件为 方案:范围最小且正确 — 生产代码一个 import 替换,测试相应更新。无附带重构,无范围蔓延。 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code ReviewIndependent proposal (before reading the diff): Replace Comparison with diff: The PR matches the independent proposal exactly. One import swap, one constructor change, corresponding test updates. No surprises. Review findings: No blockers. The change is a textbook drop-in replacement following an established pattern. The Reuse check: Test ResultsUnit tests (worktree, PR applied): Real-Scenario Test (tmux)Wrote a script that starts a local HTTP server on This confirms: — Qwen Code · qwen3.7-max |
|
This is a clean, minimal fix that does exactly what it says. The tmux test demonstrates the bug concretely — No concerns. Shipping. ✅ 中文说明这是一个干净、最小化的修复,完全符合描述。tmux 测试具体展示了 bug — 无顾虑。批准。✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
Downgraded from Approve to Comment: CI still running.
— qwen3.7-max via Qwen Code /review
|
🤖 Reviewed the latest feedback — no changes needed. Why, point by point: No Action Needed — PR #6405Feedback Summary
DecisionNo review comments, requested changes, or actionable feedback received. The PR is in good standing awaiting CI completion. Current Diff
No changes made. Base-conflict check: no conflict with main. |
doudouOUC
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
Clean, focused change — EnvHttpProxyAgent replaces ProxyAgent in the channel proxy path, matching the established pattern in config.ts. Build, typecheck, and all 23 channel tests pass.
— qwen3.7-max via Qwen Code /review
doudouOUC
left a comment
There was a problem hiding this comment.
Review complete. APPROVE submitted on PR #6405.
Results: 9 agents reviewed, 0 confirmed findings after verification. Build, typecheck, and 23/23 tests pass. CI 30/30 green. Clean, focused change that correctly aligns the channel proxy path with the existing config.ts pattern.
|
🤖 Reviewed the latest feedback — no changes needed. Why, point by point: No Action Required — PR #6405Feedback SummaryReview by @doudouOUC (automated reviewer): APPROVE
DecisionNo feedback points to classify. The review is a clean approval with no actionable items. The existing commit ( Base-conflict check: no conflict with main. |
What this PR does
The channel proxy initialization path used undici's
ProxyAgent, which unconditionally routes all HTTP requests through the configured proxy and ignores theNO_PROXYenvironment variable. This meant requests to hosts listed inNO_PROXY(e.g.localhost, internal IPs, corporate services) would fail when a proxy was configured for channel service processes. The fix switches toEnvHttpProxyAgent, which respectsNO_PROXYand matches the pattern already used in the main CLI config path.Why it's needed
Corporate environments commonly use
NO_PROXYto exclude internal services from proxy routing. The channel runtime path (used byqwen serveand channel daemon workers) was the only place still usingProxyAgentfor the global dispatcher, creating an inconsistency with the main CLI path that already usesEnvHttpProxyAgent. This caused connection failures to internal endpoints that should bypass the proxy.Reviewer Test Plan
How to verify
HTTPS_PROXY=http://proxy.example.com:8080andNO_PROXY=localhost,127.0.0.1,.internal.corp.localhost/*.internal.corpbypass it.cd packages/cli && npx vitest run src/commands/channel/start.test.ts— all 23 tests should pass.cd packages/cli && npx vitest run src/commands/channel/daemon-worker.test.ts— all 37 tests should pass.Evidence (Before & After)
N/A — non-UI change (network routing fix).
Tested on
Environment (optional)
Unit tests only —
npm run build,npm run typecheck,npm run lint, vitest.Risk & Scope
EnvHttpProxyAgentis already the established pattern in the main CLI config path and is a drop-in replacement with the same proxy configuration semantics.ProxyAgentusages in the codebase (e.g.setup-github.ts,gitUtils.ts,runtimeFetchOptions.ts) use per-request dispatchers rather than global dispatchers and are not affected by this issue.new ProxyAgent(url)tonew EnvHttpProxyAgent({ httpProxy: url, httpsProxy: url }), but this is internal — no public API is affected.Linked Issues
Fixes #6401
中文说明
本 PR 做了什么
Channel 代理初始化路径使用了 undici 的
ProxyAgent,该代理会无条件将所有 HTTP 请求路由到配置的代理服务器,并忽略NO_PROXY环境变量。这意味着当为 channel 服务进程配置了代理时,发往NO_PROXY中列出的主机(如localhost、内网 IP、企业内部服务)的请求会失败。本修复改用EnvHttpProxyAgent,它会遵守NO_PROXY设置,并且与主 CLI 配置路径中已有的模式保持一致。为什么需要这个改动
企业环境通常使用
NO_PROXY将内部服务排除在代理路由之外。Channel 运行时路径(由qwen serve和 channel daemon worker 使用)是唯一仍在全局 dispatcher 中使用ProxyAgent的地方,与已使用EnvHttpProxyAgent的主 CLI 路径不一致,导致连接到本应绕过代理的内部端点时失败。审阅者测试计划
HTTPS_PROXY=http://proxy.example.com:8080和NO_PROXY=localhost,127.0.0.1,.internal.corp。localhost/*.internal.corp的请求绕过代理。cd packages/cli && npx vitest run src/commands/channel/start.test.ts— 23 个测试应全部通过。cd packages/cli && npx vitest run src/commands/channel/daemon-worker.test.ts— 37 个测试应全部通过。证据(修改前后对比)
不适用 — 非 UI 变更(网络路由修复)。
测试平台
风险与范围
EnvHttpProxyAgent已是主 CLI 配置路径中的既定模式,是具有相同代理配置语义的直接替代品。ProxyAgent用法(如setup-github.ts、gitUtils.ts、runtimeFetchOptions.ts)使用按请求分配的 dispatcher 而非全局 dispatcher,不受此问题影响。new ProxyAgent(url)变为new EnvHttpProxyAgent({ httpProxy: url, httpsProxy: url }),但这是内部变更,不影响任何公共 API。关联 Issue
Fixes #6401