- Notifications
You must be signed in to change notification settings - Fork 0
Fixed bugs #19
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?
Fixed bugs #19
Conversation
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.
Bug: Retry Logic Fails Due to String Parsing
The retry logic in PersonaService._make_request_with_retry is unreliable. It attempts to determine retryable HTTP errors by parsing status codes from PersonaError string messages. However, _make_request converts aiohttp.ClientResponseError into PersonaError with inconsistent string formats (e.g., "Rate limit exceeded" for 429, or generic "API error: {error_text}" for 5xx codes), losing the original status code. This brittle string matching can lead to incorrect retry decisions, including false positives or failures to retry.
pipeiq_framework/persona_client/persona_service.py#L436-L447
pipeiq-framework/pipeiq_framework/persona_client/persona_service.py
Lines 436 to 447 in 164212c
| # Check if this is a wrapped HTTP error that we should retry | |
| should_retry = False | |
| # Extract status code if it's a rate limit or server error | |
| if "Rate limit exceeded" in str(e): | |
| should_retry = 429 in self.retry_config.retry_on_status_codes | |
| elif "API error" in str(e) and any(code_str in str(e) for code_str in ["500", "502", "503", "504"]): | |
| # Try to extract the actual status code from error message | |
| for code in self.retry_config.retry_on_status_codes: | |
| if str(code) in str(e): | |
| should_retry = True | |
| break |
Bug: RateLimiter Timestamp Update Error
The RateLimiter incorrectly updates its last_update timestamp. When a request is delayed due to insufficient tokens, last_update is set to the time before the asyncio.sleep() call. This causes subsequent token bucket calculations to be inaccurate, potentially over-crediting tokens and allowing the system to exceed the configured rate limit.
pipeiq_framework/persona_client/persona_service.py#L211-L213
pipeiq-framework/pipeiq_framework/persona_client/persona_service.py
Lines 211 to 213 in 164212c
| self.tokens -= 1 | |
| self.last_update = now |
Bug: Custom Exception Conflicts with Built-in Class
The custom ConnectionError class shadows Python's built-in ConnectionError exception, leading to a naming collision. This causes confusion and potential misbehavior in error handling, as code expecting to catch the standard library's ConnectionError may incorrectly catch the custom one, or vice versa. The custom exception should be renamed (e.g., PersonaConnectionError) to resolve this conflict.
pipeiq_framework/persona_client/persona_service.py#L319-L322
pipeiq-framework/pipeiq_framework/persona_client/persona_service.py
Lines 319 to 322 in 164212c
| class ConnectionError(PersonaError): | |
| """Raised when there's an error connecting to Persona.""" | |
| pass |
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.