feat(semantic): add exponential backoff retry for LLM rate limiting#889
Closed
mvanhorn wants to merge 1 commit intovolcengine:mainfrom
Closed
feat(semantic): add exponential backoff retry for LLM rate limiting#889mvanhorn wants to merge 1 commit intovolcengine:mainfrom
mvanhorn wants to merge 1 commit intovolcengine:mainfrom
Conversation
Wrap LLM calls in semantic_processor.py with retry logic that handles 429/TooManyRequests/RequestBurstTooFast errors with exponential backoff and jitter. Previously, a single rate limit error during batch ingestion caused permanent failure. Now retries up to 3 times with delays of 0.5s, 1s, 2s before giving up gracefully. Addresses the ingestion pain reported in volcengine#350 where 4435 sections trigger RequestBurstTooFast with Doubao 2.0. Relates to volcengine#350 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 task
|
Failed to generate code suggestions for PR |
Collaborator
|
Thanks for the PR. The problem it targets is real, and the retry behavior here is useful, especially for handling rate-limited semantic indexing workloads. We’re going to close this PR for now, not because the approach is wrong, but because we want to address retry at a lower level instead of adding more business-layer wrappers like Our follow-up plan is to unify retry handling across both VLM and embedding paths:
That said, we do want to borrow from this PR’s design, especially:
Thanks again for the contribution. We’ll use this as input for the broader retry refactor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add retry with exponential backoff for LLM calls in the semantic processor. When rate-limited (429/TooManyRequests/RequestBurstTooFast), calls now retry up to 3 times with increasing delays (0.5s, 1s, 2s + jitter) instead of failing permanently.
Related Issue
Relates to #350
Type of Change
Changes Made
_llm_with_retry()helper toSemanticProcessorclassvlm.get_completion_async()calls with retrying wrapperimport randomfor jitter calculationWhy this matters
Users batch-indexing large directories hit
RequestBurstTooFast429 errors from LLM providers during summarization. @sponge225 reported in #350 that 281 Markdown files (4,435 sections) consistently trigger rate limiting with Doubao 2.0, causing partial indexing failures.The embedding path already has
exponential_backoff_retryinvolcengine_embedders.py, but the LLM summarization path insemantic_processor.pyhad zero retry logic. A prior attempt to add this (PR #568) was closed because the contributor didn't sign the CLA, not because of technical rejection.The retry helper detects rate limit errors by checking for "429", "TooManyRequests", "RateLimit", and "RequestBurstTooFast" in the exception string, matching the pattern used in
volcengine_embedders.py:is_429_error(). On persistent failure, it returns an empty string for graceful degradation (the file gets indexed without a summary rather than crashing the pipeline).Testing
Post-build dogfooding skipped (score 6/10). Tested via code review and ruff linting only. Full OpenViking install requires system dependencies not available in this environment.
This contribution was developed with AI assistance (Claude Code).