fix: 循环检测按工具名+参数比较,避免把检索扇出误判为循环 - #472
Merged
Merged
Conversation
RuleAgentTraceLoopDetection 只比较工具名序列,因此一次检索扇出(同一个 WebSearch、八个不同 query)与卡死循环无法区分:n-gram 会把它读成 ['WebSearch','WebSearch'] 重复 4 次并判为循环。 改为在"工具名 + 参数指纹"的签名序列上做 n-gram:参数不同则签名不同,扇出 不再触发;同一调用反复重试仍会被检出。没有参数的调用退回按名比较,旧行为 不变。参数键兼容 args / arguments / tool_input / input。 reason 仍按工具名展示(pattern ['Read','Read']),不暴露内部指纹。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
RuleAgentTraceLoopDetection 只比较工具名序列,因此一次检索扇出(同一个
WebSearch、八个不同 query)与卡死循环无法区分:n-gram 会把它读成
['WebSearch','WebSearch'] 重复 4 次并判为循环。
改为在"工具名 + 参数指纹"的签名序列上做 n-gram:参数不同则签名不同,扇出
不再触发;同一调用反复重试仍会被检出。没有参数的调用退回按名比较,旧行为
不变。参数键兼容 args / arguments / tool_input / input。
reason 仍按工具名展示(pattern ['Read','Read']),不暴露内部指纹。