fix: process queued user messages during endless loop recovery #10816
+59
−12
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 attempts to address Issue #10814, where Roo Code gets stuck in an endless loop repeating the same tool call while ignoring user messages.
Problem
When the model gets stuck in a repetitive loop (repeating the same tool call or not using tools), user messages sent during this time are queued but never processed. The model keeps receiving the same error feedback without any way for the user to intervene and redirect it.
Solution
Added queue message processing at two critical points in the task loop:
1. In Task.ts - No Tool Use Detection (line ~3540)
When
consecutiveNoToolUseCount >= 2, the fix now checks for queued user messages and injects them as feedback to break the loop:2. In presentAssistantMessage.ts - Tool Repetition Detection (line ~826)
When
ToolRepetitionDetectordetects identical consecutive tool calls, the fix now checks for queued messages before asking the user for feedback:How It Helps
With auto-approve enabled: User messages that were previously queued and ignored will now be processed when error conditions occur, allowing the user to break out of loops.
Resets counters: When user guidance is received, mistake counters are reset, giving the model a fresh start with the user-provided direction.
Shows feedback in UI: The user's message is displayed in the chat so they know their intervention was received.
Testing
Feedback Welcome
This is my attempt at addressing the issue. Please review and provide feedback!
Fixes #10814
Important
Fixes issue where queued user messages were ignored during endless loops by processing them at critical points in
Task.tsandpresentAssistantMessage.ts.Task.ts, whenconsecutiveNoToolUseCount >= 2, checks for queued user messages and injects them as feedback to break the loop.presentAssistantMessage.ts, whenToolRepetitionDetectordetects identical consecutive tool calls, checks for queued messages before asking the user for feedback.consecutiveMistakeCountandconsecutiveNoToolUseCountwhen user feedback is processed.This description was created by
for 3da18c7. You can customize this summary. It will automatically update as commits are pushed.