Repository navigation
feat: detect co-resident third-party compression plugins and warn (#1206) - #1212
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1212Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1212.tgz
npm install -g packageInstall instructions are refreshed on each push. |
6ba09bd to
f98941c
Compare
[bot] 🏷 Review complete — verified against current master, can merge. ① Issue direction (#1206): PASS. Matches dog's original ask ("必须报告日志也要打印…让用户知道冲突后可能导致消息错乱") and the floor-4 clarification (focus = third-party compression plugins on the client). Implements exactly the floor-6 adjusted plan: per-client registry scan, two-tier detection (known vs keyword-suspected), findings surfaced at launch time AND during session lifetime via the conflict ledger. Not a duplicate (searched open+closed). ② Stale base fixed. The PR was ~25 commits behind master (incl. release v0.1.140/v0.1.141, #1158 fetch-guard, #1192 plugin-manifest tools, wangbl1010's claude-watchdog PRs). Rebased onto current master Pre-flight on rebased head
③ Regression review — existing behaviors on touched paths:
No changes to config schema, persistence version, wire protocol, acp-kernel pin, ④ Code review notes:
⑤ Test validity: 16 tests, all with teeth — both tiers, all entry forms (bare/ ⑥ Diff cleanliness: 11 files, +812/-9, every line tied to #1206. No whitespace churn, no generated/lock-file drift. Clean. Behavior changes (confirming author's flag): purely additive diagnostics — new warn logs/stderr lines appear only when another compressor is actually detected or interference observed; no existing log text, threshold, default, or wire behavior changed. Only deliberate delta: orphan-gc deactivations now emit a warn (were silent) — intended detection signal, disclosed. Auto-merge gate: not eligible (feat, new capability surface — must stay human-merged). Everything else green. 中文摘要:审查了第三方压缩插件共存检测功能(#1206),方向与需求一致、rebase 到最新 master 后 typecheck/build/测试全部通过(3 个失败为 master 上已存在的环境相关 claude e2e,与本 PR 无关),代码与回归审查无问题——可以合并。 |
结论:需小改后合并。 核心设计成立(只读/尽力而为/5min 缓存/逃生开关/hermetic 测试/台账走既有 metadata 通道),无架构或数据安全问题。逐项: ❌ 阻塞:rebase 到当前 master分支现落后 master 66 提交,试验性合并已在
|
[bot] 🏷 收到独立复审,四条必改项 + 顺手项全部认领:
顺手项一并处理:删未使用的 master 已前进到 |
…ut of ledger, hermes name-only, shared isLegacyBcpEntry - keyword-tier findings now warn 'IF it also compresses context' instead of asserting double-compression (server warn + launcher stderr); ledger detail gains a [suspected] suffix for keyword matches - #920 design-absorbed opencode-acp entries no longer enter the conflict ledger (isDesignAbsorbed: known opencode-acp under bili's own opencode mode) — acp_status/web banner can no longer advise removing a plugin bili deliberately absorbs - hermes scan matches plugin dir names only; plugin.yaml full-text haystack removed (descriptions mentioning context/summarize were false positives) - isLegacyBcpEntry unified into src/agent/native-bootstrap.ts as the single canonical predicate (union of both prior implementations); pi-native and thirdparty-scan import it — comment drift resolved by construction - opencode project walk bounded by the .git root (was: climbed to fs root); omp inline-flow extensions limitation documented; unused resolveDshHome import dropped - tests: +4 (git-root bounding, no-anchor cwd-only walk env-aware, #920 exemption matrix, hermes yaml negative fixture)
f98941c to
d0efcd9
Compare
…ut of ledger, hermes name-only, shared isLegacyBcpEntry - keyword-tier findings now warn 'IF it also compresses context' instead of asserting double-compression (server warn + launcher stderr); ledger detail gains a [suspected] suffix for keyword matches - #920 design-absorbed opencode-acp entries no longer enter the conflict ledger (isDesignAbsorbed: known opencode-acp under bili's own opencode mode) — acp_status/web banner can no longer advise removing a plugin bili deliberately absorbs - hermes scan matches plugin dir names only; plugin.yaml full-text haystack removed (descriptions mentioning context/summarize were false positives) - isLegacyBcpEntry unified into src/agent/native-bootstrap.ts as the single canonical predicate (union of both prior implementations); pi-native and thirdparty-scan import it — comment drift resolved by construction - opencode project walk bounded by the .git root (was: climbed to fs root); omp inline-flow extensions limitation documented; unused resolveDshHome import dropped - tests: +4 (git-root bounding, no-anchor cwd-only walk env-aware, #920 exemption matrix, hermes yaml negative fixture)
d0efcd9 to
32b7ae6
Compare
复审四项 + 顺手项已全部处理完毕,分支已 rebase 到当前 master( 四项必改① keyword 级告警措辞 — server warn 与 launcher stderr 现在按 tier 分两种措辞:known 保留确定性断言("it is bili's sibling compressor — …will double-compress…");keyword 改为条件式 "its name matches compression keywords — IF it also compresses context, the two compressors will double-compress…"。台账 detail 对 keyword 命中追加 ② #920 absorbed 条目不进台账 — 新增导出谓词 ③ hermes 收窄为目录名匹配 — 删除 plugin.yaml 全文 haystack,只匹配 ④ isLegacyBcpEntry 统一 — 选"共享函数"而非修注释:规范实现移入 顺手项
Pre-flight(head
|
…ut of ledger, hermes name-only, shared isLegacyBcpEntry - keyword-tier findings now warn 'IF it also compresses context' instead of asserting double-compression (server warn + launcher stderr); ledger detail gains a [suspected] suffix for keyword matches - #920 design-absorbed opencode-acp entries no longer enter the conflict ledger (isDesignAbsorbed: known opencode-acp under bili's own opencode mode) — acp_status/web banner can no longer advise removing a plugin bili deliberately absorbs - hermes scan matches plugin dir names only; plugin.yaml full-text haystack removed (descriptions mentioning context/summarize were false positives) - isLegacyBcpEntry unified into src/agent/native-bootstrap.ts as the single canonical predicate (union of both prior implementations); pi-native and thirdparty-scan import it — comment drift resolved by construction - opencode project walk bounded by the .git root (was: climbed to fs root); omp inline-flow extensions limitation documented; unused resolveDshHome import dropped - tests: +4 (git-root bounding, no-anchor cwd-only walk env-aware, #920 exemption matrix, hermes yaml negative fixture)
|
Independent deep review complete — rebased onto current master (one conflict: Verified sound:
Gates on the rebased head: typecheck ✓ / 2640 tests 0 fail / build ✓. Ready to merge when CI is green. |
32b7ae6 to
8af0546
Compare
…ut of ledger, hermes name-only, shared isLegacyBcpEntry - keyword-tier findings now warn 'IF it also compresses context' instead of asserting double-compression (server warn + launcher stderr); ledger detail gains a [suspected] suffix for keyword matches - #920 design-absorbed opencode-acp entries no longer enter the conflict ledger (isDesignAbsorbed: known opencode-acp under bili's own opencode mode) — acp_status/web banner can no longer advise removing a plugin bili deliberately absorbs - hermes scan matches plugin dir names only; plugin.yaml full-text haystack removed (descriptions mentioning context/summarize were false positives) - isLegacyBcpEntry unified into src/agent/native-bootstrap.ts as the single canonical predicate (union of both prior implementations); pi-native and thirdparty-scan import it — comment drift resolved by construction - opencode project walk bounded by the .git root (was: climbed to fs root); omp inline-flow extensions limitation documented; unused resolveDshHome import dropped - tests: +4 (git-root bounding, no-anchor cwd-only walk env-aware, #920 exemption matrix, hermes yaml negative fixture)
8af0546 to
24fd6e7
Compare
收到深度复审结论。我做了独立交叉验证,另发现 master 在你评论之后又前进了 9 个提交,已再 rebase 一次——当前 PR head: 对你 rebase(
|
What
Issue #1206 asked for automatic detection of other compression plugins coexisting with bili and warning about them — two compressors on one conversation double-compress and corrupt message refs (消息错乱). Per the issue thread's clarification, the focus is third-party compression plugins installed on the client.
New modules
src/thirdparty-scan.ts— best-effort, read-only, 5-minute-cached scan of each client's plugin registry:pluginarrays (bare /npm:/ versioned / path / object forms).pi/settings.jsonpackages~/.omp/agent/config.ymlextensionsblockenabledPlugins/pluginskeys +~/.claude/plugins/dir$KIMI_CODE_HOME/plugins/installed.json(dir-listing fallback)~/.hermes/plugins/dirs (+plugin.yamlwhen present)package.jsondependenciesTwo finding tiers: known conflicts (
opencode-acp, legacybillion-context-pi) and keyword-suspected entries (compress*/compact*/acp/summar*/context*; full-word matching socontext7does not false-positive; bili's own entries always skipped). Also exportssniffScanClient(headers)so a standalone proxy identifies the client from wire headers (claude session id, opencode session headers; codex UA recognized but yields no scannable registry).src/conflict-watch.ts— per-session conflict ledger (session.metadata.conflictEvents, capped at 20): kindsthird-party-plugin/unannounced-rewrite/orphan-reap(+ reservednative-compaction), plusformatConflictSectionforacp_statusandsummarizeConflictsfor the stats endpoint.Where findings surface
runLaunchscans the launched client's registry before spawn and prints each finding to stderr (user sees it immediately in the terminal).x-bili-plugin(plugin mode) or wire-header sniffing (wire mode); findings recorded into the session ledger + one-timewarnlog with actionable guidance.acp_statusgains aCOMPRESSION CONFLICTSsection (last 10 events + guidance);GET /__bili/statsgains aconflictsaggregate; web UI shows a banner with counts/kinds.Design notes
opencode-acpis info-only by design (opencode v1: keep opencode-acp legacy sessions working after switching to bili #920 deliberately absorbs it for legacy sessions) — no alarm there; everywhere else it warns.BILI_CONFLICT_SCAN=0.Behavior changes (flagged per policy)
/__bili/statsand/__bili/statusgain additive fields only.Tests
tests/issue1206-thirdparty-scan.test.ts(16 tests): one fixture home per client via env overrides (hermetic — no real-home leakage), known-conflict vs keyword tiers, self/context7 skipping, all entry forms, cache TTL + invalidation, header sniffing, opt-out flag, ledger cap/ordering,formatConflictSectionandsummarizeConflictsoutput.Pre-flight
npm run typecheck✅npm test✅ (2367 pass / 0 fail / 2 skipped e2e-gated)npm run build✅Closes #1206