Skip to content

Conversation

@MuriloFP
Copy link
Contributor

@MuriloFP MuriloFP commented Jul 15, 2025

PR Title: feat: Add configurable error & repetition limit with unified control (#5654)


Related GitHub Issue

Closes: #5654

Roo Code Task Context (Optional)

N/A

Description

This PR implements a configurable limit that controls both consecutive errors and tool repetitions, addressing the user's request to have control over when the "Roo is having trouble" dialog appears.

Key Changes:

  • Unified the consecutiveMistakeLimit setting to control both error limits and tool repetition limits
  • Updated ToolRepetitionDetector to accept a configurable limit instead of hardcoded value of 3
  • Added support for unlimited mode (setting to 0 disables both limits)
  • Updated UI labels from "Consecutive Mistake Limit" to "Error & Repetition Limit" for clarity
  • Updated all 18 language translations to reflect the new functionality

Implementation Details:

  • The Task class now passes the consecutiveMistakeLimit to ToolRepetitionDetector
  • When limit is set to 0 (Infinity), it passes 0 to ToolRepetitionDetector which treats it as unlimited
  • Both features now share the same configurable threshold

Test Procedure

Automated Tests:

  • Updated existing tests in Task.spec.ts to verify limit is passed to ToolRepetitionDetector
  • Added new test in ToolRepetitionDetector.spec.ts for unlimited behavior (limit = 0)
  • All tests pass: npx vitest core/task/__tests__/Task.spec.ts core/tools/__tests__/ToolRepetitionDetector.spec.ts

Manual Testing:

  1. Open Roo Code settings and locate "Error & Repetition Limit" slider
  2. Test with default (3): Both error dialogs and repetition dialogs appear after 3 occurrences
  3. Test with custom value (5): Dialogs appear after 5 occurrences
  4. Test with unlimited (0): Dialogs never appear
  5. Test scenarios:
    • Errors: Try reading non-existent files
    • Repetitions: Ask to read the same file multiple times

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A - The UI change is only a label update in the settings panel.

Documentation Updates

  • No documentation updates are required.

Additional Notes

  • All 18 language translations have been updated to reflect the new functionality
  • The setting now provides unified control over both types of "Roo is having trouble" scenarios
  • Setting to 0 provides unlimited mode for users who never want to see these dialogs

Get in Touch

[Your Discord username]


Important

This PR adds a unified control for error and repetition limits, updates the Task and ToolRepetitionDetector classes, modifies the UI, and includes tests for the new functionality.

  • Behavior:
    • Unified consecutiveMistakeLimit setting to control both error and repetition limits.
    • Updated ToolRepetitionDetector to accept a configurable limit, replacing the hardcoded value of 3.
    • Added unlimited mode (setting to 0 disables limits).
    • Updated UI labels from "Consecutive Mistake Limit" to "Error & Repetition Limit".
    • Updated 18 language translations to reflect new functionality.
  • Implementation:
    • Task class now passes consecutiveMistakeLimit to ToolRepetitionDetector.
    • ToolRepetitionDetector treats limit 0 as unlimited.
  • Testing:
    • Updated Task.spec.ts to verify limit passing to ToolRepetitionDetector.
    • Added test in ToolRepetitionDetector.spec.ts for unlimited behavior.
    • All tests pass: npx vitest core/task/__tests__/Task.spec.ts core/tools/__tests__/ToolRepetitionDetector.spec.ts.

This description was created by Ellipsis for f8b4bf7. You can customize this summary. It will automatically update as commits are pushed.

@MuriloFP MuriloFP requested review from cte, jr and mrubens as code owners July 15, 2025 17:42
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 15, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 15, 2025
@MuriloFP MuriloFP moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 15, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 15, 2025
…imit

- Simplified conversion logic by removing Infinity conversion
- Added validation for negative values in UI component
- Removed unnecessary console logging in migration function
- Added JSDoc comments for consecutiveMistakeLimit parameter
- Improved test coverage for ToolRepetitionDetector behavior
- Fixed UI issue where 0 was showing as 3 in ApiOptions
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jul 15, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 15, 2025
@mrubens mrubens merged commit 93f88b4 into RooCodeInc:main Jul 15, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 15, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 15, 2025
fxcl added a commit to tameslabs/Roo-Cline that referenced this pull request Jul 16, 2025
* main:
  fix: Resolve confusing auto-approve checkbox states (RooCodeInc#5602)
  fix: prevent empty mode names from being saved (RooCodeInc#5766) (RooCodeInc#5794)
  Format time in ISO 8601 (RooCodeInc#5793)
  fix: resolve DirectoryScanner memory leak and improve file limit handling (RooCodeInc#5785)
  Fix settings dirty check (RooCodeInc#5779)
  feat: increase Ollama API timeout values and extract as constants (RooCodeInc#5778)
  fix: Exclude Terraform and Terragrunt cache directories from checkpoints (RooCodeInc#4601) (RooCodeInc#5750)
  Move less commonly used provider settings into an advanced dropdown (RooCodeInc#5762)
  feat: Add configurable error & repetition limit with unified control (RooCodeInc#5654) (RooCodeInc#5752)
  list-files must include at least the first-level directory contents (RooCodeInc#5303)
  Update evals repo link (RooCodeInc#5758)
  Feature/vertex ai model name conversion (RooCodeInc#5728)
  fix(litellm): handle baseurl with paths correctly (RooCodeInc#5697)
  Add telemetry for todos (RooCodeInc#5746)
  feat: add undo functionality for enhance prompt feature (fixes RooCodeInc#5741) (RooCodeInc#5742)
  Fix max_tokens limit for moonshotai/kimi-k2-instruct on Groq (RooCodeInc#5740)
  Changeset version bump (RooCodeInc#5735)
  Add changeset for v3.23.12 patch release (RooCodeInc#5734)
  Update the max-token calculation in model-params to use the shared logic (RooCodeInc#5720)
  Changeset version bump (RooCodeInc#5719)
  chore: add changeset for v3.23.11 patch release (RooCodeInc#5718)
  Add Kimi K2 model and better support (RooCodeInc#5717)
  Fix: Remove invalid skip-checkout parameter from GitHub Actions workflows (RooCodeInc#5676)
  feat: add Cmd+Shift+. keyboard shortcut for previous mode switching (RooCodeInc#5695)
  Changeset version bump (RooCodeInc#5708)
  chore: add changeset for v3.23.10 patch release (RooCodeInc#5707)
  Add padding to the index model options (RooCodeInc#5706)
  fix: prioritize built-in model dimensions over custom dimensions (RooCodeInc#5705)
  Update CHANGELOG.md
  Changeset version bump (RooCodeInc#5702)
  chore: add changeset for v3.23.9 patch release (RooCodeInc#5701)
  Tweaks to command timeout error (RooCodeInc#5700)
  Update contributors list (RooCodeInc#5639)
  feat: enable Claude Code provider to run natively on Windows (RooCodeInc#5615)
  feat: Add configurable timeout for command execution (RooCodeInc#5668)
  feat: add gemini-embedding-001 model to code-index service (RooCodeInc#5698)
  fix: resolve vector dimension mismatch error when switching embedding models (RooCodeInc#5616) (RooCodeInc#5617)
  fix: [5424] return the cwd in the exec tool's response so that the model is not lost after subsequent calls (RooCodeInc#5667)
  Changeset version bump (RooCodeInc#5670)
  chore: add changeset for v3.23.8 patch release (RooCodeInc#5669)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Option for Automatic "Proceed Anyways" on Error Dialog

4 participants