Repository navigation
Conversation
KXHXK
marked this pull request as ready for review
July 25, 2026 16:06
Contributor
|
Thanks a lot for this, @KXHXK — clean diagnosis in #1068 and a correct fix. I've taken it forward in #1072, which keeps your commit and authorship and adds some hardening on top: a deterministic version of your regression test (the valid task is now released from inside Closing this one in favor of #1072 — the fix and the credit are yours. Much appreciated! |
pchalasani
added a commit
that referenced
this pull request
Jul 25, 2026
…esult (#1072) * fix(batch): wait for first non-None result when stop_on_first_result Original work from PR #1069 (fixes #1068). * fix: address review findings * docs+test: document stop_on_first_result semantics; cover exception path * docs: clarify stop_on_first_result with RETURN_EXCEPTION * docs: add batch processing note covering stop_on_first_result * docs: correct run_batch_tasks exception-handling note --------- Co-authored-by: KXH <[email protected]>
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
NoneNoneresult is available, preserving its original input positionRoot cause
The
stop_on_first_resultbranch calledasyncio.wait(..., FIRST_COMPLETED)only once. Itsfinallyblock then cancelled every pending task even when all completed tasks had producedNone, contrary to the documented behavior of continuing until a valid result is obtained.The branch now waits repeatedly on the remaining task set. Existing exception handling and cleanup stay in the same paths.
Fixes #1068
Validation
pytest tests/main/test_batch.py -k "process_batch_async" -q(9 passed)ruff check langroid/agent/batch.py tests/main/test_batch.pygit diff --check