fix: reset grace-retry counters on mistake limit and fix manual retry userMessageWasRemoved#12296
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
Conversation
… userMessageWasRemoved - Add missing userMessageWasRemoved flag to manual retry path for empty API responses (same fix as PR #12291). Without this, the user message is not re-added to conversation history on retry, causing cascading empty responses. - Reset consecutiveNoToolUseCount and consecutiveNoAssistantMessagesCount when the mistake_limit_reached dialog is shown and consecutiveMistakeCount is reset. Without this, these counters remain elevated after the user provides guidance, causing the very next no-tool-use or empty response to immediately show an error and re-increment consecutiveMistakeCount, creating a frustrating loop. - Add tests for counter reset behavior on mistake limit. Closes #12284
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.
Related GitHub Issue
Closes: #12284
Description
This PR attempts to address Issue #12284, specifically the related error reported by @PlanBernhard where the model hits the
mistake_limit_reachedthreshold after empty API responses. Feedback and guidance are welcome.Two bugs found:
Missing
userMessageWasRemovedflag in manual retry path (same fix as PR fix: add missing userMessageWasRemoved flag in manual retry for empty API responses #12291): When the user clicks "Retry" after an empty API response, theuserMessageWasRemovedflag was not set on the retry stack item. This caused the retry to skip re-adding the user message to conversation history, leading to cascading empty responses that could ultimately trigger the mistake limit.Grace-retry counters not reset on mistake limit dialog: When
consecutiveMistakeCountis reset to 0 after the user provides guidance via the mistake limit dialog,consecutiveNoToolUseCountandconsecutiveNoAssistantMessagesCountwere NOT reset. This meant the very next no-tool-use or empty response would immediately show an error and re-incrementconsecutiveMistakeCount(since the counters were still >= 2), creating a frustrating loop where the user keeps hitting the mistake limit despite providing guidance.Changes:
userMessageWasRemoved: trueto the manual retrystack.push()in the empty API response handlerconsecutiveNoToolUseCountandconsecutiveNoAssistantMessagesCountalongside the existingconsecutiveMistakeCount = 0in the mistake limit handlerTest Procedure
cd src && npx vitest run core/task/__tests__/grace-retry-errors.spec.tsmistake_limit_reacheddialog, all three counters are now reset together, giving the model a fresh grace-retry periodPre-Submission Checklist
Documentation Updates
Additional Notes
This PR overlaps with PR #12291 on the
userMessageWasRemovedfix. The additional value here is the grace-retry counter reset fix, which addresses the cascading failure loop reported by @PlanBernhard. If PR #12291 is merged first, theuserMessageWasRemovedchange in this PR can be dropped, but the counter reset fix remains independently valuable.Interactively review PR in Roo Code Cloud