Repository navigation
fix: warn on tool-call-shaped XML in plugin passthrough prose (#1368) - #1371
Conversation
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1371Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1371.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Reviewing this PR now — it's the completed work from #1368, so I'm verifying rather than redoing: pulling branch |
…oseAcc (#1368) The Responses pipe accumulated reasoning summary text into proseAcc only via the filter path; chunks that never engaged the tag/marker heuristics were forwarded to the client unaccounted, so a tool-call-shaped fragment carried there would leave no warn. Account them at the same site as every sibling fast path, pinned by a stream that ends after the delta so the delta's own accounting is the only prose source.
[bot] 🏷 Review complete — mergeable. I pulled the branch, re-ran the full pre-flight locally, audited every accumulation site against the client-visible text paths of all three wire shapes, and fixed one coverage gap directly on the branch (commit ① Issue direction (#1368). Verified against source: ② Regression audit — existing behaviors touched by this diff:
③ Code review finding (fixed on-branch, ④ Test quality: the original 5 tests are real regression tests — each asserts exactly one warn AND decoded verbatim forwarding (decoded comparison, since raw bytes carry JSON escaping), covering literal ⑤ Diff cleanliness: clean — 2 files, additive only; my review commit adds 1 line + 1 test, nothing else. Pre-flight evidence (re-run by me on Behavior change flag (intended, not drift): plugin-mode sessions now emit ONE additional 中文摘要:修复了插件模式透传流缺少 #361 工具调用 XML 检测的观测盲区(warn-only、不动线上字节),审查中另发现并直接修掉了 Responses 推理摘要 delta 快速路径漏计 prose 的一处覆盖缺口(补了一行累加+一个可复现回归测试),全量本地验证与 CI 十项全绿,可以合并。 |
|
深审通过(独立验证,零改动): 设计核验(#1368 = proxy 管道 #361 检测器在 plugin 管道的对齐):
实测:plugin-passthrough-tool-xml-warn 6/6(235 行,含多帧散文拼合、无散文短路、每请求一次上限)。 合并无阻塞。 |
What
Plugin-mode passthrough pipes (
pipePluginChatWithStrip/pipePluginResponsesWithStrip,src/plugin.ts) now carry the #361 once-per-request warn-only detector that proxy mode already has (src/server.ts): when the model's prose contains tool-call-shaped XML (a tool call drafted as literal text — the #1366 shape), bili.log gets a[tag-echo] <session> plugin passthrough: response text contains tool-call XML fragment (possible tag echo; not stripped)warning.Before this change, the same traffic in a plugin session left zero signal in the log — which is exactly why #1366 had to be attributed from a screenshot alone.
Design
proseAccat the existing text-accounting sites (fast paths, filter paths viapushField, flushed tails; Responses pipe also covers done-family payloads via aresponsesEventTextLength→responsesEventTextrefactor that returns the joined text). At the terminal point (same site asmaybeWarnDegenerate),containsToolCallXmlFragment(proseAcc)runs once; degenerate-turn retries are covered because accumulation spans all attempts of one request.Tests
New
tests/plugin-passthrough-tool-xml-warn.test.ts(5 tests): openai chat pipe (literal + JSON-escaped\u003cforms), anthropic pipe, responses pipe, and a plain-prose negative — each asserts exactly one warn AND that the decoded SSE payload forwards the fragment verbatim (decoded comparison, since raw bytes carry JSON escaping).Pre-flight (rebased onto current master, v0.1.153)
npm run typecheck— cleannpm test— 2651 tests, 0 fail, 11 skippednpm run build— success incl. dist-import-annotations gateFixes #1368