Skip to content

Commit 1abbaeb

Browse files
author
Mateusz
committed
fix(warmup): reduce log noise for expected warm-up failures
Log LLMProxyError and common transport errors without exc_info on retry attempts; keep full tracebacks for unexpected exceptions. Add RateLimitExceededError retry classification test. Made-with: Cursor
1 parent 0ff198f commit 1abbaeb

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/core/services/usage_window_warmup_service.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,33 @@ async def _execute_single_target(
249249
)
250250
except asyncio.CancelledError:
251251
raise
252-
except Exception as exc:
252+
except (LLMProxyError, ConnectionError, OSError, TimeoutError) as exc:
253+
# Expected warm-up failures (rate limits, routing, transport): log the
254+
# message only — full tracebacks here are noisy in production logs.
253255
retryable = self._is_retryable_error(exc)
254256
logger.warning(
255257
"Usage window warm-up attempt %d/2 failed for '%s' target '%s': %s",
256258
attempt,
257259
entry.model,
258260
target_label,
259261
exc,
262+
)
263+
if not retryable or attempt >= 2:
264+
logger.error(
265+
"Usage window warm-up exhausted attempts for '%s' target '%s'",
266+
entry.model,
267+
target_label,
268+
)
269+
return
270+
except Exception as exc:
271+
retryable = self._is_retryable_error(exc)
272+
logger.error(
273+
"Unexpected error during usage window warm-up attempt %d/2 "
274+
"for '%s' target '%s': %s",
275+
attempt,
276+
entry.model,
277+
target_label,
278+
exc,
260279
exc_info=True,
261280
)
262281
if not retryable or attempt >= 2:

tests/unit/core/services/test_usage_window_warmup_service.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
from unittest.mock import AsyncMock
66

77
import pytest
8-
from src.core.common.exceptions import BackendError, RoutingError
8+
from src.core.common.exceptions import (
9+
BackendError,
10+
RateLimitExceededError,
11+
RoutingError,
12+
)
913
from src.core.domain.chat import ChatMessage
1014
from src.core.domain.configuration.usage_window_warmup_config import (
1115
UsageWindowWarmupConfig,
@@ -435,6 +439,12 @@ def test_is_retryable_error_classifies_errors_correctly(self) -> None:
435439
)
436440
is True
437441
)
442+
assert (
443+
UsageWindowWarmupService._is_retryable_error(
444+
RateLimitExceededError("Rate limit reached for requests")
445+
)
446+
is True
447+
)
438448

439449
# LLMProxyError with retryable flag
440450
assert (

0 commit comments

Comments
 (0)