-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: improve Bedrock error handling for throttling and streaming contexts (#4745) #4748
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
Conversation
|
I have tested this and it works for me. |
- Throw enhanced error messages instead of original errors in createMessage() and completePrompt() - Users now see detailed error codes, request IDs, and troubleshooting guidance during retry countdowns - Add comprehensive tests to verify enhanced error messages flow to retry system - Resolves issue #4745 where retry messages only showed basic errors instead of verbose details
hannesrudolph
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.
Thanks for this PR! The implementation successfully addresses both issues from #4745:
✅ Throttling detection is improved with the new "Bedrock is unable to process your request" pattern
✅ Streaming error handling now properly differentiates between throttling and non-throttling errors
✅ Test coverage is comprehensive with 15 well-structured test cases
✅ Enhanced error messages provide valuable debugging information
The code quality is solid and the approach is sound. I've left a few comments for consideration:
- Pattern specificity for throttling detection
- Error property validation for robustness
- Verification of streaming behavior with retry mechanism
- Additional edge case test coverage
- Configurability of error message verbosity
These are mostly suggestions for potential improvements rather than blocking issues. The PR effectively solves the reported problems and improves the user experience when encountering AWS Bedrock throttling errors.
Great work on the comprehensive test suite - it really helps validate the implementation! 🎯
- Made 'unable to process your request' pattern more specific by removing generic version - Added property validation before accessing error properties to prevent undefined access - Added comment explaining streaming retry behavior for throttling errors - Added comprehensive edge case tests (concurrent errors, mixed scenarios, property validation) - Added configuration option awsBedrockVerboseErrors to control error message verbosity - Defaults to verbose errors for backward compatibility
|
✅ All review comments have been addressed in commit 72128ff:
All tests are passing and the code has been linted successfully. |
|
I noticed that the
Since the main goal of this PR is to improve throttling error detection and streaming error handling, I'd suggest removing the verbose error feature entirely for now. This would:
The improved error type detection and streaming error handling are valuable on their own. The verbose error feature could be added in a separate PR with proper UI controls if needed later. What do you think about removing the verbose error code and just keeping the improved error detection logic? |
hannesrudolph
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.
I've removed the verbose error logging as discussed. The error messages are now cleaner.
Regarding the other points:
- The type guards for
statusand$metadatawere already in place. - I've kept the
"unable to process your request"pattern for now as it's a specific message from Bedrock, but we can monitor for false positives. - I agree that tests for concurrent/mixed errors would be valuable and can be added in a follow-up PR to keep this one focused.
daniel-lxs
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.
I left 2 minor suggestions for this PR.
Basically just a bit of cleanup.
…ts for throttling errors
|
We have finished reviewing your PR. We have found no vulnerabilities. Reply to this PR with |
daniel-lxs
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.
Addressed the requested comments
LGTM
…exts (#4745) (#4748) Co-authored-by: Daniel Riccio <[email protected]>
…exts (RooCodeInc#4745) (RooCodeInc#4748) Co-authored-by: Daniel Riccio <[email protected]>
Description
Fixes #4745
This PR improves AWS Bedrock error handling by addressing two critical issues:
Changes Made
src/api/providers/bedrock.ts:src/api/providers/__tests__/bedrock-error-handling.spec.ts:Testing
Verification of Acceptance Criteria
Checklist
This fix significantly improves the user experience when encountering AWS Bedrock throttling errors by providing proper error identification, user guidance, and automatic retry functionality.
Important
Improves AWS Bedrock error handling by enhancing throttling detection and streaming error management, with comprehensive tests added.
bedrock.tsby recognizing "Bedrock is unable to process your request" as a throttling error.bedrock.tsto immediately throw throttling errors, enabling retry mechanisms.getErrorType()inbedrock.tsto prioritize error types and include new patterns for throttling and other errors.bedrock-error-handling.spec.tswith 15 test cases covering various error scenarios.This description was created by
for 88e2eae. You can customize this summary. It will automatically update as commits are pushed.
bedrock.retry.fix.mp4