Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(llm_config): extend retry delays to respect rate limit windows (#9489)

llamantino0651c51901aa
diff --git a/openhands/core/config/llm_config.py b/openhands/core/config/llm_config.py
index 2706fc5fb8..d05037bde4 100644
--- a/openhands/core/config/llm_config.py
+++ b/openhands/core/config/llm_config.py
@@ -57,11 +57,11 @@ class LLMConfig(BaseModel):
aws_region_name: str | None = Field(default=None)
openrouter_site_url: str = Field(default='https://docs.all-hands.dev/')
openrouter_app_name: str = Field(default='OpenHands')
- # total wait time: 5 + 10 + 20 + 30 = 65 seconds
- num_retries: int = Field(default=4)
- retry_multiplier: float = Field(default=2)
- retry_min_wait: int = Field(default=5)
- retry_max_wait: int = Field(default=30)
+ # total wait time: 8 + 16 + 32 + 64 = 120 seconds
+ num_retries: int = Field(default=5)
+ retry_multiplier: float = Field(default=8)
+ retry_min_wait: int = Field(default=8)
+ retry_max_wait: int = Field(default=64)
timeout: int | None = Field(default=None)
max_message_chars: int = Field(
default=30_000
diff --git a/tests/unit/test_llm_config.py b/tests/unit/test_llm_config.py
index 6aa6164d28..501afe2296 100644
--- a/tests/unit/test_llm_config.py
+++ b/tests/unit/test_llm_config.py
@@ -175,7 +175,7 @@ api_key = "custom-only-api-key"
custom_only = default_config.get_llm_config('custom_only')
assert custom_only.model == 'custom-only-model'
assert custom_only.api_key.get_secret_value() == 'custom-only-api-key'
- assert custom_only.num_retries == 4 # default value
+ assert custom_only.num_retries == 5 # default value
def test_load_from_toml_llm_invalid_config(