fix: warm instructor mode registry to prevent thread-safety race condition#273
fix: warm instructor mode registry to prevent thread-safety race condition#273bsatapat-jpg wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 22 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a ChangesInstructor Registry Warmup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/lightspeed_evaluation/core/metrics/ragas.py`:
- Around line 41-50: The Instructor warmup in ragas.py relies on the private
mode_registry._lazy_loaders attribute and silently swallows skipped handlers.
Update the warmup to access _lazy_loaders via getattr(mode_registry,
"_lazy_loaders", None) before iterating, and in the
mode_registry.get_handlers(...) exception path replace the silent pass with a
debug log for KeyError and ImportError so skipped warmups are visible. Use the
existing import-time warmup block around mode_registry and get_handlers to
locate the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d9295ffd-79ac-4511-a7a5-63350f71cc54
📒 Files selected for processing (1)
src/lightspeed_evaluation/core/metrics/ragas.py
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def _warm_instructor_registry() -> None: |
There was a problem hiding this comment.
This is another workaround - we need to spend some time to redesign this..
How do we make sure it will work always ?
There was a problem hiding this comment.
The bug is in instructor>=1.15 — their ModeRegistry.get_handlers() does a non-atomic pop() + load() sequence without a lock.
Once instructlab fixes it, we can remove it out.
Wdyt?
There was a problem hiding this comment.
doing a version bump here #274 - check if that resolves this issue
|
@bsatapat-jpg Can we close this PR, as per your comment the issue is fixed by the version bump in #274 |
Yups it's fixed the issues. We can close it. |
Description
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit