Repository navigation
fix(batch-evaluation): keep paging past empty observation pages - #2097
Merged
hassiebp merged 2 commits intoNov 5, 2026
Merged
Conversation
Since langfuse/langfuse#19043, GET /api/public/v2/observations can return an empty page with meta.cursor set when its scan deadline passes. The run stopped on any empty page and reported itself complete with no resume token, silently skipping the remaining observations. Stop only when the cursor is absent, and keep the cross-page dedupe state across empty pages.
This was referenced Nov 5, 2026
DavidTraina
marked this pull request as ready for review
November 5, 2026 06:55
|
|
hassiebp
enabled auto-merge (squash)
November 5, 2026 09:08
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?
Since langfuse/langfuse#19043,
GET /api/public/v2/observationscan return an empty page that still hasmeta.cursor. This happens when the server's 45 s scan budget runs out (or a later scan window times out) after at least one window completed without matches. The route addsmeta.commentto say so: "This empty page does not indicate completion. Continue requesting pages using meta.cursor."run_batched_evaluationstopped onif cursor is None or not items:. On such a page it returnedcompleted=True,has_more_items=Falseand no resume token, so every older observation was skipped without any signal.Fix
previous_page_idsonly for pages with items. Otherwise an empty page clears the cross-page dedupe set and the resume token'slast_page_ids.test_duplicate_rows_split_across_an_empty_page_are_evaluated_oncecovers this: a duplicate row on either side of an empty page is scored once.The loop still terminates: the server returns a strictly lower cursor on every page. Older servers, and servers with
LANGFUSE_OBSERVATIONS_V2_ADAPTIVE_SCAN_ENABLED=false, return a cursor only when more rows exist, so nothing changes for them.With the default 5 s client timeout, most slow pages fail with a client timeout before the server can answer with an empty page. #2096 covers that. Once the timeout is long enough, this bug silently drops data, so the two fixes are independent.
Related PRs
Independent follow-ups to langfuse/langfuse#19043, mergeable in any order: #2096 (batch evaluation fetch timeout), #2098 (docs), #2099 (test helpers), #2101 (pagination helper).
Type of change
Verification
List the main commands you ran:
Checklist
code_review.md..env.templateif needed.The PR appears safe to merge, with a non-blocking test gap around keeping IDs across empty pages.
Summary
Batch evaluation now continues past empty observation pages when
meta.cursoris present.Reviews (1) · Last reviewed commit: "fix(batch-evaluation): keep paging past ..." · Reviewed by Greptile