Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 30, 2025

Related GitHub Issue

Closes: #10202

Description

This PR attempts to address Issue #10202 where rate limiting messages were incorrectly shown as API errors in the webview.

Changes:

  1. Created RateLimitCountdown component (webview-ui/src/components/chat/RateLimitCountdown.tsx)

    • A dedicated component for displaying user-configured rate limiting countdown
    • Uses informational styling (Timer icon, muted/gray text) instead of error styling
    • Shows countdown in seconds format: "Rate limiting: Xs"
  2. Modified ChatRow.tsx

    • Added detection for rate limiting messages that start with "Rate limiting for"
    • When detected, extracts countdown seconds and renders RateLimitCountdown instead of ErrorRow
    • Actual API errors continue to use the existing ErrorRow component
  3. Added translation key in locales/en/chat.json

    • chat:rateLimit.countdown: "Rate limiting: {{seconds}}s"
  4. Added tests for the new RateLimitCountdown component

Why this approach:

  • Clean separation: Rate limiting is treated as expected user-configured behavior with its own UI, while actual API errors continue using ErrorRow
  • Better UX: Users see an informational countdown instead of alarming red error text
  • Minimal backend changes: No changes needed to Task.ts - the frontend interprets the existing message pattern differently

Feedback and guidance are welcome.

Test Procedure

  1. Go to Settings > Providers
  2. Open Advanced Settings
  3. Set Rate Limit to 10s
  4. Make API requests

Expected result: Shows informational countdown with clock icon and muted text
Previous behavior: Showed red API error text with error icon

Automated tests:

cd webview-ui && npx vitest run src/components/chat/__tests__/RateLimitCountdown.spec.tsx

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.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This implementation follows the revised solution discussed in Issue #10202, creating a dedicated RateLimitCountdown component with informational styling instead of modifying the text content of the existing error display.

…f error

- Create RateLimitCountdown component with informational styling
- Detect rate limiting messages in ChatRow and render new component
- Add translation key for rate limiting countdown message
- Add tests for RateLimitCountdown component

Fixes #10202
@roomote
Copy link
Contributor Author

roomote bot commented Dec 30, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The refactoring cleanly separates rate limiting (user-configured expected behavior) from actual API errors by:

  • Adding a dedicated api_req_rate_limited message type in the types package
  • Backend sends just the countdown seconds, frontend formats with i18n
  • Using the dedicated RateLimitCountdown component with informational styling
  • Properly integrating with evals logging
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@mrubens
Copy link
Collaborator

mrubens commented Dec 30, 2025

@roomote looking at the error message to differentiate is ugly. This should be a different message type.

@roomote
Copy link
Contributor Author

roomote bot commented Dec 30, 2025

Fixaroo Clock   See task on Roo Cloud

Fixed by adding a dedicated api_req_rate_limited message type instead of string-matching on error messages. All local checks passed.

View commit | Revert commit

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 30, 2025
@rossdonald
Copy link

I tried the changes, it looks fine. After it is done rate limiting the message "Rate limiting: 1s" stays in the chat. I'm not sure if it is supposed to disappear or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Rate limiting messages are shown as API errors in webview

5 participants