← Back to Pull requests

fix: don't block Trainer deletion when runtime CRDs are absent #106

Closed
unknown closed this pull request without merging on Oct 28, 2026 09:09 UTC
View on GitHub
unknown unknown commented on Oct 28, 2026 08:25 UTC
Author

Summary

A Trainer CR created while the JobSet operator is missing can never be deleted: the cleanup finalizer fails with NotFound when listing the upstream runtime CRDs, which were never installed because rendering never ran.

  • Treat a 404 from listing ClusterTrainingRuntimes/TrainingRuntimes as "nothing to clean up" and continue, so the finalizer is removed.

  • Real errors (Forbidden, API server failures) still propagate and are retried by the reconciler.
  • Fixes RHAI-16473.

    Root cause

    checkDependencies aborts the reconcile before renderManifests, so the upstream trainer CRDs are not installed. The framework still adds the finalizer before actions run. On delete, removeRuntimeFinalizers listed the missing GVRs and returned the 404, leaving the CR stuck in Terminating indefinitely.

    Test plan

  • make test — all packages pass

  • New unit tests: NotFound is skipped, Forbidden is propagated

  • KinD repro: operator deployed without JobSet CRD → Trainer created (Degraded=True, JobSetCRDNotFound) → deleted in <5s after the fix (previously stuck indefinitely)
  • 🤖 Generated with Claude Code

    [RHAI-16473]: https://redhat.atlassian.net/browse/RHAI-16473?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

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

    Summary by CodeRabbit

    Bug Fixes
    Finalizer cleanup now continues if either training runtime API is unavailable. Other errors encountered while listing runtime resources are still reported, so cleanup does not silently ignore them.

    Tests
    Added coverage confirming that unavailable APIs do not stop cleanup and that other listing errors are propagated with context.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 243 lines (+182 / -61) across 3 files Reviewer: abhijeet-dhumal Review duration: 44m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 243 lines diff across 3 files
    0.39
    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.329
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #106"
    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: 38.8% (MEDIUM) · Higher = larger blast radius
    38.8%
    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.3% · Safe to merge
    15.3%