Repository navigation
fix(ingestion): do not retry score batches on 207 partial failure - #1968
Open
moneebullah25 wants to merge 3 commits into
Open
moneebullah25 wants to merge 3 commits into
moneebullah25 wants to merge 3 commits into
Conversation
moneebullah25
force-pushed
the
fix/score-ingestion-207-partial-failure
branch
2 times, most recently
from
October 9, 2026 10:18
bf505ce to
1f54288
Compare
This branch has not been deployed
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.
What does this PR do?
A 207 ingestion response with per-item errors raises
APIErrors, which is not anAPIError. The score consumer therefore treated it as a generic failure and re-POSTed the whole batch up to 3 times, and the per-item details only reached DEBUG.This catches
APIErrorsinScoreIngestionConsumer._upload_batch, logs one WARNING with the rejected count and up to 5 per-item messages (escaped, truncated to 200 chars), and does not retry. The "Successfully sent" debug line now only fires on real success.Known limitation (noted in a code comment): per-item 429/5xx entries inside a 207 are not retried individually, since
APIErrorsdoes not carry the item id yet. The separate 4xx batch drop is intentionally not touched.Fixes #1965
Type of change
Verification
List the main commands you ran:
.venv/bin/ruff check . .venv/bin/ruff format --check langfuse tests/unit/test_resource_manager.py .venv/bin/mypy langfuse --no-error-summary .venv/bin/pytest tests/unit/test_resource_manager.py -q .venv/bin/pytest tests/unit/test_otel.py -q .venv/bin/pytest -n auto --dist worksteal tests/unitNotes:
uv runcould not be used locally (installed uv 0.9.8 cannot parse this repo'suv.lock/exclude-newer), so tools were run from a venv with the project installed.ruff checkpasses;mypyreports no errors in the changed file (existing errors elsewhere come from the missing langchain/openai dev extras locally);test_resource_manager.py13 passed,test_otel.py65 passed. The full unit run had failures/errors only in modules needing the uninstalled langchain/openai extras (test_prompt, test_langchain, test_openai, etc.) andtest_media.pyhas a pre-existing format diff; CI should cover those.Checklist
code_review.md..env.templateif needed.The PR appears safe to merge, with a non-blocking gap in tests for the changed logs.
Summary
Stops retrying whole score batches after a 207 response with item errors.
Acknowledged limitations:
APIErrorsdoes not carry item IDs.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Send batch] --> B{Result} B -->|Success| C[Log success] B -->|207 with item errors| D[Log bounded warning; do not retry] B -->|Non-rate-limit 4xx| E[Do not retry] B -->|Other failure| F[Retry within existing limit] C --> G[Mark queue items done] D --> G E --> G F --> GReviews (1) · Last reviewed commit: bf505ce · Reviewed by Greptile