feat(core): enhance loop detection with thought and action stagnation checks#3176
Closed
euxaristia wants to merge 1 commit intoQwenLM:mainfrom
Closed
feat(core): enhance loop detection with thought and action stagnation checks#3176euxaristia wants to merge 1 commit intoQwenLM:mainfrom
euxaristia wants to merge 1 commit intoQwenLM:mainfrom
Conversation
… checks Add detection for repetitive thoughts, read file loops, and action stagnation in LoopDetectionService. Expand telemetry LoopType enum with new loop categories and improve test coverage for edge cases. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Collaborator
|
Thanks for the contribution, @euxaristia! The idea of enhancing loop detection with thought and action stagnation checks sounds useful. However, this PR touches 100 files, which makes it very difficult to review safely. Could you break this down into smaller, focused PRs? For example, separate the core stagnation detection logic from any refactoring or test changes. That would make it much easier to review and merge incrementally. Happy to revisit once it's split up into more manageable pieces! |
Contributor
Author
|
Oops! Something must have gone wrong with my PR and my agents. I'll fix it soon |
This was referenced Apr 13, 2026
Closed
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.
Summary
Enhance the LoopDetectionService with additional loop detection patterns to catch more subtle looping behaviors that were previously undetected.
Changes
New Loop Detection Patterns
Improvements
REPETITIVE_THOUGHTS,READ_FILE_LOOP, andACTION_STAGNATIONto theLoopTypeenum in telemetry typesLoopDetectionServicewith thought tracking and action stagnation countersTelemetry
All new loop types are properly logged via
logLoopDetectedand will appear in telemetry when loop detection is triggered.History note
This update addresses edge cases where the model could enter subtle loop patterns that weren't caught by the existing identical tool call and content repetition checks. Examples include: