Loop guard: also identical call with identical result 3 times in a row; baseline restarts (run base 20500)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
@@ -156,8 +156,11 @@ class LlmAgent:
|
||||
err, text = proxy.call(fn["name"], args)
|
||||
messages.append({"role": "tool", "tool_call_id": c.get("id", ""),
|
||||
"content": ("ERROR: " if err else "") + text[:12000]})
|
||||
if self.loop_guard and proxy.same_push_streak >= self.loop_guard:
|
||||
final = f"Stopped: loop (the same source was pushed {proxy.same_push_streak} times in a row)."
|
||||
streak = max(proxy.same_push_streak, proxy.same_call_streak)
|
||||
if self.loop_guard and streak >= self.loop_guard:
|
||||
final = (f"Stopped: loop (the same source was pushed {proxy.same_push_streak} times in a row)."
|
||||
if proxy.same_push_streak >= self.loop_guard else
|
||||
f"Stopped: loop (the same call with the same result {proxy.same_call_streak} times in a row).")
|
||||
self.end_reason = "loop"
|
||||
break
|
||||
if self.end_reason == "loop":
|
||||
|
||||
Reference in New Issue
Block a user