Repository navigation
fix(launcher): strip inherited proxy vars from opencode/pi/omp/codex/codebuddy launch env (#890) - #892
Conversation
) The opencode branch spread the full process.env, so lowercase http_proxy/https_proxy/all_proxy inherited from the user's shell survived alongside the uppercase HTTPS_PROXY bili injects. undici (and Bun) resolve the lowercase form first when both are present, so model traffic was silently routed to the user's own proxy instead of bili — no processTurn/forward traces in the bili log while the session kept growing until the upstream rejected it on context overflow. Base the env on stripInheritedProxy(process.env), the same contract already used by hermes/dsh/kimi/qoder/trae/jcode. Regression test captures the spawned client env and asserts all eight generic proxy vars are stripped while unrelated vars are preserved.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-892Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr892.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ll 8-var strip assertions (#890)
[bot] 🏷 Review 结论:生产代码改动正确,但 CI 在 Windows 上红了——根因是新回归测试的测试桩问题,已在 PR 分支直接修掉(commit ✅ 生产代码验证通过
❌ 发现的 CI 失败(windows-latest 22,test job) 根因(测试桩,非生产代码):fake 二进制命名为无扩展名的 修复(已推送到 PR 分支,
本地验证(@8347f71): 一句话中文摘要:修复了新回归测试在 Windows 上因 fake 二进制缺 |
[bot] 🏷 CI 全绿,PR 可以合并。 ✅ 修复 commit
合并操作按仓库规范由人工执行:#892 一句话中文摘要:Windows 测试挂死的根因(fake 二进制缺 |
… launch env (#890) Owner-approved scope extension of the opencode fix: these four clients also spread raw process.env into the child env while injecting uppercase HTTPS_PROXY, so an inherited lowercase http(s)_proxy/all_proxy (which undici/Bun/reqwest prefer) silently routes model traffic around bili. - pi / omp: buildPiEnv now receives stripInheritedProxy(process.env) - codex MITM: buildCodexEnv now receives stripInheritedProxy(process.env); direct mode (BILI_LAUNCHER_DIRECT=1) intentionally unchanged — its model traffic bypasses bili by design, so the user's egress config stays intact - codebuddy: buildCodebuddyEnv now receives stripInheritedProxy(process.env) (loopback CODEBUDDY_BASE_URL traffic can no longer be hijacked by a user proxy) - runTestPi (bili test pi path) follows suit - claude unchanged: Claude Code ignores proxy env vars for model traffic Regression tests: shared captureLaunchedClientEnv harness + one test per client asserting all 8 generic proxy vars are stripped while HTTPS_PROXY points at bili and unrelated vars survive.
What
Launchers inject uppercase
HTTPS_PROXY(pointing at bili) into the client env, but spread rawprocess.envas the base — so lowercasehttp_proxy/https_proxy/all_proxyinherited from the user's shell survive. undici (Node), Bun, and reqwest prefer lowercase when both exist, so model traffic silently bypasses bili: no trace in the proxy logs at all, the session keeps growing until the upstream rejects it for context overflow (e.g. "maximum context length is 1048576 tokens... requested 3489289").Fix: base the child env on
stripInheritedProxy(process.env)(the same helper hermes/dsh/kimi/qoder/trae/jcode already use) for every client whose model traffic rides bili's cert-MITM or loopback rewrite:{ ...stripInheritedProxy(process.env), HTTPS_PROXY: origin, NODE_EXTRA_CA_CERTS: ca, BILLION_CONTEXT_PROXY: origin }buildPiEnv(..., stripInheritedProxy(process.env), ...)buildCodexEnv(..., stripInheritedProxy(process.env))buildCodebuddyEnv(..., stripInheritedProxy(process.env))— loopbackCODEBUDDY_BASE_URLtraffic can no longer be hijacked by a user proxybili test pipathScope notes:
ANTHROPIC_BASE_URL/ plugin).BILI_LAUNCHER_DIRECT=1) intentionally unchanged — in direct mode the model traffic does not reach bili by design, so the user's own egress config stays intact there.BILLION_CONTEXT_PROXYandNODE_EXTRA_CA_CERTSare not generic proxy conventions — untouched.proxy,upstreamProxyMode, per-routeproviders[...].proxy) — visible in logs as[upstream-proxy] ... (source=config|auto|bili-env).Closes #890
Verification
npm run typecheck✅npm test: 1675 tests, 1673 pass, 0 fail, 2 skipped (gated e2e) ✅npm run build✅captureLaunchedClientEnvharness + one test per client (opencode/pi/omp/codex/codebuddy) — all 8 generic proxy vars stripped whileHTTPS_PROXYpoints at bili, unrelated env vars survive, win32-safe fake-bin naming.