← Back to Pull requests

feat(mgmt-agent): detect nodes that never reached Ready (AROSLSRE-1983) #6782

Closed
unknown closed this pull request without merging on Sep 04, 2026 15:01 UTC
View on GitHub
unknown unknown commented on Sep 02, 2026 09:43 UTC
Author

Jira: AROSLSRE-1983

What

Adds a never-ready detector for a node that registers and never reaches Ready.

Its evidence is the Node object alone: the Ready condition has never been True, and its first transition coincides with the node's creation. A node that reached Ready at any point has a strictly later transition, which is what separates "never started" from "started and later failed".

Three supporting changes:

  • An optional nodeDetector sub-interface, so a node-state detector fits without widening Evaluate for every existing detector.

  • Decide now runs node-state detectors on the NotReady path and the pod/event detectors on the Ready path. The Ready path is unchanged.

  • Snapshot.Detail, an escape hatch for the reason annotation.
  • Why

    Decide skips any NotReady node:

    // Node-Ready precondition: a NotReady node is left to node lifecycle.
    if !isNodeReady(node) {
        return DecisionUnknown, Snapshot{}
    }
    

    Correct for a node that was Ready and dropped out. Wrong for one that never got there, because nothing in node lifecycle rescues it.

    INT node aks-userswft3-65765115-vmss00000g (int-westus3, AROSLSRE-1976) failed provisioning with a terminal OSProvisioningClientError, registered, never came up, and sat NotReady for 22 hours until a human cordoned it. From its captured node.yaml:

    creationTimestamp:          2026-08-31T21:32:14Z
    Ready.lastTransitionTime:   2026-08-31T21:32:14Z
    Ready.status:               False
    Ready.reason:               KubeletNotReady
    

    The condition was written once at registration and never moved, so the two timestamps are identical.

    The dwell is 30 minutes, set from data. Across 1,119 dev nodes over 14 days, time from creation to first Ready=True was p50 1.0m, p90 1.3m, p99 3.1m, max 3.4m. Every node that was going to come up did so inside 3.4 minutes, so 30 minutes is about nine times the worst legitimate bootstrap, and still 44 times faster than the 22 hours we actually took.

    Why Snapshot.Detail is needed: labeler.go fills the reason annotation from ReasonString(), which renders pod counts. A born-broken node would otherwise be annotated "0 pods stuck past dwell (0 stuck total), no recent success in 0s window". Detectors that leave Detail empty render byte-identically to before, which is pinned by a test.

    Why generic rather than IMDS-specific: dead IMDS, a failed disk, a kubelet certificate problem and a failed image pull are all born broken and all remedied by reimaging, and one detector is one fault with one remedy. The cause goes in the signature annotation instead, taken from the Ready condition's reason. A cause-specific detector would also have to read azure-cns container logs, which this controller never does.

    Testing

    go build, go vet, gofmt and go test ./pkg/controller/nodehealth/... all clean. Every pre-existing test passes untouched.

    New tests cover the dwell boundary (including exactly at the dwell), the born-broken discriminator, a node that was Ready and dropped out, the registration tolerance either side, unusable evidence (no Ready condition, missing timestamps, clock skew), an empty Ready reason, ownership of a non-SWIFT node, and that the Ready path still belongs to swift-vf-teardown.

    TestProductionBornBrokenNodeFires replays the captured INT node with its verbatim timestamps and asserts it fires at the dwell and not a second earlier.

    I also mutation-checked the tests: removing the born-broken discriminator fails 4 of them and zeroing the dwell fails 2, so they are not passing vacuously.

    Special notes for your reviewer

    This cannot cause disruptive remediation. The controller stops at labelling; mitigation of a labelled node is owned by a separate controller that is not shipped.

    Ownership is deliberately narrower than the fault. The detector reuses isSwiftV2Node even though a born-broken node is not a SWIFT problem. AnyApplies runs ahead of the Ready gate and decides which nodes we hold labels on at all, so a detector applying to every node would make DecisionNotApplicable unreachable, and that is the only thing that retires a stale label. I verified the captured INT node did carry kubernetes.azure.com/podnetwork-swiftv2-enabled=true, so the scope is correct rather than lucky. Widening it is a separate decision.

    A silent node still gets evaluated: a born-broken node produces no pods or events, but resyncAll re-enqueues every candidate node every 30 seconds, so it fires at the dwell rather than waiting for unrelated traffic.

    Two open questions I would rather surface than bury:

    1. Should AKS node auto-repair have owned this? It targets nodes that were healthy and went NotReady, so a never-provisioned instance plausibly falls outside it, which is the gap this fills. If it should have caught it, the better fix is an AKS bug and this becomes a stopgap.
    2. The dwell rests on dev data, because prod does not snapshot Node objects today. Worth re-checking once it does.

    This is independent of #6769 and #6776, which change detector thresholds rather than the Ready gate. I trial-merged all three: they auto-merge with no conflicts and the full suite passes on the combined tree.

    PR Checklist

  • Tests added, including a production-evidence test

  • go build, go vet, gofmt clean

  • Jira issue linked
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: stevekuznetsov Review duration: 3198m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6782"
    general weight: 0.35
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%
    Repository