mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-02-01 23:13:36 +00:00
fix: address 3 new CodeRabbit review comments
1. agent.py: Reset opposite retry counter when entering rate_limit or error status to prevent mixed events from inflating delays 2. rate_limit_utils.py: Fix parse_retry_after() regex to reject minute/hour units - patterns now require explicit "seconds"/"s" unit or end of string 3. test_rate_limit_utils.py: Add tests for "retry after 5 minutes" and other minute/hour variants to ensure they return None Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
4
agent.py
4
agent.py
@@ -372,6 +372,8 @@ async def run_autonomous_agent(
|
||||
|
||||
elif status == "rate_limit":
|
||||
# Smart rate limit handling with exponential backoff
|
||||
# Reset error counter so mixed events don't inflate delays
|
||||
error_retries = 0
|
||||
if response != "unknown":
|
||||
try:
|
||||
delay_seconds = clamp_retry_delay(int(response))
|
||||
@@ -390,6 +392,8 @@ async def run_autonomous_agent(
|
||||
|
||||
elif status == "error":
|
||||
# Non-rate-limit errors: linear backoff capped at 5 minutes
|
||||
# Reset rate limit counter so mixed events don't inflate delays
|
||||
rate_limit_retries = 0
|
||||
error_retries += 1
|
||||
delay_seconds = calculate_error_backoff(error_retries)
|
||||
print("\nSession encountered an error")
|
||||
|
||||
Reference in New Issue
Block a user