Repository navigation
fix: chain content-fallback false positives — tags scoped to history, plugin-announced exemption (#1197) - #1213
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1213Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1213.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Received — reviewing PR now. Plan: read #1197 evidence chain → audit the two-layer fix against current master (rebase freshness) → regression-check all existing behaviors the touched paths carry (#1086 fallback, T3 passthrough, hop-marker path) → run typecheck + targeted chain tests locally → check CI. Full review reply to follow. |
…exempt plugin-announced requests (#1197)
…1213) T3 pins the #1086 content fallback for the tool-history family, but the tags family — the one this PR re-scopes — had no server-level pin. T12 drives a non-cooperative client whose history carries real render tags through a fresh enabled-store instance and asserts byte-identical passthrough, exactly one warn (pointing at the escape valve), and no session record.
2e51208 to
151757e
Compare
[bot] 🏷 Review complete — mergeable (one small gap found and fixed directly on the branch; see ④). ① 原 issue / directionCorrect root cause, not a symptom mask. The #1197 producer was the verdict site judging any tag-shaped bytes in the body as bili→bili chain evidence — including client-authored context (AGENTS.md quoting the wire format) in the system section, and cooperative plugins re-sending their own artifacts by design. Both layers fix the decision point itself (detection scope + announcement outranks content shape), and the litmus test holds: the same root cause surfacing in a new shape (e.g. tag examples in ② Regression inventory (existing behaviors of touched paths)
Known residual gap (assessed acceptable, not blocking): ③ Code reviewClean. ④ Test validityTests have teeth: byte-equality assertions, exact warn counts, escape-valve text check, session-absence checks. One gap I fixed directly on the branch: T3 pins the fallback for the tool-history family at server level, but nothing pinned the tags family — the very family this PR re-scopes — so a future refactor could silently drop tags-in-history passthrough with no test catching it. Added commit ⑤ Diff cleanlinessSingle-purpose diff, every line on-topic. Rebased to current master ( Verification
中文摘要:修复了 AGENTS.md 等上下文文件中的字面 tag 示例被误判为 bili→bili 链证据、导致新会话被永久原文透传(压缩静默失效、/acp 卡死)的问题——tag 检测限定到历史消息、插件声明请求豁免内容判定,评审时补了一个 TAGS 家族透传的服务器级回归测试,本地复现前后对比 + 全量 CI 绿,可以合并。 |
Fixes #1197 (root cause + full evidence chain in the issue comment).
What
Two layers, both at the root cause:
src/server/chain-artifacts.ts). bili's compression artifacts (render tags, re-voicedacp_summary, plugin compress tool results) always live in history items — never in the system/developer/instructions section. Tag-shaped text there is client-authored context (AGENTS.md/CLAUDE.md/README quoting the wire format — the billion-context repo itself carries literal examples) and is not chain evidence. Unparseable bodies keep the legacy whole-buffer scan.x-bili-pluginheader) are exempt from the content fallback (src/server.tsverdict site). The plugin protocol RE-SENDS bili's compression artifacts by design (the compress tool call + result live in the agent's own re-sent history), so a resumed plugin session can never be a "chain" verdict on content shape alone. The [Bug] 链检测把 bili 自己注入的 ACP 产物判成 bili→bili 链 —— 压缩内核永久跳过,长会话撞 1,048,576 上限 400(v0.1.133 回归) #1086 fallback still guards non-cooperative clients (T3 byte-identical passthrough preserved); the hop-marker path is unchanged.Why
The #1197 incident: a fresh TUI session in a billion-context checkout (AGENTS.md carries literal tag examples) was permanently verdict-ed into verbatim passthrough — the kernel never ran (silent loss of compression) and
/acpstuck on "No model request yet" forever. Reproduced byte-for-byte on 0.1.139 and master; after this fix the same scenario binds the real pi session id, runs processTurn, and/acpresolves.Tests
+5 in
tests/issue1086-chain-self-exemption.test.ts:instructions→ NOT artifactsAll pre-existing #1086/#1100/#1101 tests (T1–T9, incl. T3 real-chain passthrough) unchanged and green.
Pre-flight
npm run typecheck✓dist— its 3 failures were a stale pre-merge build, also failing on clean master)npm run build✓ + live E2E repro before/after (see issue comment)issue790-*on this machine — 17 stray bili instances pollute env, tracked in the issue comment)