lili 21186b81b0 fix(cheap): 封死 M3 400 流式 tool_calls 聚合炸弹——parallel_tool_calls=False 主防线 + 同 index 异 id 按 id 分桶兜底补丁 (fix400 A/B/C)
根因(前置诊断坐实):agentscope 2.0.2 _parse_stream_response 按 tool_call.index 分桶,
M3 经 new-api 并行 call 不区分 index → 第二 call 的 arguments 拼进首桶(非法 JSON)→
服务端丢 call → tool result 孤儿 → 400 code 2013 → ChatService.run 吞异常 → SSE 无终结 →
driver idle 600s 慢失败。触发开关 = Service get_model 不传 stream(类默认 True)。

A 主防线:driver session parameters 加 parallel_tool_calls=False(经 Parameters 透传,
  _call_api 对 API 带 parallel_tool_calls=false,源头禁并行);fake-SSE 契约测试加断言锚。
B 纵深兜底:m3_stream_patch 运行时 monkeypatch(绝不改 venv 本体;钉 agentscope==2.0.2,
  升级必须复核):chunk 流 index 重映射——同 index 但携非空且不同 id 按 id 开新桶;聚合完
  args 非法 JSON log.warning 带指纹。挂载 build_cheap_app(import agentscope 后)。
  单测 6 项:2.0.2 真聚合函数复刻 93001 炸弹指纹对照 + 补丁分桶 + 正常流不回归 +
  同 id 复帧同桶 + 坏 args warning 指纹 + apply 幂等。
C 对账:tier2 服务路 anthropic_credential → AnthropicChatModel(stream 同样默认 True),
  但其聚合由 content_block_start 显式开桶(_anthropic/_model.py:359-368 赋值建桶,
  非 += 隐式拼接),无本炸弹路径;parallel_tool_calls 参数仅 openai_chat/dashscope 有。
  tier2 进程内路 build_model stream=False(worker/config.py)不走流式聚合。均不动。

测试:test_m3_stream_patch 6/6 + test_cheap_service_driver/app 19/19 全绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 21:09:44 -07:00
Description
No description provided
240 MiB
Languages
Java 38.3%
JavaScript 28.5%
Python 19.4%
Vue 6.2%
TypeScript 3.8%
Other 3.7%