-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: use task stored API config as fallback for rate limit #10266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When provider state is unavailable (state is undefined/null), fall back to the task's stored apiConfiguration for rate limiting instead of defaulting to 0. This prevents rate limiting from being silently disabled in edge cases where getState() fails or provider reference is temporarily lost. Changes: - Line 3643 (attemptApiRequest): Use (apiConfiguration ?? this.apiConfiguration) - Line 3974 (backoffAndAnnounce): Use (state?.apiConfiguration ?? this.apiConfiguration) Both locations now follow the same pattern: 1. Prefer the most up-to-date config from provider state 2. Fall back to task's stored config if state unavailable 3. Only default to 0 if neither source has a config
Review complete. No issues found. The changes correctly implement a fallback mechanism for rate limiting when provider state is unavailable:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
Review complete. No issues found. The changes correctly implement a fallback mechanism for rate limiting when provider state is unavailable:
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine, but why do we ever use apiConfiguration from state? Should we not just use this.apiConfiguration everywhere?
|
@mrubens |
Fixes a bug where rate limiting would be silently disabled in edge cases when provider state is unavailable.
Problem
In Task.ts, the rate limit is read from the provider state in two locations:
attemptApiRequestbackoffAndAnnounceWhen
stateis undefined/null (provider reference lost orgetState()fails), the rate limit defaults to 0, effectively disabling rate limiting.Solution
Use the task's stored configuration as a fallback:
This ensures:
Impact
This bug rarely manifests since
getState()usually succeeds. However, in edge cases where the provider reference is temporarily unavailable, users' configured rate limits would be silently ignored, potentially causing API rate limit errors.Testing
View task on Roo Code Cloud
Important
Fixes rate limiting bug in
Task.tsby using task's stored configuration as fallback when provider state is unavailable.Task.tswhere rate limiting was disabled when provider state was unavailable.attemptApiRequestandbackoffAndAnnounce.This description was created by
for f3caed7. You can customize this summary. It will automatically update as commits are pushed.