← Back to Pull requests

fix(scheduler): flip taint penalty for chained spread node policies #3619

Closed
unknown closed this pull request without merging on Dec 03, 2026 18:13 UTC
View on GitHub
unknown unknown commented on Dec 03, 2026 17:06 UTC
Author

What type of PR is this?

/kind bug

What this PR does / why we need it:

NodeScore.AddTaintTolerationScore compared the node policy with "spread" exactly. The node policy annotation also accepts chains such as spread,superpod and superpod,spread, and NodeScoreList.Less sorts those as spread. For those values the PreferNoSchedule penalty was applied the binpack way: the tainted node's score went down, and since spread picks the lowest score, the node with the untolerated taint became the preferred one.

This replaces the exact comparison with NodePolicyUsesSpread(policy), the same change #3410 made in NodeScoreList.Less, OverrideScore and AddNodeAffinityScore when it introduced chained node policies. It also covers superpod alone with --node-scheduler-policy=spread, which the sort already treats as spread.

Which issue(s) this PR fixes:
Fixes #3618

Special notes for your reviewer:

  • Regression from #3410; AddTaintTolerationScore was added two days earlier in #3469 and was missed.

  • Two rows added to TestAddTaintTolerationScore (spread,superpod and superpod,spread). Both fail without the change with score = -40.000000, want 60.000000. The existing rows, including "" behaving as binpack, are unchanged.

  • Tested locally: go test ./pkg/scheduler/policy/ -short --race -count=1, go test ./pkg/scheduler/ -short -count=1, and golangci-lint run ./pkg/scheduler/policy/... (v2.15.0).
  • AI assistance: I used Claude Code to write the tests only; I reviewed and ran all of it myself.

    Does this PR introduce a user-facing change?:

    ``release-note
    Fixed the PreferNoSchedule taint score favouring tainted nodes when the node scheduler policy is a chain such as spread,superpod.
    ``

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    Taint-toleration scoring now handles policies that combine spread and superpod consistently, regardless of the order in which those settings are specified. Scores for spread policies continue to apply the spread-specific penalty, while other policies retain their existing scoring behavior.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 284 lines (+213 / -71) across 3 files Reviewer: moezdil Review duration: 67m
    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 · 284 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.338
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3619"
    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.7% (MEDIUM) · Higher = larger blast radius
    39.7%
    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.7% · Safe to merge
    15.7%