Repository navigation
fix(evaluations): flush scores when batch fetching fails - #2064
Open
JackyHsu-X wants to merge 2 commits into
Open
JackyHsu-X wants to merge 2 commits into
JackyHsu-X wants to merge 2 commits into
Conversation
|
|
hassiebp
enabled auto-merge (squash)
October 28, 2026 09:33
Collaborator
|
thanks for your contribution! |
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?
When fetching an observations page exhausts its retries, batch evaluation returns an incomplete result and resume token before flushing scores from earlier pages. Flush before that return so the failure path honors the same end-of-run delivery behavior as successful runs.
Extend the existing recovery test to cover first-page and later-page failures, flushing before return, and successful resumption without skipping observations. A public-API reproduction against a local HTTP server produced two scores but delivered zero before return on unchanged code; with this change both are delivered and the score queue is empty.
Fixes langfuse/langfuse#19419
Type of change
Verification
uv sync --locked --python 3.13 uv run --frozen pytest tests/unit/test_batch_evaluation.py uv run --frozen ruff check . uv run --frozen ruff format --check langfuse/batch_evaluation.py tests/unit/test_batch_evaluation.py uv run --frozen mypy langfuse --no-error-summary uv run --frozen pre-commit run --files langfuse/batch_evaluation.py tests/unit/test_batch_evaluation.pyLANGFUSE_*settings were supplied for the prompt fixtures; no live Langfuse or model service was used.time.tzset. These unrelated tests are unchanged.Checklist
code_review.md..env.templateif needed. Existing public documentation already promises automatic flushing at the end of batch evaluation.AI assistance: OpenAI Codex investigated, generated and self-reviewed the patch, and ran the local checks under the account owner's authorization. No separate human review is claimed.


Confidence Score: 5/5
This PR appears safe to merge.Summary
Flushes queued scores before returning an incomplete batch result after page fetching fails.
Reviews (1) · Last reviewed commit: "fix(evaluations): flush scores when batc..." · Reviewed by Greptile