Skip to content

Add the detection of non-continuous tool repeated callsΒ #5496

@aheizi

Description

@aheizi

What specific problem does this solve?

When calling tools, there may be non-continuous repeated tool calls, such as: ABABAB. This can cause the large model to fall into a loop. The current tool call detection can only detect continuous repetitions like "AAAA".

Additional context (optional)

Image

Roo Code Task Links (Optional)

No response

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear impact and context

Interested in implementing this?

  • Yes, I'd like to help implement this feature

Implementation requirements

  • I understand this needs approval before implementation begins

How should this be solved? (REQUIRED if contributing, optional otherwise)

Store the call history of the tool and then use the pattern repetition detection algorithm to detect whether there are duplicates.

How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)

mock the repeated output data in multiple modes and then conduct detection
mock tool: https://github.com/polly3d/mockai

Technical considerations (REQUIRED if contributing, optional otherwise)

Modify the existing ToolRepetitionDetector to support the repeated invocation of non-continuous tools
Performance implications: The number of tool invocations is limited and there are no performance issues

Trade-offs and risks (REQUIRED if contributing, optional otherwise)

It is necessary to prevent misjudgment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.enhancementNew feature or requestproposal

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions