Repository navigation
fix(#1803): converge stale dsh profile copies from the periodic update check - #1804
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1781-pr.1804.4df4d86This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1804.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR review 完成(PR #1804,fixes #1803)。核对了分支代码、跑了本地 pre-flight、查了 CI;发现一个小问题已直接在 PR 分支修掉(见第 4 问),新 head 验证过程
结构化七问
测试有效性: 发布顺序(§5):此 PR 动 结论:方向正确(补的是缺失机制而非打补丁)、测试钉住行为、本地 pre-flight 与旧 head CI 全绿;新 head |
…skip-aware) The new in-step skip in refreshDshProfileBundles made the 'refreshing N profile bundle(s)' summary over-count when some profiles were already at the target. Return the refreshed count and print N/M so the CLI output stays honest in the degenerate all-in-step state.
d507f42 to
da65538
Compare
Runs only when a release is published (or via workflow_dispatch). Packs the released tree twice with identical content at N-1/N into a local verdaccio, boots a live proxy on N-1, and drives the full receive path: - pre-update dsh profile convergence (#1803/#1804 path, fake dsh bin) - in-place flip to N: 'installed N-1 → N. Restart to finish.' - case-3 refresh + post-flip convergence of a profile seeded stale after the flip, then silence (no redundant dsh plugin spawns) - live proxy keeps serving during the swap window - restart at N: ACP smoke — model turn, plugin compress fold, post-fold - 'plugin install opencode' entry survives the update registry-fixture: pass NPM_ALLOW_DANGEROUS through to npm so guarded dev machines can publish to the loopback fixture (CI is unaffected).
Fixes #1803
Root cause
dsh's CLI reads the bili bundle yml from the global install but resolves the entry module from each profile's own
node_modules(#1590 mixed resolution). When a profile copy is left behind the global version, the bare-name entry resolves to the old package's CLI root — a module with zero exports — and the whole dsh boot crashes (invalid plugin, expect function or object with an "apply" method, received object).Three ways to get into that state, all converging on one missing mechanism:
npm i -g— never triggers any profile refresh (the post-install hook only runs on a self-update event).dshnot resolvable on PATH — profile copy stays frozen (#1196 contract) #1732/refreshDshProfileCopy 依赖 PATH 里的 dsh 命令:PATH 缺失时 host-channel 刷新失败,profile bundle 暂时滞留旧版本 #1730): the refresh is best-effort, warns, and never retries (it only fires once per install event).The crash also blocks the #1196 self-heal: the profile copy's own proxy never starts, so nothing inside dsh can fix it.
Fix (this PR, the missing half)
checkForUpdate's up-to-date branch now calls the newconvergeDshProfileBundles(installDir, diskVersion):DSH_HOME/profilesfor registry-pinned copies whose installed version < the global disk version (dev pinslink:/file:are left alone — manual by design);refreshDshProfileBundles(globalVersion)— dsh's own plugin channel, single-writer safe;refreshDshProfileBundlesadditionally skips profiles already at the target version, so a permanently-stale sibling (PATH-broken box) can't cause in-step profiles to re-spawndsh plugin addevery cycle. Declared-but-missing mounts still install (#1196: every declared copy has a live path).UpdateOptions.installDirmirrorsrunAdvisoryCheck's seam so the up-to-date path is testable in-process. No config-surface change (internal option only; noBILI_*, no config.json field).The Windows dsh-binary resolution half is already on master via #1734 (
resolveDshBinaryprobes%APPDATA%\npm, pnpm dirs, node dir, …). This PR makes the trigger live so those resolutions actually get driven.Tests
tests/update-dsh-converge.test.ts(5 cases): stale-copy + declared-missing refresh with dev-pin/in-step untouched; silent in-step world; undefined-args no-op; and the fullcheckForUpdateintegration (registry stub,installDirseam) proving the up-to-date branch converges — the #1803 regression path. Pre-flight: typecheck ✓, full suite 379 files / 3365 tests / 0 fail ✓, build ✓.Live verification (real artifact)
npm install -g . --install-links(repo = 0.1.176 == npm latest), fixtureDSH_HOMEwithweb@0.1.175,BILI_DSH_BINrecorder,bili start:Release note (§5)
This touches
src/update.tscheck logic, so per AGENTS.md §5 it must ship behind a no-op release first — ship the next routine patch bump, confirm a real auto-update goes through, then release this. Until then affected users can manually rundsh plugin add billion-context@0.1.176in each profile (or reinstall the profile bundle).