Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Aug 8, 2025

This PR fixes issue #6834 where setting the "Errors and Repetition Limit" to 1 incorrectly blocks the first (non-repeated) tool call.

Problem

The tool repetition detector was incorrectly counting the first occurrence of a tool as 1, which meant that with a limit of 1, the very first tool call would be blocked even though it was not a repetition.

Solution

  • Changed the initial count from 1 to 0 for new (non-repeated) tool calls in ToolRepetitionDetector.ts
  • Updated all affected test cases to match the correct expected behavior
  • Now a limit of N correctly allows N consecutive identical calls before blocking (as intended)

Testing

  • All existing tests have been updated and pass
  • The fix ensures that:
    • Limit of 1: Allows the first call, blocks the second identical call
    • Limit of 2: Allows first two calls, blocks the third identical call
    • And so on...

Related Issue

Fixes #6834


Important

Fixes tool repetition detection to correctly allow the first tool call when the limit is set to 1, updating logic and tests accordingly.

  • Behavior:
    • Fixes issue Errors and Repeated Use Limitations #6834 by changing initial count from 1 to 0 for new tool calls in ToolRepetitionDetector.ts.
    • Ensures a limit of N allows N consecutive identical calls before blocking.
  • Testing:
    • Updates test cases in ToolRepetitionDetector.spec.ts to reflect the corrected behavior.
    • Tests confirm that:
      • Limit of 1 allows the first call, blocks the second.
      • Limit of 2 allows the first two calls, blocks the third.
      • Similar logic applies for higher limits.

This description was created by Ellipsis for 72691ac. You can customize this summary. It will automatically update as commits are pushed.

…en limit is 1

- Changed initial count from 1 to 0 for new (non-repeated) tool calls
- Updated test expectations to match correct behavior
- A limit of N now correctly allows N consecutive identical calls before blocking
- Fixes issue #6834 where setting limit to 1 incorrectly blocked the first tool call
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 8, 2025 07:49
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Aug 8, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing my own code is like debugging in a mirror - everything looks backwards but the bugs are still mine.

this.consecutiveIdenticalToolCallCount++
} else {
this.consecutiveIdenticalToolCallCount = 1 // Start with 1 for the first occurrence
this.consecutiveIdenticalToolCallCount = 0 // Reset to 0 for a new tool
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix! The change from 1 to 0 is correct - the first occurrence shouldn't count as a repetition. Consider adding a comment here to explain the counting logic for future maintainers, something like: // Start from 0 since this is the first occurrence, not a repetition

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 8, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Aug 11, 2025
Copy link
Collaborator

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Aug 11, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 11, 2025
@mrubens mrubens merged commit bd39fe6 into main Aug 11, 2025
25 checks passed
@mrubens mrubens deleted the fix/tool-repetition-limit-issue-6834 branch August 11, 2025 21:36
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 11, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Errors and Repeated Use Limitations

4 participants