Repository navigation
fix: align opencode plugin-channel messaging with the accepted #1234 in-place self-update - #2208
Conversation
…in-place self-update The opencode v2 cache copy (~/.cache/opencode/npm/...) is bili-owned in place and self-updates through its own proxy (#1234), but hostManagedInstall only recognized the data-home tree (~/.local/share/opencode), so the in-place exception relied on the cache path accidentally missing every host home. The plugin list/update channel text still said "opencode owns the copy / never overwrites", contradicting the accepted behavior and confusing disk vs running state. - recognize the opencode CACHE home explicitly (XDG_CACHE_HOME + realpath) and return bili-owned (self-update allowed); data-home stays host-managed (#1234) - rewrite UPDATE_CHANNEL[opencode] + `plugin update opencode` to describe self-update-in-place + v2 manual channel + reload-to-activate; drop "never overwrites" - surface the actual cache load path + disk version in doctor / `plugin update` (new read-only opencodeCacheCopyRoot); global-check success no longer reads as opencode-copy activation - document the outer-lockfile vs inner-package accounting boundary - regression tests: cache vs data-home vs global policy, wording consistency, cache-root resolver Closes #2199
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2275-pr.2208.e02d166This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2208.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成:方向正确、实现扎实、无回归发现;发现一个测试缺口已直接在 PR 分支修掉(commit 结构化七问1. 是什么问题:OpenCode 的 2. 什么原因导致的(已在代码中逐层核实,非凭描述开工):
3. 怎么修复的(机制层面):把隐式例外显式化——新增 4. 是否有回归问题:无。既有行为清点(逐项读过改动前代码,非只读 diff):
5. 是否破坏缓存:不涉及——代理缓存、会话持久化、重试、去重键逻辑零触碰(本 PR 只动安装通道分类与诊断展示)。 6. 是否改了设计方向:没有。#1234 的方向(cache 副本 bili-owned in place)从"碰巧成立"变为"显式成立 + 回归测试钉死";单写者契约(#991/#1196)完整保留——data-home 树仍是 host-managed,两处单写者注释现在明确区分 cache/data 两棵树。 7. 是否引入了新的配置:没有。 顺手修掉的测试缺口(小问题直接修,未另立项)发现:本 PR 最大的行为变化——doctor opencode lane 的新 stale 判定 + 加载路径展示——没有任何测试钉住(doctor.test.ts 只覆盖 broken-probe 与空沙箱 absent;update-host-guard/plugin-update 钉的是分类与文案,不钉 doctor 接线)。若日后有人弄断 npm 分支的 targets/copyVersion 接线,CI 全绿而 doctor 悄悄退回谎报 ok。 处置:直接在 PR 分支补 commit 流程标记(给 owner 的一个判断点)§5 规定改 |
[bot] 🏷 CI 补报(新提交 406ae9b) 新提交首跑 18/19 绿,唯一红:
结论不变:可合并(§7.4:触碰 src/update.ts,人工合并;§5 no-op release 问题仍待 owner 拍板,我的评估见上条回复)。 |
[bot] 🏷 补记:上条所述 hermes 测试 60s 超时预算的结构性脆弱(负载下会复发)已单独立项 → https://github.com/ranxianglei/billion-context/issues/2216(带来源标记)。本 PR 侧无遗留动作。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.64-master.f704b43 # this exact build
npm install -g billion-context@master # always the newest merged build
|
What & why
Fixes #2199 — the OpenCode
plugin list/plugin updatechannel messaging contradicted the accepted #1234 decision (the v2 cache copy is bili-owned in place and self-updates through its own proxy), and disk vs running state were conflated.Root cause was two-fold:
hostManagedInstall()only recognized the opencode data-home tree (~/.local/share/opencode). The actual load path lives under XDG_CACHE_HOME (~/.cache/opencode/npm/billion-context@<spec>/<ts>/node_modules/billion-context), so the in-place exception depended on the cache path accidentally missing every host home — fragile and invisible from the code.Changes
src/update.ts— newisOpencodeCacheBiliCopy()recognizes the opencode cache home explicitly (XDG_CACHE_HOME+ realpath,…/node_modules/billion-context) and returns bili-owned (self-update allowed); the data-home tree stays host-managed. The guard sits before the homes loop with a comment forbidding folding the cache path intohomes(that would re-close Investigate: does the opencode lane auto-update, or is it an #1196-class silent freeze? #1234). Behavior-preserving: the cache path already fell through toundefined; this makes it explicit and regression-proof.src/plugin-install.ts— rewroteUPDATE_CHANNEL[opencode]and thepluginUpdateopencode lane to say: the cache copy self-updates in place via its own proxy (Investigate: does the opencode lane auto-update, or is it an #1196-class silent freeze? #1234); OpenCode v2plugin updateis only an extra manual channel; reload/restart after a disk update to activate. Dropped "never overwrites". Added read-onlyopencodeCacheCopyRoot()(newest spec slot / newest timestamp) so doctor andplugin updatereport the actual load path + disk version instead of "version not resolvable". Updated the two single-writer comments to state the cache/data distinction.src/doctor.ts— the opencode lane now shows the resolved cache copy path + disk version (enabling an honest stale verdict) plus the reload hint.tests/update-host-guard.test.ts: cache layout (default + customXDG_CACHE_HOME) → bili-owned, data-home → host-managed, global standalone unaffected.tests/plugin-update.test.ts: wording consistency (no "never overwrites"; has Investigate: does the opencode lane auto-update, or is it an #1196-class silent freeze? #1234/reload hint),opencodeCacheCopyRootresolver (newest-wins, absent→undefined, non-bili slot ignored), and theplugin update opencodereport end-to-end (surfaces the disk version, drops "never overwrites").Behavior changes (flagged per policy)
bili doctoropencode lane: previously alwaysok+ "copy managed by opencode's plugin manager (version not resolvable here)". Now, when a cache copy exists and the npm registry leads its on-disk version, the lane reportsstale (vX → vY)and shows the actual load path + disk version. Intended honesty (part 3 of [OpenCode] plugin list/update 渠道提示与已接受的自更新行为不一致,磁盘与运行版本混淆 #2199), not a regression —okwhen the cache copy is current is unchanged.plugin list/plugin update opencodetext: reworded as above. No status-detection or install-write-path change (opencodeStatus,pluginInstalluntouched) — repeatedbili plugin install opencodestill only installs/repairs config.XDG_CACHE_HOMEis standard path resolution (same discipline as the existingXDG_DATA_HOMEread), not a new knob.Verified (local, targeted)
npm run typecheckclean ·npm run buildclean · targeted suites green:update-host-guard(14),plugin-update(7),doctor(12),plugin-install-opencode+issue927-opencode-install+plugin-agent(86). Full regression left to CI.Closes #2199