fix(agent): 修复 #4/#8 —— msg==nil 空答与畸形参数绕过自修复护栏 - #10
Open
icn5381 wants to merge 2 commits into
Open
Conversation
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 指令。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
修复两个 ToolLoop 相关问题:
sink.generate返回(nil, nil)且已有工具观察时,不再按自然结束交付空答——置terminated_by=no_response转 wind-down 从已有观察合成答复。判定信号用hasObservation(工具轮真正执行过)而非i>0(截断重试轮也消耗迭代但无观察,零观察下 wind-down 会诱导模型编造结论);收尾生成也失败时交付含终止原因的降级说明而非空白回复。handleToolCall参数 JSON 解析失败分支补guard.recordFailure。此前模型反复以畸形参数调用同一工具时护栏对此视而不见,再规划(2 次)与提前收尾(4 次)均不触发。测试
go test ./...与基线一致、-race通过、-tags integration套件通过。