Conversation
Owner
Author
|
Just adding a stupid counter doesn't work . Doom loop has to be detected by the genai/reflection layer. #114. |
…ding loop detection (#80) - Reduce MAX_ATTEMPTS from 5 to 3 to stop pushing stuck agents - Add detectActionLoop() to detect repeated identical bash commands - Update buildEscalatingFeedback() with action loop and final attempt messages - Update buildSelfAssessmentPrompt() with attempt count awareness - Add 17 new unit tests for loop detection and attempt-aware prompting
e1907e6 to
57ad843
Compare
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
Fixes #80 — Reflection plugin causes loops by pushing the agent to continue even when it's stuck repeating the same actions.
Changes
MAX_ATTEMPTSfrom 5 to 3 — agent gets pushed at most 2 times before receiving terminal guidancedetectActionLoop()function — detects repeated identical bash commands (normalizes timestamps, triggers when 60%+ of commands are repeated 3+ times)buildEscalatingFeedback()— action loop returns "STOP: Action Loop Detected" message; final attempt returns "Final Attempt" with give-up guidancebuildSelfAssessmentPrompt()— injects## Reflection Historysection with attempt count; adds rules against retrying same failing approachrunReflection()— passescurrentAttemptCountandactionLoopCheck.detectedto the updated functionsdetectActionLoop, attempt-aware prompting, and escalating feedback edge casesTesting
npm test— 341 tests pass (336 + 5 skipped)npm run eval:judge— 23/23 passnpm run eval:stuck— 12/12 passnpm run eval:compression— 12/12 pass