← Back to Pull requests

fix(infra): move .instance call inside TimeoutSampler scope #6989

Closed
unknown closed this pull request without merging on Nov 30, 2026 16:38 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 17:05 UTC
Author

##### What this PR does / why we need it:

wait_for_consistent_resource_conditions() in utilities/infra.py calls .instance (a Kubernetes GET API call) outside the TimeoutSampler's protected func. When the GET hits a CRD conversion webhook that is transiently unavailable (e.g. during HCO webhook pod restart after HCO recreation), the InternalServerError escapes the sampler's retry scope and causes immediate failure — even though the outer sampler has a 600-second budget.

This was observed in test-pytest-cnv-4.22-product-uninstall build #57 where test_block_strategy_no_dv_and_no_vm passed but teardown failed: the removed_hco fixture's cleanup called recreate_hco → wait_for_hco_conditions → wait_for_consistent_resource_conditions, and the HCO webhook pod restarted during that window (~4s gap), causing the unprotected .instance call to fail with a conversion webhook 500.

Fix: Extract _get_resource_conditions() that performs both the LIST and the .instance GET, and pass it as the sampler's func. This moves the .instance call inside the sampler's exception-handling scope so transient API errors are retried for the full timeout duration.

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

##### Special notes for reviewer:

The error message from the conversion webhook ("conversion webhook for hco.kubevirt.io/v1beta1, Kind=HyperConverged failed: ...") does not match any filter string in DEFAULT_CLUSTER_RETRY_EXCEPTIONS, so .instance's own retry_cluster_exceptions (10s) also doesn't retry it — it aborts on first failure. With this fix, the outer TimeoutSampler (default exceptions_dict=None → {Exception: []}) retries all exceptions for the full budget, which is the correct behavior for a polling wait function.

##### jira-ticket:

https://redhat.atlassian.net/browse/CNV-101726

🤖 Generated with Claude Code

Diff: 239 lines (+179 / -60) across 2 files Reviewer: hmeir Review duration: 14372m
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 239 lines diff across 2 files
0.60
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.328
Shallow Review Depth shallow_review_depth
0.289
Sensitive Paths sensitive_paths
0.060
Real PR Conversation Timeline
1 comments
"Review active on #6989"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed sensitive_module
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: 60.4% (MEDIUM) · Higher = larger blast radius
60.4%
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: 23.9% · Safe to merge
23.9%