Repository navigation
fix: downgrade ACP body-artifact detection to advisory (#1357) - #1364
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1364Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1364.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 On it — this is a [PR] tracking issue for branch |
PR Review — #1364 (Phase 1 of #1357): ACP body-artifact detection → advisory-only ① Direction (原 issue) — Verified against #1357's design and its owner-approved migration plan (floor 3). Root cause confirmed: the old content-fallback branch returned ② Regression review — existing-behavior inventory for every touched path:
③ Code review: fall-through is correct — ④ Test validity: updated T3/T8/T12/#1218 have teeth — ⑤ Diff cleanliness: 3 files, +196/−59; every line relates to the PR's purpose; no lockfile churn, no version bump. Verification
Direct fixes applied on the PR branch (labeled commits, docs-only):
CI is re-running on new head 中文摘要:审查了「ACP 正文产物检测从决定性降级为仅告警」这一改动——方向与 #1357 owner 批准的方案一致( |
|
深审通过(独立验证,零改动): 设计核验(#1357 Phase 1 语义翻转正确):历史 ACP 内容从"外国链→强制 passthrough"降级为advisory 观测——请求正常处理、会话自建压缩状态。这是把 #1218 时代的判决从"看见即逃逸"改成"看见但不动手",根因(字面量 tag 被当成 bili 自己的链)在源头松绑。
实测:issue1086-chain-self-exemption 20/20。 非阻塞观察:Phase 2(若需要)是链证据的持久化净化;当前 advisory 面板每会话首见显示一次,无噪音累积问题。 合并无阻塞。 |
收到深审结论,谢谢。补一条我这边推送文档修正后( CI on cf48bb7:10/11 绿,唯一红项是已知负载型 flake,与本 PR 无关
建议:Actions → run 其余无阻塞项。按规则合并由人工执行:#1364 中文摘要:PR 本体审查通过且已直接补了两处过期文档(注释+中英配置行),当前唯一 CI 红灯是 #1248 记录过的 claude-native 负载型 flake(同代码其他三平台全绿、本 PR 零功能改动),建议重跑失败腿后即可人工合并。 |
cf48bb7 to
d4c75ec
Compare
|
冲突已解 + CI 失败定性,新 head 冲突:纯文档行竞争——master 的 #1212 新增 CI 失败定性:唯一红 = ubuntu-latest/24 单平台(ubuntu-22/24 的 Windows、四个 e2e 全绿)。rebase 后本机全量 2752 测试 0 败(2740 过 + 12 e2e 门控 skip)、typecheck/build 绿——无平台特异失败可复现,按 flake 处理;新 head 的 CI 全量重跑会给出裁决。 等 CI 绿即可合。 |
新 head Rebase 内容核验(逐条对过)
CI on d4c75ec:13/13 全绿——包括此前唯一红项 无遗留项,可以合并(人工执行):#1364 中文摘要:rebase 后的新 head 经独立核验(冲突并集解正确、功能代码完好、diff 收敛)+ CI 13/13 全绿且原红腿转绿,确认无阻塞,可合并。 |
[bot] 🏷 Heads-up while working #1395 (Step 2, PR #1397): this PR's CI is red and its base is stale.
Also noting for the record: #1395's OP describes Step 1 as "已由 PR #1364 修复关闭", but the PR is still open/unmerged — master's chain gate is still the decisive passthrough ( |
d4c75ec to
2b6ed75
Compare
|
#1417 批次深审 + rebase 交付(reviewer delegate 双核): 判定:可合(行为改变=有意设计,已声明)干什么/动机:#1357 Phase 1 —— 把 "inbound body 带 ACP 形产物 + 无 hop 头 + 无本地状态" 的判决从致命透传(会话永久 passthrough、永不压缩,#1357 报的坑)降级为advisory 告警(照常处理、建状态、正常压缩);/acp 面板显示 ℹ️ advisory 观察行。 四轴:压缩行为=修复(以前这类会话根本不压)、cache 命中=正常处理后才谈得上、推荐列表/压缩质量=零触碰。 rebase 内容(新 head
|
新 head Rebase 内容核验
CI on 2b6ed75:13/13 全绿(test ×4 平台、e2e、hermetic registry e2e、四条 lane、build-artifact、version-guard)。 无遗留项,可以合并(人工执行):#1364 中文摘要:rebase 后的新 head 经独立核验(union 解法正确、#1403 不变量保留且 T2 按 advisory 契约带牙改写、三处注释漂移已修、核心语义幸存)+ CI 13/13 全绿,确认无阻塞,可合并。 |
A fresh proxy session whose history carried ACP-shaped content (render tags or ACP tool-name invocations) with no local state was judged a foreign bili chain and forwarded byte-identical (prepared=null), once per session, with NO session record created. Because that content persists in the client's re-sent history, the session was locked into passthrough forever -- compression never engaged for any conversation containing literal ACP tags (e.g. an AGENTS.md example), even though those tags are just user-authored text. Phase 1 of #1357: make ACP *body* artifact detection advisory-only. When such artifacts appear without x-bili-hop and without local compression state, log one observation per session and let the request enter processTurn so the session establishes its own state. The x-bili-hop header remains authoritative verbatim passthrough (unchanged). The /acp diagnostics surface is repurposed from chain-passthrough to chain-advisory. Behavior change (old -> new): content-detected fresh session went from byte-identical passthrough / no session record / permanent lock-in, to processed normally (session owns its own state) with one advisory warn and real /acp activity. Tradeoff: a header-stripping bili->bili relay may now double-process until signed chain proof ships (Phases 2/3, out of scope). Tests: T3/T8/T12/#1218 updated to the advisory contract; added Responses-wire and Anthropic-wire regression tests; the regression fixture uses the verbatim AGENTS.md tag shape inline plus inside a fenced code block. Fixes #1357
2b6ed75 to
6588fb0
Compare
|
Rebased onto current master (head Gates: typecheck clean, Semantics recap for the merge decision (unchanged by the rebase):
|
新 head Rebase 内容核验
CI on 6588fb0:13/13 全绿(test ×4 平台、e2e、hermetic registry e2e、四条 lane、build-artifact、version-guard)。 语义结论与你贴的 recap 一致:hop → 硬透传不变;无 hop 的 ACP 形产物 → 单次 advisory warn + 正常处理; 无遗留项,可以合并(人工执行):#1364 中文摘要:第四次 rebase 后的新 head 经哈希级比对确认代码/测试贡献与已审版本逐字节一致、文档三行并集正确且文案未变、CI 13/13 全绿,确认无阻塞,可合并。 |
Summary
Phase 1 of #1357: make ACP body artifact detection advisory-only, so literal ACP tags / ACP tool-name invocations in a client's normal history can no longer permanently force a fresh proxy session into verbatim passthrough.
Root cause
When an inbound request carried ACP-shaped content (render
<acp>tags or ACP tool-name invocations such asacp_status) and had nox-bili-hopheader and had no local compression state, the proxy judged it a foreign bili→bili chain and forwarded it byte-identical (forward(..., prepared=null)), once per session, creating no session record. Because that content lives in the client's re-sent history, every subsequent request re-triggered the same verdict — locking the session into passthrough forever. Compression never engaged for any conversation containing literal ACP syntax (e.g. anAGENTS.mdexample), even though those tags are just user-authored text.Change
src/server.ts: the content-fallback branch (artifactSeed, no hop marker, no local state) no longer returns passthrough. It records the chain verdict (once per session) and logs a single[chain] … advisory-only … (#1357)warn, then falls through toprocessTurnso the session establishes its own state. Thex-bili-hopdecisive verbatim-passthrough path is unchanged.src/plugin.ts: the/acpdiagnostics surface is repurposed fromchain-passthroughtochain-advisory(a content-detected conversation now owns a real session;/acpshows its actual activity).Behavior change (old → new)
/acpactivityx-bili-hoppresentDisclosed tradeoff: a header-stripping bili→bili relay may now double-process until signed chain proof ships (Phases 2/3 of #1357, out of scope here). Acceptable because the common case — direct clients whose history merely contains ACP-looking text — is far more frequent and was silently broken before.
Tests
tests/issue1086-chain-self-exemption.test.tsto the advisory contract (processed + owned + one warn, not byte-identical / no-state).AGENTS.mdtag shape both inline and inside a fenced code block.tests/e2e-bili-chain.test.ts(fix: stitched-stream usage double-count after compress re-request (adapter-anthropic >0 guard) #300) still passes — the retainedx-bili-hopdecisive path is intact.Pre-flight (rebased onto current master @ v0.1.153, deps synced via
npm ci)npm run typecheck— exit 0npm test— 2648 tests, 2637 pass, 0 fail, 11 skippednpm run build— successFixes #1357