Repository navigation
fix: runaway text guard no longer reads Google tool-call arguments as model output - #3357
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3982-pr.3357.bd4e290This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3357.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 同机制家族的相关条目:#3289(引入 text-run 熔断车道,已合并)、#3317(#3289 误伤测试夹具导致 CI 红,已合并)、#3260/#3331(E-1)/#3344(需求与结论来源)。本 PR 是该护栏机制上一处独立的缺陷修复(Google 线束豁免缺失),症状、机制、根因均与上述条目不同,无重复。 审核结论:可合(等剩余两个 CI 车道跑完)以下结论是我独立复核产出的,不是照抄 issue 分析: 机制验证: A/B 实测(worktree @
回归清点(diff 触碰路径的既有行为逐项过):acp-enumeration / tool-xml-flood 两条原始字节车道未触碰;OpenAI/Anthropic/Responses 线束既有豁免路径全部保持(既有 33 用例全过);字节原样转发契约由新用例的 CI:ubuntu 22 三个 shard + static-gates 已绿,windows 22 / ubuntu 24 各一车道仍在跑,目前无红。 八问
行为变更披露:text-run 熔断的豁免范围从「OpenAI/Responses 线束的工具参数」扩大到「+Google 线束的 判定:可合。 代码、测试、已完成 CI 车道均无问题,剩余两车道跑完即可由人工合并。 |
… model output The #3260 text-run lane fed candidates[].content.parts[].functionCall.args string leaves to the run tracker: the Google wire has no top-level "type" field, so the function_call frame gate could not exempt it, and the payload leaf is usually named "content" — a TEXT_LEAF_KEYS name. A write-tool argument of >= 200 identical characters (e.g. a divider or padding run in a generated file) aborted the whole turn mid-stream via relay's stream guard. Add args/functionCall/parameters to EXCLUDED_BRANCHES (the openai arguments/partial_json keys were already excluded) and pin both directions: 300 '=' in functionCall.args must not trip, 300 '=' in parts[].text must.
2dc86ea to
d686c80
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.487-master.06a1f30 # this exact build
npm install -g billion-context@master # always the newest merged build
|
ai: zhipuai-lb/glm-5.3
什么坏了
模型在 Google(Gemini)线路上调用写文件类工具、参数里带 200 个以上连续相同字符(比如生成文件时的一排
=或-分隔线)时,整个回答会被流式熔断器中途掐断——用户看到回复突然截断,工具调用没执行完。这是 #3260 引入 text-run 熔断时漏掉的线束。根本原因
src/runaway-guard.ts的EXCLUDED_BRANCHES缺args/functionCall两个分支名:delta.tool_calls[].function.arguments(arguments已排除)、Responses 线束在partial_json(已排除)且有 `type: "function_call" 帧门;candidates[].content.parts[].functionCall.args下,事件没有顶层type字段,帧门帮不上忙;参数载荷字段又常叫content,恰好命中TEXT_LEAF_KEYS→ 被当成模型文本喂给 200 阈值的单字符 run 计数 → 合法 turn 被当失控输出掐掉。src/server/relay.ts给所有流式响应包了这个守卫,默认开、无开关,所以 Google 线路全部用户都会踩。这也修正了 #3344 里「runaway 200 码点阈值理论误伤(工具参数已豁免,不建议动)」的结论:豁免只对 OpenAI 线束成立,Google 线束没有豁免,是实际会发生的误杀,不是理论项。
修复
EXCLUDED_BRANCHES增加args、functionCall、parameters(与既有arguments/input/partial_json同类)。测试
tests/issue3260-text-run-guard.test.ts补两个方向:functionCall.args内 300 个=不熔断、字节原样转发;parts[].text(真正的模型文本)300 个=仍熔断——证明排除范围没有吞掉模型正文。本地:
tests/issue3260-text-run-guard.test.ts19/19、tests/runaway-guard.test.ts11/11、tsc --noEmit干净。Refs #3331 (E-1), #3344
(ai: vllm-qwen/qwen3.8-27b) 审核更新: 后到的重复 PR #3375(~1 小时后的同一修复)已按先来后到关闭为重复;其独有的两个回归用例(args.text 第二叶子拼写、混合 prose+arg 帧字节原样)已移植为本分支的附加 commit(d686c80)。分支已 rebase 到当前 master(745be9f)。
Closes #3358