Repository navigation
[PR] fix(launcher): the claude child stops inheriting a proxy and CA it cannot use (#3446) - #3856
aolshevskiy wants to merge 2 commits into
Conversation
c3f63ef to
9dd9375
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复,是超集关系。 本 PR = owner 的 #3448(NO_PROXY 合并修复)rebase 到 master + 一个增量 commit(claude lane 彻底移除 标签: 审核进行中:分支已取回并 rebase 到最新 master——唯一冲突是 CHANGELOG 条目顺序,已按「新条目在顶」解决、两侧内容全保留。本地 typecheck / build / 定向测试(launcher、aux-proxy-handoff、admin-probe 等 6 个文件):360 pass / 0 fail / 1 skipped,与作者自报一致。CI 上 |
(ai: vllm-qwen/qwen3.8-27b) PR #3856 审核结论(八问) 1. 是什么问题:Claude Code ≥2.1.301 开始遵守代理环境变量,而 2. 什么原因导致的:缺陷的生产者 = launcher 给这条车道的子进程盖了它根本不需要的代理变量。claude 车道走 3. 影响范围与严重程度:p1——CC ≥2.1.301 用户经 4. 怎么修复的:两层。① #3448 内容(commit 19e292da5,owner 作者保留):凡 base URL 被 wrap 到本实例 origin,就把 localhost/127.0.0.1/::1 并入 5. 是否有回归问题:逐条审过触碰路径的既有行为——模型流量路径不变( 6. 是否破坏缓存:不涉及——消息字节不变,前缀缓存稳定性不受影响;无缓存键/重试策略/增量游标变更。 7. 是否改了设计方向:无架构转向。一个明确的方向陈述:claude 车道从「盖代理变量、指望客户端忽略」转为「子进程环境不携带任何 bili 自有代理/CA,出口显式化(自带或实例解析的 aux)」;health 表面新增两个派生只读字段。 8. 是否引入了新的配置:无。没有新 env/config/CLI flag; 验证证据
合入判定与待办
|
|
ework ci失败 |
…ed-exports gates The PR head was based on master@39fb841d, which predates two fixes that already landed on master and were the only failing checks on this PR: - ranxianglei#3870 regenerated CONFIGURATION.md / .zh-CN.md, dropping 4 stale duplicate storage.* rows -> docs-sync gate - log-mask.ts dropped the unused `export` on maskUrlForPublish -> unused-exports gate Merging origin/master (838e975) brings both fixes in cleanly (zero conflicts). The PR's own claude-launcher changes (src/launcher.ts, the auxProxy field in src/server/admin.ts, its tests, and the ranxianglei#3446 doc notes) are preserved untouched. Verified locally on the merged tree: `gen-config-docs.mjs generate` then `git diff --exit-code` is clean; `check-unused-exports.mjs` reports clean. CI auto-fix lane for PR ranxianglei#3856 (failed head 9dd9375).
(ai: vllm-qwen/qwen3.8-27b) CI 两条红门(docs-sync、unused-exports)已在 PR 分支上修好并推送;新 head 根因(不是本 PR 的代码问题):PR 头基于旧 master(
修法:把当前 master( 本地核验(在 merge 后的树上实跑): 结构化结论(八问)
收工判定:两条红门已修绿并推送,PR 现为 mergeable(无冲突),待剩余 test 分片跑完即可合并;本次为纯 CI 修复,无任何行为变更。 |
…li/ base URL is set (ranxianglei#3446)
- claude preset emits neither `HTTPS_PROXY` nor `NODE_EXTRA_CA_CERTS`: its `/bili/` base URL is plain http on loopback, so nothing was ever tunnelled or trusted, and every child (`curl`, `git`, `npm`) issued CONNECT through bili's MITM instead of going direct. - `/__bili/health` gains `auxProxy`/`auxProxySource`, the proxy an AUX (blind-tunnel) request resolves to — `/__bili/upstream` answers for the model upstream, where provider and fallback tiers outrank the env tier. - the launcher hands that proxy to a claude child with no proxy env of its own and leaves a shell-configured child strictly alone; an absent field (pre-handoff build, or explicit direct mode) hands over nothing, never bili's own origin. - CONFIGURATION told Claude Code users to set both variables, re-creating the leak; undici ignores `HTTPS_PROXY` anyway (same file, later section). - tests: four claude env assertions flipped to absence, plus handoff unit coverage and the health wire fields.
1dcbbb6 to
f45358b
Compare
|
(ai: zhipuai-lb/glm-5.3) 已并入合并列车 #4525(master 6d7c587,合并方式 merge commit,提交保留原作者署名)。本 PR 关单收尾;若列车中对应提交出问题,回滚点为 #4525 单提交 revert。 感谢 @aolshevskiy 的贡献——你的提交以原作者署名随列车进入 master(合并方式为 merge commit),仓库贡献者列表可见。 |
(ai: deepseek/deepseek-flash)
Closes #3446.
Duplicate screening (§7.1) found #3446 (the report) and #3448 (an open fix by the owner). This PR is #3448's head rebased onto master (
6deb4547, the #3781 release merge) plus one additive commit. The fork cannot push to #3448's branch, so it lands here; if you prefer, fast-forward #3448's branch to this head and close this one — the trees differ only insrc/launcher.ts's claude preset row, theauxProxyhealth field insrc/server/admin.ts, the tests and the docs, so a squash also works. Commits:b6b20018— [PR] fix: keep /bili/ base-URL legs direct when clients honour proxy envs (Claude Code 2.1.301 self-tunnel 403) #3448 as rebased onto master, author preserved. One conflict resolution: master's#1821MCP-shell-watch sentence is kept in the README claude paragraph alongside your#3446note (README.md,README.zh-CN.md); your launcher, test and CONFIGURATION hunks merged as written.c3f63ef0— the claude lane stops settingHTTPS_PROXYandNODE_EXTRA_CA_CERTS; the proxy this instance resolves for auxiliary egress is published asauxProxyon/__bili/healthand handed to a child that has none of its own; CHANGELOG entry.Why, on top of #3448
#3448 makes the leak harmless for the child; this removes it. After your
NO_PROXYmerge,HTTPS_PROXY=<our origin>governs nothing the claude child needs: its model traffic is plain http on loopback and reaches us directly viaNO_PROXY, with no TLS hop to tunnel and no certificate forNODE_EXTRA_CA_CERTSto vouch for. What the variable still does is ride into every process the child spawns — in-sessioncurl/git/npmissue CONNECT through our MITM and log tunnel destinations the token cache never sees. Both variables are gone from this lane.The root-cause sentence in #3448 makes the same point from the other side: the design "assumed Claude Code ignores
HTTPS_PROXY". Correcting that premise for the client removes the design's purpose, because the lane never wanted a proxy of its own.Behaviour change (old -> new)
HTTPS_PROXY=<bili origin>+NODE_EXTRA_CA_CERTS=<bili CA>; grandchildren tunnelled through bili/bili/leg directprocess.env); theNO_PROXYmerge keeps/bili/directupstreamProxyin the config file, no shell proxyHTTP_PROXY/HTTPS_PROXYvia the handoff;/bili/still directauxProxykey)No model request path changes
The claude lane's model traffic is unchanged:
ANTHROPIC_BASE_URL→/bili/<real upstream>, plain http on loopback, direct by construction rather than byNO_PROXYcompensating for a proxy we set ourselves. Both-mode reasoning holds for #3448's reason: no model request path changes. The only path that changes is out-of-band tool egress.Kernel: untouched. Wire / compression modes: untouched (launcher plus one read-only health field).
The wider blast radius, stated plainly
#3448's safety argument is that a loopback-only exclusion cannot alter routing to real upstreams or corporate proxies. This change does alter it, deliberately:
curl/git/npminside a session stop tunnelling through our MITM, which is the leak. Corporate egress survives — the child keeps its own proxy, or receives the one this instance resolves — and what stops is our instance sitting in the path.NODE_EXTRA_CA_CERTSgoes for the same reason: nothing on this lane has a TLS hop for it to vouch for.Tests
tests/launcher.test.ts— claude env assertions flipped: noHTTPS_PROXY, noNODE_EXTRA_CA_CERTS,baseEnvpreserved, a shell proxy rides through untouched,childNamesProxycovers any scheme in either case. [PR] fix: keep /bili/ base-URL legs direct when clients honour proxy envs (Claude Code 2.1.301 self-tunnel 403) #3448'sNO_PROXYtests (merged triple, union + dedupe, already-complete unchanged, raw-https upstream wins, codex untouched, codebuddy parity) unchanged and passing.tests/aux-proxy-handoff.test.ts(new) — handoff applies both variables; a child naming a proxy is left alone and never probed; nothing to hand over leaves the env unchanged and never names bili's own origin.tests/admin-probe.test.ts— health reportsauxProxy+auxProxySourcefor the inherited-shell tier, the config tier, the explicitly-direct case, and drops an unsupported scheme.Local, on the rebased tree:
node --import tsx --test tests/{launcher,admin-probe,aux-proxy,aux-proxy-handoff,fix-1292-windows-claude-settings,launcher-plugin-mode}.test.ts→ 360 pass / 0 fail / 1 skipped.npm run check:test-import-graphandnpm run check:unused-exportsclean.npm run typecheckfails only on the optionaljimpdependency absent from this clone (src/image-rescale.ts), pre-existing and unrelated. Full-suite verdict = CI.CI: the
unused-exportsred is master-sideunused-exportsfails on this PR with one line, and that line is not in this diff:a4f27307("mask private endpoint hosts in the publish-boundary diagnostics blob") exportsmaskUrlForPublish, and every reference to it sits insidesrc/log-mask.tsitself — the declaration at line 121, a doc-comment mention at 133, and the single call at 137 insidemaskUrlsForPublish. Nothing outside that file imports it, which is the INTERNAL_ONLY shape the gate rejects.Measured on a clean worktree rather than inferred:
upstream/masterat8a00095dfails the gate with nothing else applied, and this branch fails on that same single line both as pushed (based on6deb4547) and replayed onto8a00095d. This diff touches nolog-maskfile.static-gatesandtestare skipped behind the merge gate rather than failing; whether they pass is untested here.Fix, per the gate's own message: drop the leading
exportatsrc/log-mask.ts:121, leavingmaskUrlsForPublishas the public entry. Left out of this PR deliberately — it is unrelated to the claude lane, and it wants its own one-liner against master, which unblocks every open PR at once.