fix: Enhanced duplicate response guidance for self-correction#1266
Open
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
Open
fix: Enhanced duplicate response guidance for self-correction#1266gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
Conversation
- Add duplicate_retries counter to track consecutive duplicate responses - Pass retry_count to fw.msg_repeat.md for context - Enhanced warning message with specific guidance on breaking loops - Provides 4 concrete alternatives when stuck in a loop - Reset duplicate_retries on successful iteration This addresses the ROOT CAUSE by giving the LLM: 1. Context (retry count) so it knows it's in a loop 2. Specific alternatives instead of generic 'do something else' 3. Self-correction capability before circuit breaker kicks in Works in conjunction with PR agent0ai#1265 (circuit breaker) for defense-in-depth. Related to agent0ai#1056, agent0ai#1000, agent0ai#1187, agent0ai#1011
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
This PR addresses the ROOT CAUSE of duplicate message loops by providing the LLM with context and specific guidance to self-correct BEFORE the circuit breaker kicks in.
Problem
When the LLM gets stuck in a loop, it:
Solution
Changes
How It Works
Relationship to PR #1265
Both PRs work together for defense-in-depth:
Testing
Related Issues
Addresses root cause of #1056, #1000, #1187, #1011
Notes
This is a minimal, elegant fix that addresses the root cause without modifying core logic. The LLM now has the context and guidance it needs to break loops itself.