Fix flushing causing delays in evals that don't use traces - #220
Merged
Merged
Conversation
David Elner (delner)
force-pushed
the
fix/eval-trace-flush-delays
branch
from
September 23, 2026 18:39
36c4cbc to
d1080a5
Compare
Stephen Belanger (Qard)
approved these changes
Sep 23, 2026
Abhijeet Prasad (AbhiPrasad)
approved these changes
Sep 23, 2026
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.
Fixes #210.
What happened
Every eval case called
force_flushsynchronously between task and scorers. A customer measured 10-25s per call on a 139-case eval — most of a ~24 minute run.The flush exists so a scorer declaring
trace:can BTQL-query that case's spans while they're fresh. It ran unconditionally, including when nothing in the eval touchestrace:.How this fixes it
Scorers and classifiers already expose
#call_parameters(used byKeywordFilterto drop undeclared kwargs).Runnerreuses it to decide once whether anything can receivetrace:, then gates the per-case work:Gating on
kase.tracealso skips local-only evals, wherebuild_tracereturnsnil.**kwargscallables count as consumers since they may forwardtrace:. No false negatives —KeywordFilterslices kwargs to declared keys, sotrace:can't arrive undeclared.Two supporting changes:
wrap_blockrewrote them as->(**kw), which reads as "accepts anything" — so every legacy scorer would have kept flushing. Wrappers now declare the keywords they forward. Behavior unchanged;KeywordFilteralready sliced those kwargs.Runner#run.Trace.setuponly registers theat_exithook when it owns the provider, so callers passing their owntracer_provider:relied on the per-case flush for delivery. N flushes become 1, and it covers the last case's spans, which the per-case flush never reached.