fix(infra): move .instance call inside TimeoutSampler scope #6989
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
hmeir
##### What this PR does / why we need it:
wait_for_consistent_resource_conditions()inutilities/infra.pycalls.instance(a Kubernetes GET API call) outside the TimeoutSampler's protectedfunc. When the GET hits a CRD conversion webhook that is transiently unavailable (e.g. during HCO webhook pod restart after HCO recreation), theInternalServerErrorescapes 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-uninstallbuild #57 wheretest_block_strategy_no_dv_and_no_vmpassed but teardown failed: theremoved_hcofixture's cleanup calledrecreate_hco→wait_for_hco_conditions→wait_for_consistent_resource_conditions, and the HCO webhook pod restarted during that window (~4s gap), causing the unprotected.instancecall to fail with a conversion webhook 500.Fix: Extract
_get_resource_conditions()that performs both the LIST and the.instanceGET, and pass it as the sampler'sfunc. This moves the.instancecall 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 inDEFAULT_CLUSTER_RETRY_EXCEPTIONS, so.instance's ownretry_cluster_exceptions(10s) also doesn't retry it — it aborts on first failure. With this fix, the outer TimeoutSampler (defaultexceptions_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