Repository navigation
[PR] In-place auto-update 100% failure fix: Backup must not exist prior to atomic swap (Gate Lane X repro) | 就地自动更新 100% 失败修复:备份不能先于原子交换存在(门禁 Lane X 复现) - #6643
Conversation
…ap (#6309 regression) The #6309 atomic-swap rewrite (30fb96f) copied the current install into backupDir BEFORE attempting the rename(installDir, backupDir) swap. A non-empty backup target makes that rename fail ENOTEMPTY every time, so the atomic path could never succeed, and the fallback then re-copied the install onto the EXISTING backup tree — where libuv's self-copy guard aborts on npm's relative node_modules/.bin symlinks (EINVAL / "cannot copy ... to a subdirectory of self"). Net effect: every in-place auto-update on an npm-layout install (real node_modules, as npm i -g lays it down) failed with "backup of current install failed (install left untouched)" and the stuck version kept running. Found by the local real-model gate, Lane X (0.1.213 -> 0.1.214-gate.0 install), master re-review 2026-11-14. Fix: create the file backup only on the fallback merge-copy path, into a FRESH destination; the atomic path keeps using the renamed-aside install as its rollback source (behavior unchanged). Pinned by tests/update-inplace-symlink-layout.test.ts: two consecutive in-place updates over a relative-.bin-symlink layout + corrupt-artifact rollback. Red on the old code (same error string as the gate), green after the fix; 46/46 update suites green.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9841-pr.6643.cdd7cf6This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6643.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重:不重复(本 PR 针对 #6309 原子交换改造引入的就地更新回归,门禁 Lane X 已逐步复现钉死机制)。 上一会话因 35 分钟无输出被强制重启,现汇报验证进度——代码与 CI 核查已完成,结论如下。 独立验证(未照抄 PR 描述,重新做过):
结构化八问:
判定:代码 + 定向红绿验证 + 主 CI 全绿;4 条 e2e 重跑进行中(同 sha batch 1 全绿,风险低)。重跑完成后本 PR 可合。全真门禁 Lane X 复跑(X 4/4)按 PR 描述仍待执行。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI 收尾:4 条 e2e 重跑车道全部完成——全绿。当前 PR head(6bea05b)上所有 check 状态:主 CI ✅、Windows codex overlay ✅、e2e-native-pi / e2e-codex-persona / e2e-native-opencode / e2e-native-dsh / e2e-fake-codex / e2e-local-registry / e2e-pi-codex-ws ✅、PR Build Artifact ✅。 CI 侧已无阻塞,PR 可合。剩余事项:全真门禁 Lane X 复跑确认(X 4/4),按 PR 描述由门禁侧执行。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 收到重启通知——核实过线程实况:本条通知对应的是上一轮会话的收尾时刻(05:29Z 已正常 completed,29 min),工作已全部交付并汇报,无中断、无遗留操作。 当前状态(刚核实):
无新问题、无阻塞,本线程 agent 侧工作到此结束。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1192-master.1ff89e8 # this exact build
npm install -g billion-context@master # always the newest merged build
|
|
补充:Windows 真机验证(2026-11-14,Win10 22H2 VM,Node v22.23.2 / npm 10.9.8,宿主 verdaccio 私有 registry) 按用户要求在 Windows 虚拟机上对修复后的 master(1ff89e878,含本 PR)做了端到端就地自更新实测:
修复前后行为对照:修复前该代码路径在 npm 布局(相对 .bin 链接)上 100% 失败(容器内已复现 EINVAL),Windows 真机上修复后三条路径全部通过。 |
…6643 regression class) The update code paths were only covered by unit tests with hand-built directories and by the real-model gate Lane X, which materializes a REAL npm global install. ranxianglei#6643 (pre-ranxianglei#6340 atomic-swap rewrite) made every in-place update on an npm-layout install fail 100% — cp-onto-existing- backup hit libuv's self-copy guard on the relative node_modules/.bin symlinks — and no CI lane caught it. New tests/e2e/e2e-selfupdate-cli.test.ts in the existing hermetic registry lane (ACP_TEST_REGISTRY=1, ci-registry.yml, ubuntu+windows): publish a fixture package with a bin-bearing dependency (so npm lays down a real relative .bin symlink tree), npm install -g it, then run the REAL CLI 'bili update' and assert the version advances on disk + in 'bili --version', plus a clean no-op second update. Verified: - green on master (fix in place) in the bili-gate container (node 22 / npm 10) - red with ranxianglei#6643 reverted: exact gate failure signature 'backup of current install failed ... ERR_FS_CP_EINVAL ... node_modules/.bin/mime' - green locally (node 25 / npm 11 writes absolute .bin links — trap inert, flow still exercised)
本地自动更新(bili update)在全真门禁里 100% 失败:旧安装永远替换不掉
这是啥问题
全真模型门禁(Lane X,本机 8299 sglang 真模型)里,代理自动从 0.1.213 更新到 0.1.214-gate.0 时下载成功、但落盘失败:
结果:npm 布局(真实 node_modules)安装的就地更新必然失败,每次
bili update都原地不动地报这个错。门禁 4 项 X 检查里挂 2 项。根本原因
src/update.ts的 #6309 原子交换改造(30fb96fb0)把「先备份旧安装」放在了原子交换之前:cp(installDir, backupDir)—— backup 目录变非空;rename(installDir, backupDir)要求目标目录不存在,非空必 ENOTEMPTY → 原子路径永远走不到;node_modules/.bin/*是相对符号链接(指向同目录树内部)→ libuv 的 self-copy 保护直接 EINVAL。门禁容器里逐步复现:第一次 cp 成功 → rename ENOTEMPTY → 第二次 cp EINVAL,与线上报错一字不差。
修复
文件备份只在回退(merge-copy)路径里、对着全新目录做;原子路径继续用被 rename 到一边的旧安装目录作为回滚源(行为不变)。改动集中在
src/update.ts的installViaTarball一个函数内。新增
tests/update-inplace-symlink-layout.test.ts两个钉子:46/46 既有 update 套件全绿。
验证