ReMe/reme
BeiMu-new 930fddc4d2 fix(embedding): retry SDK transport failures instead of splitting the batch
Third review follow-up on #579.

`_call_with_retry` only caught the built-in `TimeoutError`, `ConnectionError`
and `OSError`. `openai.APIConnectionError` and `openai.APITimeoutError` do not
inherit from any of them (they go APIError -> OpenAIError -> Exception), so
they reached the generic handler: `_is_provider_wide_failure()` did not
recognize them either, and a multi-item request fanned out into per-item
requests that failed for exactly the same reason. The same gap meant a
single-item request got no ReMe-level retry at all after a transport failure.

Transport failures are now recognized by a dedicated classifier,
`_is_transient_transport_failure()`, covering the built-in socket errors as
well as the SDK/httpx exception types (matched across the MRO, so subclasses
such as `APITimeoutError` are included) without importing the provider SDK.
They retry the original request with the existing backoff and never split; the
retry budget is unchanged.

Regression coverage:
- test_sdk_transport_errors_are_retried_without_splitting
  APIConnectionError / APITimeoutError -> batch sizes [10, 10, 10], sleeps
  [1.0, 2.0], then failure with no single-item requests.
- test_sdk_transport_error_recovers_without_losing_the_batch
  one APITimeoutError then success -> [[1.0, 0.0]] * 10, batch sizes [10, 10].
- test_isolated_item_retries_an_sdk_transport_error
  context-length rejection, then APIConnectionError on one isolated item ->
  that item's vector is retained.
The existing context-length, 401/403, 5xx, quota and rate-limit tests are
retained.

Local verification with the repo's own hook arguments:
  pylint -> Your code has been rated at 10.00/10, exit 0
  black  -> 2 files would be left unchanged
  flake8 -> clean

Branch-order discriminator check (classifiers extracted from the production
file and executed against each error type):

  case                      old     new
  400 context-length        SPLIT   SPLIT
  401 / 403                 SPLIT   STOP
  500                       SPLIT   RETRY
  SDK APIConnectionError    SPLIT   RETRY
  SDK APITimeoutError       SPLIT   RETRY
  builtin ConnectionError   RETRY   RETRY
  builtin TimeoutError      RETRY   RETRY
  429                       RETRY   RETRY
  insufficient_quota        STOP    STOP
2026-10-16 21:10:38 +08:00
..
components fix(embedding): retry SDK transport failures instead of splitting the batch 2026-10-16 21:10:38 +08:00
config fix(search): accept CLI queries that look like numbers (#612) 2026-10-16 10:36:05 +08:00
enumeration feat(classifier): add optional Jev component and service demo (#619) 2026-10-14 17:49:49 +08:00
schema feat(jobs): add a unified enabled switch for all job types (#580) 2026-09-30 18:30:36 +08:00
steps fix(auto-dream): checkpoint scanned source versions (#618) 2026-10-16 12:13:48 +08:00
utils feat(token counter): add Qwen token counting utility with fallback (#616) 2026-10-16 11:58:35 +08:00
__init__.py chore: release 0.4.2.0 and simplify publishing workflows (#631) 2026-10-16 16:53:52 +08:00
application.py feat(docker): add container deployment and multi-platform release workflow (#582) 2026-10-03 23:54:58 +08:00
constants.py feat(service): support explicit wildcard network binds (#547) 2026-09-15 14:26:33 +08:00
entry_point.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
plugin.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
plugin_cli.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
plugin_manifest.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
reme.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00