Skip to content

[PR] feat: install any published version, pin for a duration, tag-following auto-upgrade - #6806

Open
ranxianglei wants to merge 7 commits into
masterfrom
2026-11-15_update-ux-pin-version
Open

ranxianglei wants to merge 7 commits into
masterfrom
2026-11-15_update-ux-pin-version

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

Implements the 4 features requested in #6804:

  1. bili update <version> installs any published version (release or prerelease/temp build like 0.1.215-pr.202.1); the web panel Updates tab gains a free-text version field (the existing dropdown stays).
  2. Auto-upgrade follows the tag channel only: an installed prerelease/temp build on the release channel (tag="latest") is never auto-swept forward to a release — the check runs, the new version is reported, nothing is installed. A prerelease channel target (e.g. updateTag=dev) still moves between temp builds.
  3. bili pin [duration] pins the installed version for a duration (1h/12h/1d/7d/forever; default = indefinite); the pin lifts itself at expiry and auto-upgrade resumes; bili unpin lifts it early. The web panel gets the same pin control (duration picker).
  4. Any pinned version is check-only: the updater keeps discovering new versions and reports them (panel state, log line, bili update output) but never auto-installs. An explicit bili update still breaks through the pin (explicit action = user intent).

Implementation notes

NO-OP validation release note

src/update.ts is human-review tier. This PR changes the auto-update decision path (two new gates inserted before the #3619 policy gate). A NO-OP validation release is recommended before merging to prove the existing upgrade path is healthy end-to-end.

Closes #6804

…g auto-upgrade (#6804)

- bili update <version> installs any published version (release or prerelease)
- bili pin [duration] pins the installed version (1h/12h/1d/7d/forever)
- bili unpin lifts the pin early
- Auto-upgrade follows the tag channel only: a prerelease/temp build on the
  release channel (tag "latest") is never auto-swept forward to a release
- Any pinned version is check-only: the updater reports new versions but
  never auto-installs; explicit bili update breaks through the pin
- Web panel Updates tab gains a free-text version field and pin controls
  (duration picker + pin/unpin buttons)
- Pin state is machine-level runtime state at ~/.cache/billion-context/.pin.json
  (no new config key — Configuration Surface Discipline)
- The #1481 advisory force-install lane still overrides a local pin

Closes #6804
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

duplicate of #6805 —— 两个 PR 实现的是同一个 #6804 的同一套设计(任意版本安装 + 按时长 pin + tag 通道自动升级,同款 ~/.cache/billion-context/.pin.json 机器级状态)。#6805 先开(08:41 vs 09:05)且可合并,本 PR 后开且现与 master 冲突。按先来后到保留 #6805;已打 duplicate 标签,关闭由 owner 决定。

@ranxianglei ranxianglei added the duplicate This issue or pull request already exists label Nov 15, 2026
ci-check added 5 commits November 15, 2026 17:34
…th per call

Review fixes for #6806 (additive, labeled):
- writePin now returns whether the state file was actually written;
  setPin returns undefined on failure so callers (CLI pin, web pinAction)
  stop reporting a pin that was never persisted (honest output, §7.3).
- PIN_FILE resolved per call via pinFile() (paths.ts reads env live;
  hermetic suites swap XDG_CACHE_HOME per scenario — same pattern as
  update-policy.ts's stagger/policy files).
- unpinAction returns hadPin (the old code had two identical branches
  that discarded the distinction its doc comment promised).
- tests/update-pin.test.ts: isolate XDG_CACHE_HOME/XDG_CONFIG_HOME in a
  scratch dir BEFORE importing update-pin.js (the old file wrote the
  REAL ~/.cache/billion-context/.pin.json); assert the new return
  shapes (setPin truthiness, unpinAction.hadPin).
Review fixes for #6806 (additive, labeled):
- upPin() read the RUNNING version from the DOM (up-running), but the
  gate compares isVersionPinned(diskVersion ?? runningVersion): in the
  pending-restart state (disk > running, can last days on dsh/opencode
  hosts) the pin silently never fired. The client now caches the last
  /update/state snapshot and pins disk ?? running, matching the gate.
- Indefinite pin status rendered via a dedicated up.pin_indefinite key
  (en 'indefinite' / zh '永久 indefinite') instead of
  t('up.pin_none').replace('No pin','indefinite') — the zh source string
  is '未固定 no pin' (lowercase), so the case-sensitive replace missed
  and the panel showed '已固定 X  no pin'.
- unpin toast distinguishes 'pin lifted' from 'no pin was active'
  using the new hadPin field.
…ly gates

The two new checkForUpdate gates (src/update.ts, human-review tier)
shipped with no regression coverage. Section I in the hermetic
update-policy harness (real install into a temp dir, mocked registry):

- I1: prerelease on the release channel (tag=latest) is never
  auto-swept to a release — no tarball download; check-only still
  reports update-available with the prerelease note.
- I2: control — a release on the release channel still auto-upgrades
  (the gate must not over-suppress; #3617 negative direction).
- I3: a prerelease on a prerelease channel (updateTag=dev) still moves
  between temp builds (mockRegistry gains a devVersion dist-tag doc).
- I4: a pinned version is check-only — auto stays put, check-only
  reports update-available with the pinned note.
- I5: an explicit force breaks through BOTH gates.
- I6: an expired pin lifts itself — auto-upgrade resumes.
…pages

Review fixes for #6806 (additive, labeled):
- reference/architecture.md: the new src/update-pin.ts was missing from
  the file map — the architecture-docs CI lane (check #1: every tracked
  src/ file listed) would have gone red.
- docs/architecture/update.{md,zh-CN.md,ja.md}: add src/update-pin.ts
  to the key-entries line and a short 'Version gates (#6804)' paragraph
  describing the tag-channel rule and the check-only pin.
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-15_update-ux-pin-version (516d89c)

Latest build — install this exact version

npm install -g billion-context@0.0.10175-pr.6806.9f167ff

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
516d89c billion-context@0.0.10175-pr.6806.9f167ff build
ba0f68b billion-context@0.0.10153-pr.6806.3b2fbe9 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6806.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: #6805 与 #6806 重复(同一 #6804,两个在途 PR)。 两个 PR 都 open、都 base master、都 Closes #6804、都实现同一组 4 个功能,但代码是两套独立实现(分支 2026-11-15_update-pin-version-select vs 2026-11-15_update-ux-pin-version;#6805 额外动 src/paths.ts + src/persist.ts,#6806 不动)。#6805 先开(08:41 UTC,#6806 09:05 UTC)。按先来后到,建议保留 #6805、关闭 #6806——但关闭权在你,我两个都没关。本线程我被指派审的是 #6806,以下审查与修复都落在 #6806 分支上;若你最终保留 #6805,这些修复点(尤其门控回归测试与 web pin 版本源)同样适用于 #6805,需要的话我可以平移过去。

Review + fixes (pushed to the PR branch, 9e4f569287..ba0f68b0c9, 4 labeled commits + 1 merge):

The direction of all 4 features checks out: gate placement is correct (after reportNotNewer + the advisory block, before the #3619 policy gate), forceInstallVersion's safety chain (registry existence, #580 source-checkout, #991 host-managed, lock, integrity) is reused correctly, no config-surface change (pin = runtime state at ~/.cache/billion-context/.pin.json), no version bump. What I found and fixed:

  1. Blocker — merge conflict with master. The branch was 86 commits behind; master's named-config feature ([PR] Gate tool added to repo: full real-model gate container + config-driven launcher | gate 工具进仓库:完整真模型 gate 容器 + 配置驱动启动器 #6798) collides in src/cli.ts. Merged origin/master in, resolved as the union of both (PR's updateVersion/pinDuration destructuring + master's -c/--config fail-fast block). The PR could not merge without this.
  2. src/update-pin.ts: pin path resolved per call + honest persistence failures. PIN_FILE was pinned at module load; it's now pinFile() per call (same pattern as update-policy.ts's stagger/policy files, paths.ts reads env live). writePin now reports write failure and setPin returns undefined on it — previously bili pin / the web panel reported "Pinned" with exit 0 even when the cache dir was unwritable and nothing was persisted. pinAction returns ok:false in that case; the CLI path already exits 1.
  3. Web pin targeted the wrong version. upPin() read the running version from the DOM, but the gate compares isVersionPinned(diskVersion ?? runningVersion) — in the pending-restart state (disk > running, can last days on dsh/opencode hosts) the pin silently never fired. The client now caches the last /update/state snapshot and pins disk ?? running.
  4. zh i18n rendering bug. Indefinite pin status was t("up.pin_none").replace("No pin","indefinite") — the zh source is 未固定 no pin (lowercase), so the case-sensitive replace missed and the panel rendered 已固定 X no pin. Now a dedicated up.pin_indefinite key (en indefinite / zh 永久 indefinite). Also: unpinAction had two identical branches discarding the hadPin distinction its doc comment promised — now returned, and the unpin toast uses it.
  5. Test isolation flaw. tests/update-pin.test.ts wrote the real ~/.cache/billion-context/.pin.json (no XDG_CACHE_HOME). Rewritten: scratch dirs set before the dynamic import, return-shape assertions, scratch cleanup.
  6. Zero regression coverage for the two new checkForUpdate gates (the human-review-tier src/update.ts decision-path change). Added section I to the hermetic tests/update-policy.test.ts harness (real install into a temp dir, mocked registry): prerelease-on-latest is never auto-swept (no tarball download; check-only still reports with the prerelease note) · control: release-on-latest still auto-upgrades (no over-suppression, Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 negative direction) · prerelease on updateTag=dev still moves between temp builds · pinned version is check-only (auto stays put, check-only reports with the pinned note) · explicit force breaks through both gates · expired pin lifts itself and auto-upgrade resumes.
  7. Docs. src/update-pin.ts was missing from the reference/architecture.md file map — the architecture-docs CI lane (every tracked src/ file must be listed) would have gone red. Added it, plus the key-entries line + a short "Version gates (Update UX: install any published version, pin for a duration, tag-following auto-upgrade | 更新界面人性化:可安装任意已发布版本(含 master 临时版)+ 按时长固定版本(pin);自动升级只跟 tag 走,固定/临时版本只检测不升级 #6804)" paragraph in docs/architecture/update.{md,zh-CN.md,ja.md}.

Note (no code change): the version-arg form bili update <v> bypasses the remote policy (blocked/pinned) — forceInstallVersion never consults it. That is consistent with the existing web-panel install path (installVersionAction, #3719/#4791), and the advisory force-install lane remains the safety net; the no-arg form still respects blocked/pinned. So the PR body's "still respects remote blocked/pinned" is only true for the no-arg form — worth a one-line body edit.

Verification (local, targeted — full suite is CI's job): npm run typecheck clean · tests/update-pin.test.ts 18/18 · tests/update-policy.test.ts 59/59 (incl. the 6 new gate scenarios) · web-i18n + web-updates 21/21 · all other WEB_CLIENT consumer suites 122/122 · node tools/check-architecture-docs.mjs all green (map covers all 324 src files). CI is running on the new head ba0f68b0c9 (26 checks, in progress as of this reply).

八问

  1. 是什么问题:功能 PR(Update UX: install any published version, pin for a duration, tag-following auto-upgrade | 更新界面人性化:可安装任意已发布版本(含 master 临时版)+ 按时长固定版本(pin);自动升级只跟 tag 走,固定/临时版本只检测不升级 #6804 的 4 个更新 UX 功能);审查发现 1 个阻塞项(与 master 冲突,无法合并)、1 个必红项(架构文档 map 漏新文件)、2 个功能缺陷(web pin 用错版本源导致 pin 静默失效;zh i18n 渲染错)、测试隔离缺陷(污染真实用户 ~/.cache)、两个新决策门零回归测试。
  2. 什么原因导致的:分支落后 master 86 个提交(cli.ts 冲突);pin 文件路径在模块加载时固化;web 端从 DOM 读 running 版本而门控比较的是 disk 版本;zh 文案依赖大小写敏感的 replace;新文件未登记进架构 map;门控改动没有配套回归测试。
  3. 影响范围与严重程度:合并前 PR 不可合并(阻塞);合并后 web pin 在 pending-restart 状态(可持续数天)下静默失效 = p2(功能可用但有明显问题);zh 面板显示瑕疵 = p3;测试隔离缺陷仅在开发机跑测试时污染真实缓存 = p3;CI 架构文档车道必红 = 阻塞。
  4. 怎么修复的:merge master 取并集解冲突;pin 路径按调用解析 + 持久化失败诚实上报(web/CLI 不再谎报 Pinned);web 端以 disk ?? running 为 pin 目标 + 专用 i18n key;测试隔离重写 + 6 个 e2e 门控场景(含 release 仍自动升级的负向对照);补架构 map 与三语模块文档。
  5. 是否有回归问题:既有自动升级路径未变——两个新门只在 !force 且(prerelease-on-latest / 已 pin)时生效;I2 对照测试钉住 release→release 照常自动升级;advisory 强制安装车道按设计绕过 pin;显式 bili update 按设计击穿 pin;无参 update 仍尊重 remote blocked/pinned。
  6. 是否破坏缓存:不涉及 prompt cache/压缩缓存;pin 状态是独立新文件 .pin.json,不影响既有 throttle/stagger/policy 文件。
  7. 是否改了设计方向:没有。pin 是机器级运行时状态而非配置项(符合 Configuration Surface Discipline);与 Automatic staggered rollout: default random upgrade interval of 15 min – 48 h + GitHub remote policy file (emergency kil | 自动升级撒点:默认 15 分钟~48 小时随机升级 + GitHub 远程策略文件(紧急刹车/按版本调速),给事故留响应窗 #3619 remote policy pinned(fleet 级升级上限)语义区分明确。
  8. 是否引入了新的配置:无新 config key / env var。新增 bili pin/bili unpin 命令与状态文件 ~/.cache/billion-context/.pin.json({v:1, version, setAt, until?}),非配置面。

收工判定:代码侧已收敛——合并冲突已解、必红项已修、功能缺陷与测试缺口已补,CI 在新 head 上运行中。两件事等你:① #6805/#6806 二选一(建议留 #6805,若留 #6806 则本分支已就绪);② 本 PR 改 src/update.ts(human-review tier),按 §5 合并前建议先跑一次 NO-OP 验证发布证明现有升级路径健康——发版由你拍板,我不自行切 release。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

Conflict lane run 1/6 — done. Merged origin/master (3e42aae8bf, PR #6810 gate-concurrent work) into 2026-11-15_update-ux-pin-version; pushed ba0f68b0c9..516d89c167 (plain push, no force — re-fetched before push, remote head unchanged, no concurrent writers).

七问

  1. What was wrong? The PR was flagged merge-state dirty against its base — the branch had gone stale behind master (master advanced 6 commits, all from [PR] Gate performance overhaul: P/R lanes parallelized, wall clock 45 min → ~18 min | gate 性能改造:P/R 车道并行,墙钟 45min→~18min #6810: scripts/gate/entrypoint.sh, plugin-lanes.mjs, restart-lanes.mjs, bili-gate.sh + both gate READMEs).
  2. What did I do? One --no-ff merge of origin/master into the PR branch, then a plain push. No rebase, no force-push, no other edits — the conflict lane touches nothing else.
  3. How were conflicts resolved? There were none: zero textual conflicts. The master-side file set (scripts/gate/*) and the PR-side file set (src/cli.ts, src/update.ts, src/update-pin.ts, src/server/*, src/web/*, tests/*, docs/*) are fully disjoint, so the merge is purely additive. Verified pre-merge with a git merge-tree probe (0 conflict markers) and the ort merge confirmed it.
  4. Regression risk? None from the merge itself: no src/** or tests/** file was modified by the merge (tsconfig covers exactly those two globs; the 6 merged files are outside it), so the PR's behavior and its typecheck surface are byte-identical to the previously verified head ba0f68b. I could not re-run a local typecheck (this worktree has no node_modules); the structural argument above plus CI on the new head covers it.
  5. Live verification after push? Single fetch of the PR record: mergeable: true, mergeable_state: blocked — i.e. no more conflict; "blocked" is only the branch-protection/review gate (expected: src/update.ts is human-review tier), not a merge conflict. The mirror check cache was still stale in this run (last fetch 10:19 UTC, old head), so I verified against the live PR record instead.
  6. CI status? On the old head: 0 failed / 4 pending of 30 (mirror cache). A fresh suite is now running on 516d89c167; I'll report in-thread if anything goes red.
  7. What's left (owner items, unchanged from the review run)? ① [PR] Update UX: exact-version install + time-bound pin; auto-upgrade follows the tag channel (#6804) | 更新界面:可装任意已发布版本 + 按时长固定版本,自动升级只跟 tag 通道(#6804) #6805 vs [PR] feat: install any published version, pin for a duration, tag-following auto-upgrade #6806 duplicates — earlier recommendation stands: keep [PR] Update UX: exact-version install + time-bound pin; auto-upgrade follows the tag channel (#6804) | 更新界面:可装任意已发布版本 + 按时长固定版本,自动升级只跟 tag 通道(#6804) #6805 (opened first), close [PR] feat: install any published version, pin for a duration, tag-following auto-upgrade #6806; this branch is ready if you keep [PR] feat: install any published version, pin for a duration, tag-following auto-upgrade #6806 instead. ② src/update.ts is human-review tier — a NO-OP validation release is recommended before merge; cutting it is your call per §5.

Status: conflict resolved, PR mergeable; awaiting owner decision + CI green on 516d89c167.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists enhancement New feature or request p2 scope/wiring

Projects

None yet

1 participant