Fix decouple bug when a failure in a TaskGroup triggers cancellation #324
All Vouch review confidence checks passed
Residual risk 0.12 = Change Risk (0.29) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.29 · 80 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Shallow Review Depth
shallow_review_depth
0.289
Diff Size
diff_size
0.263
Real PR Conversation Timeline
1 comments
"Review active on #324"
general
weight: 0.35
anbuzin
When a child task in a TaskGroup fails, the parent task gets cancelled.
If decouple is used with a generator that yields from inside a task group,
it is possible that the worker task will be cancelled while it is waiting
on the semaphore inside
worker(), and not while blocked somewhere insidethe generator.
What we need to do is catch the CancelledError and then recancel
ourselves so that it gets fed back into the generator.
We want to maintain lockstep semantics, so we do another wait on the
sem there, and have to handle the other two cases we may have been
cancelled: this decouple is being closed and all tasks are
cancelled.