← Back to Pull requests

fix(backend): strip volatile fields from Cluster Service errors in some calls #7711

Closed
unknown closed this pull request without merging on Oct 23, 2026 18:32 UTC
View on GitHub
unknown unknown commented on Oct 23, 2026 08:44 UTC
Author

Cluster Service API errors embed an OperationID and Timestamp that are unique to each individual request, even when the request is being rejected for the exact same reason on every retry (e.g. a cluster stuck in a non-updatable state). A controller's SyncOnce error becomes the Message of a Degraded condition on the resource's Controller document via ReportSyncError, and that condition is only rewritten to Cosmos when the Message actually changes. Because OperationID/Timestamp differ on every attempt, an otherwise-unchanged failure produced a different Message each sync, defeating that no-op check, triggering a Cosmos write, and re-triggering dependent controllers (including the one that just failed) in a continuous reconcile loop with no actual change in the underlying problem.

Add ocm.StripVolatileErrorFields, which rebuilds the Cluster Service error with Status/ID/HREF/Code/Reason/Details preserved but OperationID/Timestamp dropped, and call it at the 14 call sites across the cluster/nodepool/externalauth create, update, and delete controllers that wrap a Cluster Service client error into a Degraded condition message. This keeps the condition message stable across retries so a persistent, unchanged failure converges to a single Cosmos write instead of looping.

The downsides of stripping the error:
- ocm.StripVolatileErrorFields discards everything in the error chain except the OCM error itself. If a caller passes it an error that already has other context wrapped around the OCM error (instead of the raw OCM error directly), that other context is silently lost.
- We permanently lose the OCM error's Timestamp and OperationID, with no way to recover them later if they turn out to be needed (e.g. to correlate with a specific Cluster Service request in CS-side logs).

We lose some traceability but mitigates the unbounded Cosmos-write and reconcile loop, which we consider outweights losing that traceability.

<!-- Link to Jira issue -->

What

<!-- Briefly describe what this PR does -->

Why

<!-- Briefly explain why this change is needed -->

Testing

Testing is required for feature completion and tests should be part of the pull
request along with the feature changes.

Describe the testing provided. If you did not add tests, provide a clear
justification.

  • Unit tests

  • Integration tests

  • E2E tests
  • Special notes for your reviewer

    <!-- optional -->

    PR Checklist

  • PR is scoped to a single task (no mixed concerns)

  • Title follows Conventional Commits format

  • Summary explains the "Why" behind the change

  • Linked to relevant ticket/issue

  • Screenshots included (if dashboards or other UI changes)

  • Self-reviewed the diff

  • CI/CD checks are passing (ignore Tide)

  • Draft PR used for WIP (if applicable)

  • Commit history is clean (rebased/squashed)

  • Tricky code blocks are commented

  • Specific reviewers tagged

  • All comment threads resolved before merge
  • If E2E tests are included:

  • E2E tests follow Principles of Good E2E Test Case Design

  • If new E2E use case is covered (via a new test or new check/verifier),

  • demonstrate that the test is able to detect a defect/error and fail with
    proper error message and logs which communicates nature of the problem.

    Diff: 441 lines (+330 / -111) across 5 files Reviewer: miguelsorianod Review duration: 587m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 441 lines diff across 5 files
    0.45
    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.364
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7711"
    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: 45.3% (MEDIUM) · Higher = larger blast radius
    45.3%
    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: 17.9% · Safe to merge
    17.9%
    Repository