Skip to content

fix: stop labeling first-party siblings as third-party compressors in conflict alarms - #2262

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-06_sibling-conflict-label
Oct 6, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-06_sibling-conflict-label

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #2261

What / why

The web conflict banner and the acp_status COMPRESSION CONFLICTS section label every third-party-plugin ledger event as a third-party compression plugin and command "keep exactly one compressor". But two of the entries that can land in that kind are bili's own first-party siblings — billion-context-pi (pi) and opencode-acp (opencode) — which stand down automatically while bili drives the session (BILLION_CONTEXT_NATIVE marker in native mode, /bili/ baseUrl self-check in launcher/manual wiring; #820/#920). No second compressor is active, so the alarm both mislabels them and commands removal of something that is not a conflict.

Stock ledgers written by older versions (<v0.1.176 context-forge false positives, <v0.1.183 bcp records before #2045) persist across upgrades and keep triggering this wording on current builds — that is exactly what #2261 reports.

Fix (display-time classification)

  • src/thirdparty-scan.ts: new isSiblingConflictDetail(detail) reverse-maps a recorded detail (single-producer shape <client>: <entry> (<source>)[ [suspected]]) back to its plugin entry via the existing isLegacyBcpEntry + new shared isOpencodeAcpEntry. Classifying at display time (not record time) covers stock ledgers with no tag — no persistence migration.
  • src/conflict-watch.ts: ConflictSummary gains an additive sibling count; formatConflictSection gets a sibling-only footer branch (names them as bili's own, explains the stand-down, points at the clear path — no removal command). Mixed ledgers keep the existing strong footer untouched.
  • src/web/client.ts banner: composes per family now including a sibling clause; sibling-only stock gets its own risk sentence instead of "keep only one compressor".
  • src/web/i18n.ts: conflict.what_sibling / conflict.risk_sibling in zh-CN + en (parity-checked by tests/web-i18n.test.ts).

Behavior changes (old → new)

  1. Banner/acp_status wording for sibling-only ledgers: old "…发现与 bili 并存的第三方压缩插件…请只保留一个压缩器" → new sibling-specific sentence: first-party, stands down by design, nothing to remove, clear the record. Mixed ledgers (any real third party or native-compaction event present): unchanged strong wording.
  2. Scan tiering: an npm:-prefixed opencode-acp spec (e.g. npm:opencode-acp) was previously keyword-matched as [suspected] even in plugin mode; now classified known sibling and skipped by the existing design-benign rule when bili drives the session. Fewer false warnings; wire/plain-proxy behavior for it is unchanged (still recorded conservatively, as for all known siblings).
  3. GET /__bili/stats conflicts JSON: additive field sibling (count of plugin-kind events naming first-party siblings). Old clients ignore unknown fields.

No config/env surface added. No persistence format change (nothing new is recorded). No kernel change. No request-pipeline path touched (scan call site in server.ts unchanged).

Tests

New cases in tests/issue1206-thirdparty-scan.test.ts: predicate form matrices (incl. lookalike rejection), detail reverse-mapping (incl. Windows-style paths, npm:/versioned specs, [suspected] suffix), npm:-prefixed scan tiering, additive summary count, sibling-only vs mixed footers. Existing ledger/banner/i18n suites pass; local typecheck green. Full regression on CI.

… conflict alarms

#2261: billion-context-pi / opencode-acp are bili's own siblings and stand down while bili drives the session, yet every display surface called them 'third-party compression plugin' and commanded removal. Classify recorded details at display time (isSiblingConflictDetail), count them additively in ConflictSummary.sibling, and give them their own wording in the web banner and acp_status section.
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-06_sibling-conflict-label (63584ca)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2342-pr.2262.9f056c1

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

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2262.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

[bot] 🏷 收到。这是 #2261 的修复 PR(分支 2026-10-06_sibling-conflict-label),不重做——现在拉取分支做代码核对 + CI 状态检查,按七问体例给 review 结论。稍等。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 完成(拉分支核代码 + 调用点核对 + 定向测试 + CI)。结论七问:

1. 是什么问题:冲突告警(web banner / acp_status COMPRESSION CONFLICTS 段)把每一条 third-party-plugin ledger 事件都表述成"第三方压缩插件",并命令"只保留一个压缩器"。但能落进这个 kind 的条目里有两条是 bili 自家 first-party 兄弟(billion-context-pi / opencode-acp)——它们在 bili 接管时按设计自动 stand down(#820/#920),并不存在第二个压缩器。旧版本 ledger(<v0.1.176 context-forge 误报、<v0.1.183 bcp 记录)跨升级留存,导致当前版本上这套措辞持续误响(#2261)。

2. 什么原因导致的:分类发生在记录时——ledger 只存 kind=third-party-plugin + detail 文本,没有第一方/第三方的区分维度;展示层(server 端 footer、web banner)拿到 kind 就直接套"第三方"措辞。检测与记录本身是保守且正确的(宁可多记不可漏记),缺的是展示层的第二类判定;而存量 ledger 无 tag 可依赖,所以只能在展示时反查。

3. 怎么修复的:展示时分类(display-time classification)——新增 isSiblingConflictDetail(detail) 把记录的 detail(单一生产者 src/server.ts:2640,形状 <client>: <entry> (<source>)[ [suspected]],已核实全仓唯一)反映射回原 plugin entry,复用现有 isLegacyBcpEntry + 新增共享 isOpencodeAcpEntry(覆盖裸名/npm:前缀/版本后缀/路径形式,lookalike 如 my-opencode-acp-fork 被拒绝)。ConflictSummary 加 additive sibling 计数;footer 增加 sibling-only 分支(bili 自有、按设计 stand down、指向清除记录的路径,不下删除指令);web banner 按 family 组句,sibling-only 用专属 risk 句。附带收益:npm: 前缀的 opencode-acp spec 从 keyword [suspected] 升为 known,bili 驱动会话时被 design-benign 规则跳过,少一类误报。

4. 是否有回归问题:逐项过既有行为——

  • 检测/记录路径(server.ts scan 调用点、recordConflict):零改动;plain-proxy 保守记录行为保留。
  • 混合 ledger(含真第三方或 native-compaction 事件):强 footer("Keep exactly ONE compressor")逐字节不变。
  • 向后兼容:老 server 无 sibling 字段时 client 算出 siblingN=0,渲染与旧版完全一致(已核对)。
  • 高危模式:无语义漂移、无 fail-fast→吞错、无阈值/时序变化、无持久化格式变更(不新记任何字段)。
  • review 中发现一个小缺陷已顺手修掉(独立 commit 63584ca8c):src/web/client.ts 新增块缩进比周围深 8 格(template literal 内的纯空白,无 JS 语义影响),修后相关测试重跑 41/41 绿。
  • 补充披露(PR 正文 Behavior changes 未列):formatConflictSection 的共享 header 行也从 "(bili + a third-party compression plugin…)" 改为 "(bili + another compression plugin — third-party or bili's own sibling — …)",对包括混合在内的所有 ledger 头部措辞生效;纯展示文案,判定逻辑不受影响。

5. 是否破坏缓存:不涉及——请求管线、消息重建、prefix-cache 路径零触碰;stats JSON 仅 additive 字段,旧客户端忽略未知字段。

6. 是否改了设计方向:否。仍是单写者/单压缩器契约;native 模式与 standalone 扩展互斥机制(#820/#920/#991)不变,本 PR 只修正展示层措辞分类。

7. 是否引入了新的配置:无新 config/env。唯一对外可见面:GET /__bili/stats conflicts JSON 的 additive sibling 计数字段。

验证证据:本地定向测试(issue1206-thirdparty-scan + conflict-lifecycle + web-conflict-banner + web-i18n)45/45 通过(缩进修复后复跑确认);分支基于最新 master(0 behind,mergeable);CI 守护类 job(kernel-guard / version-guard / lane-guard / docs-sync / docs-coverage / build-artifact)已绿,全量测试矩阵与 e2e lanes 在新 head 63584ca8c 上运行中,有红我会跟进。

判定:可合(待全量 CI 转绿;合并请你操作):#2262

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 补充:head 63584ca8c 的全量 CI 已转绿——主 CI(四平台测试矩阵)+ 全部 e2e lanes(opencode/dsh/pi/codex/registry/canary)20/20 check runs、9/9 workflow 均 success。结论维持可合:#2262

@ranxianglei
ranxianglei merged commit 4cc055b into master Oct 6, 2026
21 checks passed
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.76-master.4cc055b (rolling master tag).

npm install -g billion-context@0.0.76-master.4cc055b  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web报警: billion-context-pi opencode-acp不属于第三方插件,同时安装并没有冲突

1 participant