mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-21 08:15:23 -04:00
[GH-ISSUE #175] performAgentChain has no iteration cap — infinite loop on repeating tool calls #68
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Vladimir44343 on GitHub (Mar 5, 2026).
Original GitHub issue: https://github.com/vxcontrol/pentagi/issues/175
Bug Description
The main
performAgentChainloop inbackend/pkg/providers/performer.gois an unboundedfor {}loop with no maximum iteration counter. When a model repeatedly calls the same tool (e.g., due to model limitations), the repeating detector fires and returns"tool call 'X' is repeating, please try another tool"as a successful response (nilerror). This meanswantToStopis never set totrue, and the loop continues indefinitely.Reproduction
"tool call 'X' is repeating, please try another tool"but ignores it and calls the same tool againRoot Cause
In
performer.go,execToolCallreturns(response, nil)when repeating is detected:The
performAgentChainloop has no iteration cap:Suggested Fix
Add a hard iteration cap to
performAgentChain:Additionally, consider adding escalation to the repeating detector — after N consecutive repeating detections (e.g., 5), return an actual error instead of a message:
Environment