[BugFix] Bind a PPL query to its task whichever plugin sent it #5934
All Vouch review confidence checks passed
Residual risk 0.15 = 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 · 247 lines diff across 3 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
Diff Size
diff_size
0.330
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5934"
general
weight: 0.35
Swiddis
Description
A PPL query sent by another plugin is never linked to its task, so it can't be cancelled and its searches have no parent.
TransportPPLQueryActionbound the task only when it was this plugin's own class:Alerting PPL monitors and Skills PPL tools bundle their own copy of the SQL classes rather than extending
opensearch-sql, so core builds the task from the caller'sTransportPPLQueryRequestand hands back the caller'sPPLQueryTask— a different class, loaded by a different classloader. The check fails and the thread local is never set.Two things follow:
POST _tasks/<id>/_cancelmarks the task cancelled, but the query keeps runningCheck for
CancellableTaskinstead. It comes from the server classloader, so it's the same class in every plugin. Nothing on this path needsPPLQueryTaskspecifically:QueryProgressTracker#attachalready takes aCancellableTask, andCancellableTask#cancel(String)is public.Related Issues
Resolves #5911
Related: #5933 makes the query timeout cancel the task, which only helps these callers once the task is bound.
Check List
--signoff.Tests
TransportPPLQueryActionCancellationTestgains a case that submits aCancellableTaskwhich is not aPPLQueryTask, standing in for the copy another plugin's classloader creates, and asserts the runner still cancels it. The existing case rejecting a task that isn't cancellable at all keeps its coverage.