Skip to content

fix: tier conflict evidence - read-only viewers neutral, unconfirmed signals never escalate (#2545) - #2549

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-09_conflict-evidence-tiers
Oct 9, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-09_conflict-evidence-tiers

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #2545

Problem

The web UI merged two historical [suspected] ledger records naming the read-only plugin pi-context-inspector (written by pre-#1736 keyword rules, which matched bare "context") with a single unannounced-rewrite event into a strong red "检测到压缩冲突…请只保留一个压缩器" warning. The banner severity counted every non-plugin ledger kind as confirmed native evidence (nativeN = events - pluginN) and every non-sibling plugin record as a foreign compressor, so 1 rewrite + 2 suspected across 3 sessions escalated to a "two compressors on one conversation" verdict — cross-session aggregates read as same-session proof.

Fix — evidence tiers on every severity surface

Scanner (src/thirdparty-scan.ts)

  • pi-context-inspector added to KNOWN_DISPLAY_ONLY (verified read-only /context overlay: registers /context, reads context/tool info, no compression or history-rewrite API) → exempt in every spec form (bare name, npm spec with/without version, path segment) on all client lanes. New records can no longer occur; lookalike names sharing the prefix (my-pi-context-inspector-fork, pi-context-compressor) still flag.
  • New display-time classifier: parsePluginConflictDetail() + isDisplayOnlyConflictDetail() — stock ledger details written by older versions are neutralized WITHOUT destructive ledger purges (records stay visible in acp_status/stats; the manual clear endpoint is unchanged). isSiblingConflictDetail refactored onto the same parser (behavior unchanged).

Evidence tiers (src/conflict-watch.ts, src/web/client.ts)

  • confirmed = native-compaction landing or a non-suspected plugin finding → only these justify the imperative "keep exactly one compressor".
  • unconfirmed signals = unannounced-rewrite + orphan-reap — observed changes whose cause is NOT identified ("history changed, cause unknown"); never presented as native auto-compaction or a second compressor.
  • [suspected] keeps its [bug] pi-compact-transcript 被误判为压缩插件,Overview 将疑似记录显示为压缩冲突 #2324 verify-first tier (name-only match).
  • siblings + verified read-only plugins are neutral: a banner whose ledger names nothing else is hidden entirely (new neutralOnly).
  • Liveness follows the confirmed tier itself: additive summary fields displayOnly and activeConfirmed; a fresh unconfirmed signal cannot re-light a stale confirmed ledger as a live alarm (→ historical wording instead).
  • formatConflictSection ladder rebuilt around meaningful vs neutral events; the header double-compression claim is printed only when confirmed/native evidence exists.

Behavior changes (old → new)

  1. Web banner: unannounced-rewrite/orphan-reap no longer count as confirmed native evidence. Old: any non-plugin kind → hasConfirmed → strong red "请只保留一个压缩器"; new: soft info-styled "unconfirmed signal" tier. The issue's exact 3-event case: strong alarm → unconfirmed diagnosis.
  2. Banner styling now follows liveness of CONFIRMED events (activeConfirmed), not any active event; payloads without the field degrade to the previous behavior.
  3. Banner HIDDEN for ledgers naming only verified read-only plugins (old: shown as suspected warning). Display-time neutralization chosen over destructive ledger purging.
  4. acp_status COMPRESSION CONFLICTS: rewrite/orphan-reap-only ledgers no longer print "Keep exactly ONE compressor" (now UNCONFIRMED-signal wording); the header double-compression claim requires confirmed/native evidence (old: printed unconditionally); the sibling+signal corner loses the strong footer (the old ladder's foreignConfirmed included siblings — a web报警: billion-context-pi opencode-acp不属于第三方插件,同时安装并没有冲突 #2261 inconsistency); the pure-suspected-all-historical corner gets suspected wording + clear-ledger pointer (old: generic historical wording that asserted a plugin existed).
  5. Session evidence card hides display-only plugin records (siblings were already hidden per fix: card-wrap the shared summary service section on the web config page #2430).
  6. Stats payload: additive displayOnly, activeConfirmed fields.

Tests (targeted suites green locally; full regression via CI)

config surface: none (no new env/config keys; displayOnly/activeConfirmed are additive stats payload fields only).

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-09_conflict-evidence-tiers (a9eb0b0)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2730-pr.2549.86826df

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-pr2549.tgz
npm install -g package

Install instructions are refreshed on each push.

…k-unused-exports (#2545)

Review of #2549: isConfirmedConflictEvent (conflict-watch.ts) and
ParsedPluginConflictDetail (thirdparty-scan.ts) have no cross-module
consumers (tests exercise them through public behavior); the unused-exports
CI gate fails on them. Make them module-private per the gate's own fix.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review of #2549 (fixes #2545) — full diff read line-by-line, targeted suites run locally, issue scenario reproduced end-to-end through the real code paths. Verdict: mergeable after CI goes green on the new head (I pushed one small labeled fix, see below).

① 是什么问题
冲突台账把「证据强度」混为一谈:已验证的只读查看器(pi-context-inspector,pre-#1736 关键词规则按裸 "context" 误写的存量 [suspected] 记录)和未确认的运行时信号(unannounced-rewrite / orphan-reap —— 观测到历史被改但原因未定)与「已确认的第二压缩器」证据以同等严重度展示,产生红色「请只保留一个压缩器」误报,并指挥用户去移除根本不压缩的插件。

② 什么原因导致的
三个根因叠加:(a) bili_conflictSeverity 用 nativeN = events - pluginN 把所有非 plugin kind(含原因未定的 rewrite/reap)都算成已确认的原生证据;(b) 没有「中性层」——已验证只读插件的记录永远停留在 suspected 层当告警残留;(c) formatConflictSection 头部无条件断言 "Two compressors on one conversation",且 advice 梯子的 foreignConfirmed 包含 sibling(#2261 不一致:sibling+signal 会升级成强命令)。

③ 影响范围与严重程度
纯展示/严重度面(web 横幅、acp_status 段、session 证据卡)。不涉及 wire、压缩、持久化。受影响者:台账里只有未确认信号或只读插件记录的用户——看到假的「已确认双压缩」红警 + 移除指令。严重度:误导性 UX(假阳性),无数据损失;真实双压缩检测路径不变。

④ 怎么修复的
显示期证据分层(记录不动、不做破坏性清除,沿用 #2261/#2324 的「display-time classification」纪律,天然覆盖存量台账):NEUTRAL(sibling + KNOWN_DISPLAY_ONLY,新增 pi-context-inspector,全部 7 个扫描 lane 在关键词匹配前豁免,新记录不再产生)、CONFIRMED(检测到的原生 compaction 落点 + 非 suspected 插件发现)、UNCONFIRMED SIGNALS(rewrite/reap,措辞固定为「观察到变化,原因未确认」)。四个表面统一按层分级;liveness 跟 activeConfirmed(只统计窗口内 CONFIRMED 事件)走。CONFIGURATION.md en/zh 同步更新(顺带修正了关键词列表的过期描述——现 regex 本就不匹配裸 context,旧文档写的是 context*)。

⑤ 是否有回归问题
逐项过既有行为:suspected-only 软措辞(#2324)、sibling 静默(#2430/#2261)、原生落点解释(#2432)、age split(#2102)、per-client 修复尾注(#2219)全部保留并有测试钉住。旧 payload 降级路径验证过:kinds 自 #1206 起就在 payload 里(不存在无字段活体 payload);缺 activeConfirmed → 回退 c.active = 旧行为;缺 displayOnly → 旧的软层级行为。一处 PR 正文未逐字点名的角变化(属已披露的梯子重建的直接后果,按政策 4 显式报出):全 historical 的纯 native-only 台账,旧梯子先命中 active===0 分支给出「verify the other compression plugin is removed」措辞;现在无论年龄都走 #2432 的 host-side 解释分支——更符合 #2432 意图,判定为有意变更。另评估过:unconfirmed 层的 Fix 尾注仍是 #2219 通用文案(建议关客户端自动压缩),与新分层的「原因未定」立场略有张力,但上方新 advice 行已要求先核实,判定可接受、不扩大本 PR 范围。

⑥ 是否破坏缓存:不涉及——未触碰任何缓存/重试/增量游标/去重键。

⑦ 是否改了设计方向:无架构转向——在既有冲突台账设计上扩展显示期分类,数据流不变。

⑧ 是否引入了新的配置:无新 env/config/CLI。仅 GET /__bili/stats → conflicts 两个加性 JSON 字段:displayOnly、activeConfirmed(旧客户端忽略;旧 payload 降级已验证)。

审查过程与证据

  • 本地定向跑 6 套(issue1206-thirdparty-scan / web-conflict-banner / conflict-lifecycle / conflict-remediation / issue2432-breaker-awareness / web-i18n):89/89 绿,与 PR 声明一致;typecheck clean;tsup build OK。
  • 端到端复现 issue 原始场景(真实 Session → summarizeConflicts → 真实 WEB_CLIENT helper):displayOnly: 2、hasConfirmed: false、横幅渲染 conflict.on_unconfirmed/risk_unconfirmed(明确写「不能证明存在第二个压缩器…只读查看器无需移除」),acp_status 头部不再断言双压缩、advice 为 UNCONFIRMED 框架。✅ 正是 issue 要求的终态。
  • 测试有效性:断言有牙——issue 精确聚合被钉死、lookalike 名(my-pi-context-inspector-fork、pi-context-compressor)不被误豁免、降级路径有钉、旧断言只在该 bug 本身处修改。
  • Rebase 状态:落后 master 5 提交,但 merge-base 以来 master 侧对 PR 触碰文件零改动,无语义冲突风险。
  • review 中顺手修掉并已推送(commit a9eb0b0):CI unused-exports 门在 642c42b 上失败——isConfirmedConflictEvent(conflict-watch.ts)与 ParsedPluginConflictDetail(thirdparty-scan.ts)无任何跨模块消费者(测试经公共行为覆盖),按该门自身给出的修法去掉前导 export 变为模块私有。修后复验:gate exit 0 + typecheck clean + 89/89 + build OK。其余 CI job 在旧 head 全绿(windows test 22 分片当时仍在跑)。

结论:方向正确、根因对症(疏而非堵——在分类决策点修,不是掩盖症状)、披露完整。等 a9eb0b0 的 CI 全绿后可合并(合并由人执行:https://github.com/ranxianglei/billion-context/pull/2549)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 跟进:commit a9eb0b0(unused-exports 小修)的 CI 已全部跑完——24/24 check runs 全绿,零失败,包括此前失败的 unused-exports、完整测试分片(ubuntu/windows × 22/24)、build-artifact 与全部 e2e lane。

PR 现已具备合并条件(合并由人执行):#2549

@ranxianglei
ranxianglei merged commit 5246112 into master Oct 9, 2026
24 checks passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.193-master.5246112 (rolling master tag).

npm install -g billion-context@0.0.193-master.5246112  # 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.

[Bug] Web UI 将 pi-context-inspector 历史误报与 unannounced-rewrite 合并为已确认压缩冲突

1 participant