fix(eval): thread-safe progress callbacks for --concurrency#1671
Open
macekond wants to merge 1 commit into
Open
fix(eval): thread-safe progress callbacks for --concurrency#1671macekond wants to merge 1 commit into
macekond wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1671 +/- ##
=======================================
Coverage 79.21% 79.21%
=======================================
Files 232 232
Lines 15809 15809
=======================================
Hits 12523 12523
Misses 3286 3286 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ad3d548 to
3f3f238
Compare
Wrap Rich Console.print() calls in _make_progress_callbacks with a threading.Lock. Without this, concurrent ThreadPoolExecutor workers deadlock when stdout is piped (e.g. background process). The lock serializes only the print calls — actual evaluation work remains fully concurrent. Add test_progress_callbacks_thread_safe to verify callbacks can be called from 8 concurrent threads without errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3f3f238 to
b526366
Compare
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.
Summary
Console.print()calls in_make_progress_callbackswiththreading.Lock--concurrency 2+with piped stdout (e.g. background processes)test_progress_callbacks_thread_safetestRoot Cause
_make_progress_callbackscreates closures that callconsole.print(). Whenrun_itemsdispatches toThreadPoolExecutor, multiple threads invoke these callbacks simultaneously. Rich Console is not safe for concurrent writes to piped stdout/stderr, causing a deadlock where the process hangs at 0% CPU with no output.The lock serializes only the
console.print()calls — actual evaluation work (AI chat, scoring) remains fully concurrent.Reproduction
Test plan
test_progress_callbacks_thread_safe— 8 concurrent threads calling all 3 callbacks 50 times--concurrency 4works on 10-item dataset with progress output--quietmode still works (callbacks are None, no lock needed)🤖 Generated with Claude Code