kbuild: make network readiness checks bounded (#3197) #3202
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 · 260 lines diff across 3 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.333
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3202"
general
weight: 0.35
nuclearcat
This PR addresses #3197 by making Kubernetes network readiness checks bounded and independent of unrelated third-party services.
Problem
KernelCI had two generic startup checks that used Google connectivity as an indication that the Kubernetes node network was ready.
KBuild._verify_network() performed an HTTP request to google.com without a request timeout. Additionally, non-200 HTTP responses did not decrement the retry counter, which could cause the readiness check to loop indefinitely.
The generic Python runtime template also attempted to resolve www.google.com before starting a job. Besides introducing an unnecessary dependency on an external service, this does not verify connectivity to the KernelCI services that the job actually needs.
Solution
This PR updates the network readiness handling to use the KernelCI API as the readiness target.
For KBuild._verify_network():
Added a configurable target URL.
Use the configured KernelCI API URL when available, with https://api.kernelci.org as the fallback.
Added configurable retry count, retry delay, and request timeout.
Pass the timeout directly to requests.get().
Decrement the retry counter for every failed attempt, including non-200 HTTP responses.
Avoid sleeping after the final attempt.
Report the target service and elapsed time when readiness checks are exhausted.
Raise a RuntimeError instead of terminating the process directly with sys.exit().
For the generic Python runtime template:
Removed the hard-coded dependency on www.google.com.
Resolve the hostname of the configured KernelCI API instead.
Fall back to api.kernelci.org when the API URL cannot be determined.
Bound the DNS readiness check to a fixed number of attempts.
Report the actual hostname when DNS resolution fails.
Validation
The readiness logic was tested with mocked network conditions, including:
Immediate HTTP 200 success.
Repeated non-200 responses.
Temporary failures followed by a successful response.
Connection failures.
Request timeouts.
Retry exhaustion.
Closes #3197