ReMe/tests
Amir Fathi 36e3a87c75
fix(embedding): retry 429 rate-limit errors instead of dropping the batch (#525)
* fix(embedding): retry 429 rate-limit errors instead of dropping the batch

openai.RateLimitError is not a TimeoutError/ConnectionError/OSError, so
_call_with_retry's except Exception branch caught it and returned None on
the first attempt with zero backoff. Add _is_rate_limited, mirroring the
existing _is_insufficient_quota duck-typed check, and retry a 429 with the
same exponential backoff used for network errors.

* fix(embedding): insufficient_quota errors carrying status_code=429 no longer bypass quota handling

_is_rate_limited() checked status_code == 429 first, so an OpenAI-compatible
insufficient_quota error (which also carries status_code=429) matched the
generic rate-limit branch before the code=insufficient_quota check ever ran.
That meant a real quota exhaustion retried on the wrong backoff (or not at
all, when quota_retry_delay is unset) instead of the dedicated quota_retry_delay
wait.

_is_rate_limited() now defers to _is_insufficient_quota() first. The existing
quota test double now sets status_code=429 to match the real OpenAI error
shape, which is what exposes the regression without the fix.

Signed-off-by: Amir Fathi <amirfathi.me@gmail.com>

* fix(embedding): log rate-limit retries

---------

Signed-off-by: Amir Fathi <amirfathi.me@gmail.com>
Co-authored-by: jinli.yl <jinli.yl@alibaba-inc.com>
2026-09-07 14:31:48 +08:00
..
fixtures/config fix(ci): support AgentScope 2.0.6 initialization (#457) 2026-08-19 11:33:52 +08:00
integration feat(auto_resource): interpret image resources into daily notes (#500) 2026-09-07 12:00:38 +08:00
unit fix(embedding): retry 429 rate-limit errors instead of dropping the batch (#525) 2026-09-07 14:31:48 +08:00