← Back to Pull requests

fix: Stop HttpRemoteTaskRunner from launching tasks killed while pending #20740

Closed
unknown closed this pull request without merging on Oct 28, 2026 15:56 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 20:17 UTC
Author

Fixes #20298.

Description

A task killed while waiting for a task slot could still be launched by HttpRemoteTaskRunner. TaskQueue.shutdown() marks the task FAILED, releases its locks and calls TaskRunner.shutdown(), but HttpRemoteTaskRunner.shutdown() ignored PENDING and PENDING_WORKER_ASSIGN work items. The pending task executor then assigned the task to the next free worker, where it ran until the next storage sync dropped the queue entry and the Overlord shut it down again. It also kept showing up in getPendingTasks().

shutdown() now removes a PENDING work item from pendingTaskIds under statusLock, then completes it with a FAILED status outside the lock, as taskComplete(...) requires. The item stays in tasks as COMPLETE, like a task a worker reported finished, and the next shutdown() call from TaskQueue removes it. TaskQueue's callback for the FAILED future returns early because the entry is already complete.

A PENDING_WORKER_ASSIGN item is only removed from pendingTaskIds, so it cannot be assigned again. Its state belongs to the thread that is assigning it, which may revert it to PENDING outside statusLock; completing it from shutdown() would race with that revert. If the worker starts the task, the next shutdown() call from TaskQueue finds it RUNNING and kills it on the worker. If the assignment fails, the item goes back to PENDING and the next shutdown() call completes it.

This is a regression from #13558, which stopped shutdown() from removing every work item from tasks so that running tasks keep their completion callbacks.

Release note

Fixed an issue where a task killed while waiting for a task slot could still be launched on a Middle Manager or Indexer when the Overlord uses the httpRemote task runner (the default).

<hr>

##### Key changed/added classes in this PR
* HttpRemoteTaskRunner

<hr>

This PR has:

  • been self-reviewed.

  • - [x] using the concurrency checklist (Remove this item if the PR doesn't have any relation to concurrency.)
  • a release note entry in the PR description.

  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • Diff: 297 lines (+222 / -75) across 3 files Reviewer: amaechler Review duration: 2619m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 297 lines diff across 3 files
    0.40
    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.341
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #20740"
    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: 40% (MEDIUM) · Higher = larger blast radius
    40%
    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.8% · Safe to merge
    15.8%
    Repository