← Back to Pull requests

Fix cancellation uncordons, ASG event IDs and load balancer label removal #1291

Open
unknown opened this pull request with 303 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 01, 2026 01:24 UTC
Author

Issue #, if available: N/A

Description of changes:

A cancelled scheduled event now uncordons the node once, and only when NTH acted on the event.
The ASG target lifecycle monitor reports one event per node instead of a new one on every poll, and NTH removes its own exclude-from-external-load-balancers label.

  • Cancellations undid other cordons.

  • IMDS reports a cancelled scheduled event on every poll, and each report uncordoned the node, undoing an administrator's cordon.
    A cancellation now uncordons the node only when NTH acted on the event: the event is in the event store, or, after NTH restarts, the node carries the aws-node-termination-handler/event-id label for it.
    NTH now sets that label for every IMDS scheduled event, not only reboot events, so a cancelled stop or retirement event still uncordons the node after a restart.
    It does not uncordon while another event for the node is active.
  • ASG lifecycle events re-drained the node on every poll.

  • The event ID hashed time.Now(), so every poll created a new event.
    It now hashes the state and node name.
  • NTH never removed its own load balancer exclusion label.

  • removeLabelIfValueMatches had its check inverted.
  • TestMonitor_Success for the ASG lifecycle monitor could never fail.

  • It served the InService state, which the monitor ignores.
    It now serves Terminated, with new tests that InService sends no event and that the event ID is stable across polls.
  • The Queue Processor metrics e2e test raced NTH's first gauge computation.

  • It read the tagged instance gauge once, at about the moment NTH first computes it.
    It now retries until the counters and the gauge have their expected values.

    How you tested your changes:
    Environment (Linux / Windows): Linux
    Kubernetes Version: N/A (unit tests with the fake clientset)

  • New unit tests for each fix, including cancellation after a restart: labeled for the event, not labeled, labeled for another event, and another event still active.

  • Each fix was reverted in turn, and its test failed.

  • go test ./... and go vet ./... pass.

  • The metrics test change passes shellcheck -S warning, and its value parsing and exit codes were checked against sample metrics output.

  • The e2e suite was not run locally; CI runs it.
  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

    Diff: 303 lines (+227 / -76) across 3 files Reviewer: micahhausler Review duration: 42634m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.40) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 303 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.342
    Real PR Conversation Timeline
    1 comments
    "Review active on #1291"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 22.9% · Safe to merge
    22.9%