Repository navigation
Default install to a user-level npm prefix (~/.local) - #2292
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2419-pr.2292.0f416b0This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2292.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR #2292 review — 可合(待 CI 全绿;合并由人执行) 先说结论:代码层面我找不到阻塞项。这是一个「文档 + 一条日志字符串」的窄改动,方向打在根因上,diff 干净,无回归。按七问给结论: 1. 是什么问题 2. 什么原因导致的 3. 怎么修复的 4. 是否有回归问题 — 无。逐项过触碰路径的既有行为:
5. 是否破坏缓存 — 不涉及。不触碰任何缓存/重试游标/去重键;install-backoff 状态文件读写路径未改。 6. 是否改了设计方向 — 不涉及。架构/边界/数据流无转向;只是把「推荐安装位置」从 root global prefix 移到用户级 prefix,与现有下游发现路径一致——已逐处核实: 7. 是否引入了新的配置 — 不涉及。无新 env/config/flag;仅文档 + 一条日志字符串。 几点补充判断:
判定:可合(代码层面无阻塞项,待全量 CI 转绿)。非 auto-merge 资格——§7.4 触碰 |
Summary
Closes #2217 (来源: dog/billion-context#16, internal tracker — owner-directed).
Make the documented default install a user-level npm prefix so Linux/macOS users never land on a root-owned global prefix — the cohort behind the #1603/#2192 update retry-storms (a sudo-created root-owned install fails self-update at the swap stage and re-downloads the tarball every 3-min cycle, up to ~480 downloads/day/machine).
What changes (旧 → 新)
README.mdInstallnpm install -g billion-contextblocknpm config set prefix "$HOME/.local"+ PATH line (with "add to ~/.bashrc / ~/.zshrc" note) + install; nvm/Homebrew-Node and Windows keep the plain install; EACCES troubleshooting → the two prefix lines + reinstall, "avoidsudo"README.zh-CN.md安装website/blog/posts/2026-10-08_meet-bili.md/.zh.mdsrc/update.tsremediationHint(/not writable/branch)npm config set prefix "$HOME/.local"(+ put"$HOME/.local/bin"on PATH) then reinstall; win32 gets "the default npm prefix (%APPDATA%\npm) is user-writable — repair that dir's ownership/permissions and reinstall"The remediation hint is emitted on the #1603 backoff escalation log line only. String-only change — no download/extract/install/version-check logic touched, and no test asserts the old string. Flagging for the human reviewer per §5:
src/update.tschanges normally route through the no-op-release protocol; this is a user-guidance string, not updater logic — owner decides whether staging is still wanted.Windows compatibility
Windows keeps the plain install: npm's default prefix there (
%APPDATA%\npm) is already user-writable, and the$HOMEbash-isms don't apply — so the prefix flow is deliberately NOT advertised for Windows anywhere. Theupdate.tshint branches onprocess.platform.Why this is the root-cause fix
The retry storm is produced at install time (docs teaching
npm i -gonto a root-owned prefix → sudo → root-owned files). Preventing the root-owned prefix removes the producer; the concrete remediation string unblocks machines already stuck (#1603's "124× over 12 days" class). Downstream compatibility is already in place: client discovery searches~/.local/lib/node_modules(src/agent/opencode-legacy.ts:113) and~/.local/bin(src/pi-channel.ts:74,src/dsh-channel.ts:230,src/launcher.ts:3720).Not changed (deliberately)
README.md:16,README.zh-CN.md:16,website/index.htmlchip) — correct for Windows/macOS/nvm; the Install section carries the prefix setup.TECHNICAL-NOTES.md/.zh-CN.mdinstall-lane tables — descriptive, not setup instructions.reference/*.mdinternal recipes — dev/CI contexts with healthy prefixes.update-notes.ts,acp-status.ts,advisory.ts,web/client.ts) — nudges for already-running installs; the broken-prefix cohort hits theupdate.tsescalation hint instead.Config surface
None — docs plus one log string; no config/env/flag additions.
Pre-flight (on this branch, master @ 9f82bbe + diff)
npm run typecheckcleannpm test4562 pass / 0 fail / 27 skipped (one unrelated timing test, Windows/dsh 宿主重启:代理就绪超出 SPAWN_WAIT_MS(20s) 导致 bootstrap 失败,本进程内无重试 → /bili/origin 恒为 null、设置面板永久"未绑定"、整场会话直连(压缩失效) #2187 slow-start budget, flaked once under full-suite load; passes in isolation and on rerun)npm run buildgreen (kernel + tsup)Review note
NOT auto-merge eligible (touches
src/update.ts, §7.4 must-stay-human). Human review requested.