Repository navigation
fix(update): bound dsh owner-channel refresh retries + surface frozen-profile state (#2148) - #2151
ranxianglei wants to merge 3 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2248-pr.2151.10a1b4dThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2151.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR #2151 review 完成 —— 方向正确、机制成立;review 中发现并直接修掉一个可见性生命周期缺陷(已推 additive commit 1. 是什么问题 2. 什么原因导致的 3. 怎么修复的 4. 是否有回归问题 —— 逐项审过 diff 触碰路径的既有行为:
5. 是否破坏缓存:不涉及(无缓存/重试游标/去重键;新 Map 是进程内簿记)。 6. 是否改了设计方向:没有。刻意不走 advisory.ts(那是 semver keyed 的强制安装契约,语义不符),用本地可见性状态表达「通道死了」这一实例级事实——与 #1577 advisory 面板行的先例同层。 7. 是否引入新配置:没有。全部常量为模块级(阈值 3 / base 5min / cap 6h),无 config/env/CLI surface。 测试有效性(质量关):8 个测试断言有牙——字节级日志串、spawn 计数( 自动合并门禁:不适用(feat commit + 多表面变更)→ 人工合并。 判定:CI 在 有意行为变更披露(旧→新):
|
874ad69 to
77191de
Compare
6abecdd to
6b4b3f5
Compare
Closes #2148
What
When the dsh host CLI itself is broken (issue repro: asar missing
@deepseek-ai/dsh-desktop-host/lib/cli.js), every 3-minute update cycle spawned a doomeddsh plugin --profile <name> add …forever: no backoff, no user-visible signal, and a "manual fix" hint telling users to run the very command that cannot run. The profile copy stayed frozen at its installed version indefinitely.Three fixes, one mechanism (the dsh owner-channel refresh path):
src/dsh-channel.ts): consecutive failures per (profile, targetVersion) back off after 3 — 5 min → 10 → 20 … capped at 6 h — mirroring the existing auto-update installs but never activates on long-lived plugin hosts; unwritable install dir retries every 3-min cycle for 11+ days #1603 install-failure backoff (same constants, same message discipline: sub-threshold failures keep the exact old log line; threshold hit logs once with remediation + "Backing off"; later cycles "Still failing"). In-memory state; resets on any success or when a different version is targeted; stale same-profile entries are pruned on record.formatDshError): when the spawn error shows the host CLI cannot start (MODULE_NOT_FOUND/Cannot find module/ ENOENT), the warn says the dsh host installation itself appears broken — repair/reinstall dsh or pointBILI_DSH_BINat a working executable — instead of suggesting re-running the same broken command. Generic failures keep the original wording byte-for-byte (pinned by the existing test).GET /__bili/statusandGET /__bili/overview: additivedshChannelarray field (empty when healthy);/acppanel (plugin preFooter +acp_statusreport): one warning line listingprofile→version (N×);#dsh-channel-banner, en+zh i18n keys).All silent when healthy.
Behavior changes (old → new)
dsh plugin …from a shell wheredshresolves"/__bili/status+/__bili/overviewpayloaddshChannelfield (empty array when healthy)/acppanel, web UIconflictsNo config surface added (constants hardcoded, exactly like #1603). No kernel change. No proxy↔client wire change — only bili's own status/panel/banner surfaces gain lines.
Design note — deviation from suggested direction ②
The issue proposed reusing the advisory mechanism (
src/advisory.ts, #1588). That mechanism is built for published, version-keyed force-install advisories (companion npm packagebillion-context-advisories): it answers "version X has a known defect, move to Y". A machine-local "my dsh channel is broken" state has no semver range to key on and must not trigger force-install semantics, so it does not fit that contract. Used local surfaces instead (status field + panel + banner), which also carry richer live state (attempt counts, last error).Scope note: the
desktopprofile lane stopped using the dsh CLI entirely since #1575/v0.1.180 (in-place verified-tarball install), so copies running ≥0.1.180 self-heal without a working CLI. Copies frozen below that (like the 0.1.179 repro) cannot reach this fix themselves — repairing/reinstalling the dsh host is still required for them; this PR bounds the retry storm and makes the frozen state visible on every lane meanwhile.Tests
New
tests/issue2148-dsh-channel-backoff.test.ts(9 tests): backoff curve shape; spawn-count + log-text pins across the threshold/cooldown/resume cycle; success-reset; cross-version prune;dshHostCliBrokendetection; broken-host vs generic vs ENOENT warn wording;/acppanel line (incl. ordering before the footer box);acp_statusreport line. Existingtests/dsh-refresh.test.tsfirst-failure pin stays green unchanged. Targeted suites green locally (issue2148 / dsh-refresh / advisory-panel / acp-status / update-backoff / web-i18n / web-conflict-banner = 51 pass); typecheck clean; build OK; full regression via CI.Post-open supplement: #2181 (labeled in-passing fix, own issue)
CI triage after opening found all 4 test lanes red on a test that is NOT from this PR —
tests/advisory-endpoint-parity.test.ts(#2153) fails with500 !== 200on/__bili/overviewin every fresh-runner lane, and master is red identically (4af31e0, same 4 lanes, same test). Root cause (issue #2181):refreshIndex()re-threw the deliberate top-level ENOENT ofwalkSessionFiles()when the sessions dir had never been created (fresh install / fresh CI runner — the dir only comes into existence at first persist), so/__bili/overview+/__bili/sessionsanswered 500 until the first session was persisted. Defect dates to e0ef92a (#1939 summary-index rewrite); #2153's parity test was the first to hit that endpoint on a fresh environment.Fix commit
fix(web): first contact with a missing sessions dir is no data, not a 500 (#2181)(separate labeled commit per the minor-fix rule):sessions: 0, HTTP 200). WHY: a fresh install with no persisted sessions is a normal state, not an error; the 500 broke the dashboard pre-first-session and made every fresh-environment CI run red.tests/issue2181-web-missing-sessions-dir.test.ts+ fullweb-sessions/session-gcsuites green; the [web] advisory banner 是死代码:/__bili/overview 不含 advisory 字段,web 客户端从不调用 /__bili/status #2152 parity test now passes under a clean HOME (the exact CI scenario); typecheck clean.