← Back to Pull requests

fix(EventsCBGExecutor): always wakeup worker threads for ready entities in reentrant groups #3426

Closed
unknown closed this pull request without merging on Nov 24, 2026 16:19 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 22:06 UTC
Author

Description

CallbackGroupHandle::add_ready_entity only hands a callback group to the scheduler when the group is idle, which is correct for mutually exclusive groups, but not for reentrant ones.
If an entity of a reentrant group becomes ready while another entity of the same group is executing, the event is queued but no worker is woken.
It then only runs once the executing callback finishes, effectively serializing the group.

The flaky test reentract_callback_group_runs_concurrently hits this whenever the event for the second subscription arrives just after a worker has taken the first one. That window is wider on slow Debug builds (e.g. nightlies).. #3288 didn't fix this case.

This PR now always hands new work from a reentrant group to the scheduler and wakes a worker.
callback_group_ready already skips groups that are queued, and unblock_one_worker_thread skips the wakeup if a worker is already checking for work, so the extra calls ought to be safe.

Also added a more targeted regression test entity_ready_during_execution_runs_concurrently, which publishes the second message only after the first callback has started.

<!--
Please include a summary of the changes and the related issue.
Highlight any key points or areas of concern.
-->

<!--
Automatically closes linked issue when PR is merged.
Usage: Fixes #<issue number>, or Fixes (paste link of issue).

-->

Fixes #3328

Is this user-facing behavior change?

<!--
If no, just leave this section empty.
If yes, please explain how user-experience changes with this pull request.
-->

Yes: entities of a reentrant callback group now run in parallel even when they become ready while another entity of the group is executing.

Did you use Generative AI?

<!--
If this pull request was generated using Generative AI, please specify the tool and model used (e.g., GitHub Copilot, GPT-4.1).
If only specific parts were generated by Generative AI, please list those parts (e.g., function A, class B, etc.).
-->
Yes, Claude Opus 5.5

Additional Information

<!--
If applicable, provide any additional context or details about the changes.
-->

Diff: 268 lines (+201 / -67) across 3 files Reviewer: jmachowinski Review duration: 5413m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 268 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.335
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3426"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.4% (MEDIUM) · Higher = larger blast radius
39.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.6% · Safe to merge
15.6%
Repository