Repository navigation
[PR] fix: strip inherited internal launcher channels from child envs (#3521) - #3549
Conversation
…envs (#3521) An earlier spawn could leave BILI_LAUNCHER_LANE / BILI_LAUNCHER_MODEL_WINDOWS / BILI_LAUNCHER_MODEL_MAX_OUTPUTS / BILI_STRICT_PORT in the parent environment (long-lived desktop hosts, test harnesses). The proxy-child spawn env spreads process.env and only conditionally ADDS the current options' channels, so the stale values rode into the child, got recorded in its instance file, and made every later launch with different options fail attach (model-windows-mismatch) and die on the twin-collision path. stripInheritedProxy now also removes the four internal channels; a new stripInternalLauncherChannels covers the client lanes whose base env passes through verbatim (dsh/kimi/mcode/aider without routable providers, codex and claude direct-URL mode), where the user's own proxy vars must stay intact. User-facing vars (e.g. BILI_MITM_DOMAINS) are untouched.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4198-pr.3549.10c8b73This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3549.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…sthrough contract Unused-exports CI gate flagged the new helper (all refs internal to src/launcher.ts). Add the unit test that pins the contract the verbatim-passthrough client lanes depend on: only the four internal channels are removed, the user's own proxy vars survive.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 独立检索 open+closed issue/PR(inherited launcher channels / model-windows-mismatch / BILI_LAUNCHER_MODEL_WINDOWS):无同症状同机制的在途条目。#3521 楼层 2 声称「Implemented in PR #3510」——已核实 #3510 实为「fix: restore native ACP injection across DSH and Codex」(open),与 launcher 通道继承无关,不构成重复。最近邻 #3436/#3540 是 attach 侧空选项问题(机制相反),已在 #3521 楼层区分。 审核独立性声明:本 PR 是上一会话的工作,本轮未复用其分析结论,对 PR body 的每项声明都重新对照代码独立核验过:全部 ~24 处 env 构造点逐一 grep 清点、spawn 点注入顺序、 ① 原 issue 方向:正确。#3521 定位的是 spawn 侧环境构造(spawn env 由 ② 回归审查(逐项过 diff 触碰路径的既有行为):
③ 代码审查: ④ 测试有效性:三个新测试都有牙——(a) ⑤/⑤b diff 整洁度与代码规范:2 文件 +146/-8,每行都与 #3521 相关,无无关改动/空白漂移;命名达意、无死代码、无重复、风格一致。外部提交从严清单全项过(内部提交自查同标准)。 结构化八问
行为变更披露(旧→新):旧——父环境中出现的四个内部通道值会到达 launcher 构建的所有子进程,即使当前启动未请求;新——这些值永不通过继承跨界,只有当前启动选项的值到达子进程。依据:四者均无文档化用户路径(CONFIGURATION.md:1851–1852 标注 "Only the launcher sets it — no user configuration",:1629 归入 per-process spawn channel);strict-port 的用户 opt-in 走程序化 判定:可合。 CI 在 head |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.662-master.3754ef2 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #3521
What & why
Launcher child processes inherited bili's INTERNAL spawn channels from the parent environment.
stripInheritedProxyremoved only the http(s)_proxy family, and the proxy-child spawn site injects the current launch's channels only when the options supply them — it never removes stale inherited values. So an earlier launch that leftBILI_LAUNCHER_MODEL_WINDOWS(orBILI_LAUNCHER_LANE,BILI_LAUNCHER_MODEL_MAX_OUTPUTS,BILI_STRICT_PORT) in a long-lived host's or test harness's env handed those stale values to every subsequent proxy child regardless of its own options. The child recorded them in its instance file / registry marker, so the next launch with different (e.g. empty) options failed attach withmodel-windows-mismatch/lane-mismatch, spawned a replacement, and died on the same-lane twin holding the sticky port (twin-collision→ "proxy child exited before becoming healthy") — exactly the reported log sequence.Fix
stripInheritedProxynow also strips the four internal channels (INTERNAL_LAUNCHER_CHANNEL_VARS) — covers the proxy-child spawn site plus every client env that already went through it.stripInternalLauncherChannelsstrips ONLY the channels (user's own proxy vars stay intact) and is applied to the client branches whose base env passes through verbatim because bili does not route them via proxy envs: dsh/kimi/mcode/aider when no providers route through the proxy, codex direct-URL, claude direct-URL and claude MITM.Behavior change (disclosed)
Old: any of the four internal channel vars present in the parent env reached EVERY child the launcher builds (proxy child + all clients), even when the current launch did not request them. New: they never cross a process boundary by inheritance; only values from the current launch's options reach children. Safe because none of the four has a documented user-facing path (CONFIGURATION.md marks them "Only the launcher sets it — no user configuration" / spawn channel; strict-port opt-in goes through programmatic
opts.strictPortfrom explicit port config). User-facing env (BILI_MITM_DOMAINSas the config twin ofmitm.domains, the user's own proxy vars) is untouched. Self-restart (src/restart.ts) deliberately inherits env across the upgrade handover and does not use these functions — unchanged.Tests
stripInheritedProxystrips all four channels, keepsBILI_MITM_DOMAINS/PATH/HOME.