Skip to content

fix(agent): 修复 #4/#8 —— msg==nil 空答与畸形参数绕过自修复护栏 - #10

Open
icn5381 wants to merge 2 commits into
larry-zy:mainfrom
icn5381:fix/issue-4-8-agent-toolloop
Open

fix(agent): 修复 #4/#8 —— msg==nil 空答与畸形参数绕过自修复护栏#10
icn5381 wants to merge 2 commits into
larry-zy:mainfrom
icn5381:fix/issue-4-8-agent-toolloop

Conversation

@icn5381

@icn5381 icn5381 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

概要

修复两个 ToolLoop 相关问题:

测试

  • 单元 7 例:nil 后 wind-down / 首轮与截断重试轮 nil 保持自然结束 / 收尾失败降级文案 / 畸形参数不触达工具且 tool 消息 1:1 / 再规划注入 / 恰 4 次收尾。
  • 端到端 3 例:httptest 起 OpenAI 兼容 mock,走生产 chat 客户端(含 DSML 归一化)+ 生产 Builder/Agent + RegistryAgentOrchestrator,覆盖 Chat 与 SSE 流式。
  • 全栈对照(真实服务 + MySQL/Redis/Neo4j/Milvus):同场景畸形参数,修复前空转 24 轮工具调用/26 次 LLM 请求,修复后恰 4 轮/6 次即护栏收口,tool_call 与 tool 消息严格 4:4,结论正确落库。
  • go test ./... 与基线一致、-race 通过、-tags integration 套件通过。

zhuanzmima0000 added 2 commits August 17, 2026 21:14
Issue larry-zy#4(eino_toolloop.go):
- execLoop 中 sink.generate 返回 (nil, nil) 且已有工具观察时,不再按自然结束
  交付空答:置 terminated_by=no_response 转 wind-down 从已有观察合成答复。
- 判定信号用 hasObservation(工具轮真正执行过)而非 i>0:截断重试轮也消耗
  迭代但无观察,零观察下 wind-down 会诱导模型凭空编造结论。
- wind-down 收尾生成也失败/为空时,交付含终止原因的降级说明而非空白回复,
  并补记收尾生成失败的日志。

Issue larry-zy#8(eino_tooling.go):
- handleToolCall 参数 JSON 解析失败分支补 guard.recordFailure(签名退化为
  工具名,与普通执行失败一致):此前模型反复以畸形参数调用同一工具时护栏
  视而不见,再规划(2 次)与提前收尾(4 次)均不触发,恰好绕过护栏要
  打破的原地打转。

测试:
- 单元:nil 后 wind-down;首轮与截断重试轮的 nil 保持自然结束;收尾失败
  降级文案;畸形参数不触达工具且 tool 消息 1:1 配对;再规划提示注入;
  恰 4 次失败即提前收尾。
- 端到端:httptest 起 OpenAI 兼容 mock 服务,走生产 chat 客户端(含 DSML
  归一化)、生产 Builder/Agent 与 RegistryAgentOrchestrator,覆盖 Chat 与
  SSE 流式双路径。同场景对照:修复前空转到 maxIter(24 轮工具调用/26 次
  请求),修复后恰 4 轮/6 次即护栏收尾,wind-down 请求历史中 tool_call 与
  tool 消息严格 4:4。
govulncheck 门禁对新披露的 7 个标准库漏洞报红(GO-2026-6218 net/url、
GO-2026-6091 html/template、GO-2026-6090 crypto/tls、GO-2026-6089
net/http、GO-2026-6088 encoding/xml、GO-2026-5972 encoding/asn1、
GO-2026-5026 net/http),均修复于 go1.25.13。沿用此前钉版本修复
GO-2026-5856 的做法,升级 go.mod 的 go 指令。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant