Repository navigation
[PR] fix: pin opencode plugin entry to an exact version so boots resolve from local cache (#1108) — revival of PR #1143 - #1363
ranxianglei wants to merge 8 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1744-pr.1363.06cd7a5This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1363.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Received — reviewing PR |
[bot] 🏷 Review complete — verdict: correct, well-tested, ready for the release gate. No code changes needed; I fixed one stale doc spot directly on the branch (details below). Base is fresh (branch sits on current master ① Original issue direction (#1108)Verified against the issue thread: the root cause chain held up across multiple validation rounds there (deterministic repro) — a bare spec forces ② Regression sweep — existing behaviors on touched paths
No unintended regressions found. The two user-visible behavior changes (entry form; one extra dist-tag poll per cycle for opencode-managed copies) are both disclosed or disclosed-by-consequence and consistent with the Install-Lane & Update-Ownership contract (#1196/#991). ③ Code review
④ Test validity — real teeth, not tautologies
⑤ Diff cleanliness5 files, all on-topic; no lockfile churn, no whitespace noise; comments carry the #1108 rationale where non-obvious. Clean. Independent local verification (exact head
|
双写者竞争评估:opencode 写回 entry 会不会把 pin 覆盖回来(owner 提出的问题)结论:不会乒乓。三个机制锁死,分歧只可能是单次瞬态,收敛点永远是 registry latest。 写者画像
防覆盖三重锁(读码核过)
三场景推演
乒乓要求两个写者周期性写不同值:bili 目标值恒=registry latest,opencode 只在用户动作时写、写的也是 registry 上存在的版本 → 单收敛点,不可能循环。 遗留观察(非阻塞)
中文摘要:opencode 不是周期写者;bili 只在 registry 有更新版本时写、只写自家 entry 字符串、永不写副本本体;两写者目标值同为 registry latest,故最多单次瞬态分歧、自动收敛,不存在互相覆盖成环。 |
[bot] 🏷 结论一致:无乒乓。三重锁逐行核过,另有一处场景 B 的精度修正、一条对你遗留观察的建议、一个需要点名的外部前提。 三重锁复核(行级)
门的一个细节值得点明: 场景 B 精度修正:"停在 152"只在降级副本不含 re-pin 逻辑时成立用户经 opencode 显式装的旧版,分两种:
对遗留观察的建议:不加 "entry < current 也 re-pin"最坏分歧态(copy == latest、entry 被手工/外部改低)在现有门下也会自愈,推演:
收敛最多花 一次 boot + 一个 check cycle。你提的策略不改变不动点(latest),只会让手工分歧的配置每个周期多一次 config 写入(churn 增加、收益为零)。建议维持现有门不变。 一个本仓库无法验证的外部前提(点名)"opencode 不是周期性写者"依赖 opencode 侧行为:#1108 的证据覆盖了 boot 路径(只读 entry + 解析,pin 后走本地缓存),这是承重部分,可信。但显式 install/update 时 opencode 写回的 entry 形态在本仓库不可见——若它把 entry 规范成 bare,则每次用户驱动的 opencode 更新会触发一次 bili 修复写(bare→pin)。仍非循环(用户动作驱动、每轮 bili 最后落子、收敛到 latest),只是每次显式更新多一次修复写。不影响"无乒乓"结论,但作为假设记录在此。 发布门同意你的收尾声明:触碰 中文摘要: 同意"无乒乓"结论,三重锁已逐行核实(swap 只认自家 entry / 永不写副本本体 / isVersionNewer 门,且门比较的是运行副本自身版本);修正一处:用户显式降级到的版本若已含 re-pin 逻辑,会在一个 check cycle 内自动收敛回 latest(#1196 契约语义,降级=漂移而非持久 pin);"entry<current 也 re-pin"策略不必加——最坏分歧一次 boot+一个周期即自愈,加了只多 churn;唯一外部前提(opencode 显式更新时不把 entry 写回 bare)本仓库不可验证,但即使违反也只是每次用户动作多一次修复写,仍无循环;无需改码,按 no-op 验证发布 → 人工合并流程推进即可。 |
…rom local cache (#1108) A bare npm spec makes opencode's managed plugin service re-resolve @latest against the npm registry at every boot; on slow networks that pushes cold start past the health-check window and the supervisor respawn-loops. Write "billion-context@<self-version>" instead (bare-name fallback when the version is unknown), recognize both forms everywhere the entry is matched, and have the update lane report stale pins instead of the generic opencode-managed hint.
#1108) Install pins the installing bili's version (sync, offline — equals npm latest in the normal just-installed flow); `bili plugin update opencode` now resolves the newest registry version and re-pins the entry in place (only the entry string — the opencode-managed package copy stays opencode's, #991). Foreign entries preserved verbatim (#1002).
… check (#1108) The spawned proxy runs startAutoUpdate like any install; its checkForUpdate currently early-returns for host-managed copies without even looking at the registry, so a pinned entry would freeze the opencode lane forever. In the refusal branch (owner opencode) resolve the newest registry version and re-pin the config entry instead — opencode's own manager fetches that version at next boot, from local cache afterwards. The copy itself stays opencode's (#991); the hook lives entirely inside the refusal branch and never touches the check/download/extract/install path, and every failure is caught and logged.
…in self-update (#1108) The gate the maintainer asked for on PR #1143: publish old/new versions to the local verdaccio, then verify on the real chain that (a) plugin install writes the exact-version entry (and is idempotent), (b) an opencode-managed old copy's update check re-pins the entry instead of writing itself, and (c) the exact spec resolves from local cache with --offline, byte-identical to the registry tarball. Replaces the TODO(#1143) master-semantics assertions.
21ebe4a to
2a84854
Compare
|
(ai: zhipuai-lb/glm-5.3) 陈旧票清理(第三批动作①):目标 issue #1108 已关。为避免重复劳动关闭本 PR;如判断有误请直接 reopen 并留言。 |
What
Revival of PR #1143 (closed unmerged 2026-09-23 while on hold for the hermetic local-registry e2e harness, issue #1153). That harness has since landed via PR #1161 (merged 2026-09-25), which unblocks this change.
The four original commits were cherry-picked verbatim onto current master (
d3c8af84) with zero conflicts:fix: pin opencode plugin entry to an exact version so boots resolve from local cache (#1108)— the installer now writesbillion-context@<version>into opencode's config instead of the barebillion-context@latest; legacy bare entries migrate to a pin, stale pins to the current version, dev shims to a pin; foreign entries are preserved ([Bug] bili plugin install/remove opencode 会静默删除 plugins 数组里的对象形态条目({package, options} 一起丢) #1002).fix: update lane re-pins the opencode entry to the resolved npm latest (#1108)fix: opencode lane self-updates by re-pinning its entry on the update check (#1108)— src/update.ts: when a self-update lands, the opencode lane's entry is re-pinned to the new version so the next boot loads it.test: hermetic-registry e2e gate for the opencode pinned entry + re-pin self-update (#1108)— extends tests/e2e/e2e-registry.test.ts (the feat: hermetic local npm registry e2e infra — real self-update chain coverage (#1153) #1161 harness) to cover install→pin→boot-from-cache and self-update→re-pin end-to-end against the local verdaccio instance.Why (root cause, from #1108)
A bare
@latestspec forces opencode to resolve the dist-tag against the npm registry on every boot. Combined with opencode-side defects (fixed managed-service port inside the macOS ephemeral range + uncapped respawn supervisor), any transient registry hiccup turns into an unbounded restart loop. Pinning an exact version makes boots resolve from the already-installed local package; updates still flow because the update lane re-pins on each successful self-update check.Behavior change (disclosed)
billion-context@latest; every boot hits the npm registry dist-tag resolution; a stale/frozen copy could never see a newer version through opencode alone.billion-context@<v>; boots resolve locally; freshness comes from bili's own update lane re-pinning (checked every ~3 min while bili runs). A machine where bili never runs keeps its last pinned version until manually updated — same as every other host-managed lane by design (native模式下自动更新问题需要解决 #991).Pre-flight (this head, on master d3c8af8)
ACP_TEST_REGISTRY=1): 6/6 ✅Note: touches
src/update.ts— per AGENTS.md §5, shipping this release needs a no-op validation release first (existing upgrade path proven healthy) before the updater change goes out.Fixes #1108