Roo Code
|
c5eb84b766
|
fix(embeddings): add timeouts, 5xx retry, and proper error messages for OpenAI Compatible embedder
Fix critical issues where the OpenAI Compatible Embedder would hang indefinitely
on unresponsive servers and not retry 5xx server errors.
Changes:
- Add 60s timeout to OpenAI SDK constructor (timeout: 60000, maxRetries: 0)
- Add AbortController with 60s timeout to makeDirectEmbeddingRequest()
- Convert AbortError to HTTP 504 (Gateway Timeout)
- Extend retry logic to handle 5xx errors (500-599) with exponential backoff
- Update validation error messages:
- 429 -> rateLimitExceeded
- 502 -> badGateway (new)
- 503 -> serviceUnavailable
- 504 -> gatewayTimeout (new)
- Other 5xx -> serverError (was configurationError)
- Add i18n translations for new error messages in 17 languages
- Add unit tests for timeout handling and 5xx retry (5 new tests)
- Add unit tests for getErrorMessageForStatus (10 new tests)
Impact:
- All OpenAI-compatible embedders benefit (Gemini, Mistral, VercelAiGateway, OpenRouter)
- No breaking changes - existing functionality preserved
- Prevents infinite waits on unresponsive embedding servers
- Clear error messages for 502/503/504 errors
Files changed: 21
- 2 source files (openai-compatible.ts, validation-helpers.ts)
- 17 i18n locale files (en, ru, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, tr, vi, zh-CN, zh-TW)
- 3 test files (openai-compatible.spec.ts, openai.spec.ts, validation-helpers.spec.ts)
Test results:
- code-index tests: 482 passed, 0 failed
- All project tests: 8210 total (8154 passed, 57 skipped, 0 failed)
- Test files: 582 (569 run, 13 skipped)
- Duration: 4m44s
|
2026-04-05 01:39:15 +03:00 |
|