You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The auto-updater's two outbound fetches bypass bili's upstream-proxy machinery entirely:
src/update.ts:367 — fetch("https://registry.npmjs.org/<pkg>/latest") (no dispatcher)
src/update.ts:494 — tarball download (no dispatcher)
undici's global fetch does not honor HTTPS_PROXY/HTTP_PROXY env vars, and no dispatcher is passed, so these connections always go direct. Meanwhile every model-traffic path in bili resolves a proxy decision (src/upstream-proxy.ts: resolveProxyDecision() → proxyDispatcher(), precedence per-provider → BILI_UPSTREAM_PROXY → web-manual → config proxy → env → Windows system proxy → direct, NO_PROXY honored).
Impact
On deployments where npm is only reachable through a proxy (the GFW scenario the README explicitly supports for model traffic), every update check fails with a warn log and auto-update silently never works — users sit on old versions indefinitely, with no visible signal beyond [update] check failed: lines.
Suggested fix
Route both updater fetches through the same decision path: resolve the proxy for the registry origin (and the tarball host) and pass dispatcher: proxyDispatcher(proxyUrl) to the fetch calls. startAutoUpdate/checkForUpdate currently take only {packageName, currentVersion, autoUpdate} (src/cli.ts:408-409), so the proxy inputs (routes, globalProxy, fallback options) need threading — or a small resolver callback. Honor NO_PROXY via matchesNoProxy.
Constraints
Per AGENTS.md §5, any change to src/update.ts download logic must be validated with a no-op release before shipping.
Origin: bundled in LX666-666's PR #86 alongside a three-state update mode; the mode half is being declined (see #606), the egress half stands on its own merits.
Evidence: src/update.ts:367 (registry check) and src/update.ts:494 (tarball download) call bare fetch() with no dispatcher. undici's global fetch does not read HTTP(S)_PROXY/ALL_PROXY env vars absent an explicit dispatcher, so both updater egresses always go direct while every model-traffic path resolves through resolveProxyDecision(). The issue's analysis is accurate at every layer — the reported symptom (auto-update silently dead on proxy-only-host) is the root cause surface, no deeper layering problem found.
Live repro: isolated install dir + local recording proxy. With the fix and config {"proxy":"http://127.0.0.1:47999","upstreamProxyMode":"auto"}, CONNECT registry.npmjs.org:443 arrives at the proxy; pre-fix the identical setup connects direct. Proxy socket destroyed → graceful [update] check failed: warn, no crash.
UpdateOptions gains an optional resolver callback resolveProxy?: (url) => string | undefined (keeps update.ts decoupled from config details; absent = direct). Both fetches pass dispatcher: proxyDispatcher(resolveProxy(url)); per-URL resolution so registry origin and tarball host each get their own decision; NO_PROXY honored inside resolveProxyDecision.
CLI wires the resolver at both entry points (startup auto-update + bili update). The closure reads opts.routes/proxy/proxyFallback per call, so web-UI config hot-reload is picked up live without restart.
Pre-flight: typecheck clean · npm test 1181/1182 (the 1 failure is pre-existing and env-dependent — launcher.test.ts codex PATH resolution, reproduced on the pristine tree) · tsup build OK · 4 new unit tests in tests/update-proxy.test.ts.
Minor findings while working (report-only, fixed/unchanged as noted)
bili update silently ignored -F <proxy>: the update command branch executed before the flag/env merge loop, so manual updates never saw CLI overrides. Fixed in the same PR (merge happens first now); broken config degrades to direct egress with a visible CLI error instead of a silent surprise.
Heads-up for GFW users: a config "proxy" value alone does nothing unless "upstreamProxyMode": "auto" (or manual, or the BILI_UPSTREAM_PROXY env var) — the mode default is intentionally direct. Pre-existing documented behavior, untouched by this fix, but it determines which configs actually benefit from it.
Release sequencing (§5 gate — needs your call)
This change touches src/update.ts download logic, so per AGENTS.md §5 it must be validated by a no-op release before merging. v0.1.89 already shipped from master after this branch's base — if a real-world auto-update to 0.1.89 has been observed succeeding, the existing upgrade path is validated and the PR can merge as-is. Otherwise I'll prepare a no-op v0.1.90 release PR to land first, then rebase this on top. Tell me which you'd like; either way the merge stays yours.
Activity
ranxianglei commentedon Sep 7, 2026
[bot] 🏷 Triage conclusion: bug confirmed.
Verification (audit-first, per spec)
src/update.ts:367(registry check) andsrc/update.ts:494(tarball download) call barefetch()with nodispatcher. undici's global fetch does not readHTTP(S)_PROXY/ALL_PROXYenv vars absent an explicit dispatcher, so both updater egresses always go direct while every model-traffic path resolves throughresolveProxyDecision(). The issue's analysis is accurate at every layer — the reported symptom (auto-update silently dead on proxy-only-host) is the root cause surface, no deeper layering problem found.{"proxy":"http://127.0.0.1:47999","upstreamProxyMode":"auto"},CONNECT registry.npmjs.org:443arrives at the proxy; pre-fix the identical setup connects direct. Proxy socket destroyed → graceful[update] check failed:warn, no crash.Fix — PR: #613
UpdateOptionsgains an optional resolver callbackresolveProxy?: (url) => string | undefined(keepsupdate.tsdecoupled from config details; absent = direct). Both fetches passdispatcher: proxyDispatcher(resolveProxy(url)); per-URL resolution so registry origin and tarball host each get their own decision;NO_PROXYhonored insideresolveProxyDecision.bili update). The closure readsopts.routes/proxy/proxyFallbackper call, so web-UI config hot-reload is picked up live without restart.typecheckclean ·npm test1181/1182 (the 1 failure is pre-existing and env-dependent —launcher.test.tscodex PATH resolution, reproduced on the pristine tree) · tsup build OK · 4 new unit tests intests/update-proxy.test.ts.Minor findings while working (report-only, fixed/unchanged as noted)
bili updatesilently ignored-F <proxy>: theupdatecommand branch executed before the flag/env merge loop, so manual updates never saw CLI overrides. Fixed in the same PR (merge happens first now); broken config degrades to direct egress with a visible CLI error instead of a silent surprise."proxy"value alone does nothing unless"upstreamProxyMode": "auto"(ormanual, or theBILI_UPSTREAM_PROXYenv var) — the mode default is intentionallydirect. Pre-existing documented behavior, untouched by this fix, but it determines which configs actually benefit from it.Release sequencing (§5 gate — needs your call)
This change touches
src/update.tsdownload logic, so per AGENTS.md §5 it must be validated by a no-op release before merging. v0.1.89 already shipped from master after this branch's base — if a real-world auto-update to 0.1.89 has been observed succeeding, the existing upgrade path is validated and the PR can merge as-is. Otherwise I'll prepare a no-op v0.1.90 release PR to land first, then rebase this on top. Tell me which you'd like; either way the merge stays yours.Merge pull request #613 from ranxianglei/2026-09-07_updater-egress-proxy
fix: route updater egress through configured upstream proxy (ranxiang…
feat(update): follow a dist-tag channel (updateTag) + semver-prerelea…
feat(update): follow a dist-tag channel (updateTag) + semver-prerelea…
docs: absorb upstream-proxy, key-scheme and derived-session details i…