fix(corpus): limit contradiction detector LLM concurrency#245
Conversation
|
/oc review pr |
Co-authored-by: himanshu231204 <himanshu231204@users.noreply.github.com>
|
Trivial one-character fix applied ( Review summary
Suggested follow-ups (optional)
|
|
Suggested follow-ups (optional) |
|
Addressed the concurrency test feedback — the assertion now verifies that concurrent calls are actually occurring while remaining bounded by detector.max_concurrency. All targeted checks pass locally: 9/9 contradiction detector tests Regarding retry/exponential backoff: I’ve kept it out of this PR to keep the change focused on bounded concurrency. Since retry behavior introduces additional policy decisions (retryable exceptions, backoff timing, maximum attempts, provider-specific rate-limit handling), I think it would be cleaner to address that as a separate follow-up issue/PR if desired. Thanks for the review and suggestions! |
|
/oc review pr |
Review SummaryChanges: What's correct
Minor observations (non-blocking)
VerdictApproved. All functional changes are correct, the test validates the right invariant, and the scope is appropriate for the issue. |
|
🎉 Congratulations @Nithin00614! Your pull request has been successfully merged into main. 🚀 Thank you for contributing to OpenAgentHQ and helping improve the project. We truly appreciate your contribution and hope to see you back with more amazing PRs! Happy Open Sourcing! ❤️ |


Summary
Fixes #58.
Adds bounded concurrency to
ContradictionDetectorto prevent all document-pair LLM requests from being executed simultaneously.Previously, the detector created up to
max_pairsLLM calls at once usingasyncio.gather(). With the defaultmax_pairs=50, this could result in up to 50 concurrent requests, increasing the likelihood of provider rate limits and excessive resource usage.Changes
max_concurrencyparameter with a default of5asyncio.Semaphoreto limit simultaneous LLM requestsmax_pairsbehaviorTesting
Verified with:
uv run pytest tests/unit/test_corpus/test_contradiction.py -vuv run ruff check openagent_eval/corpus/contradiction.py tests/unit/test_corpus/test_contradiction.pyuv run mypy openagent_eval/corpus/contradiction.pyNotes
This change limits concurrency but does not introduce retry/backoff behavior. Retry handling can be added separately if desired.