← Back to Pull requests

refactor(ndm): drop the loopback ping detection #60790

Closed
unknown closed this pull request without merging on Nov 19, 2026 06:10 UTC
View on GitHub
unknown unknown commented on Nov 18, 2026 14:48 UTC
Author

What does this PR do?

Removes the loopback ping that discovery and the connectivity check used to decide whether ping works. The socket type now comes from the OS (raw on Windows, UDP elsewhere), with the request's Linux use_raw_socket override, through pingprobe.ResolveRawSocket, which both components now share. A ping that fails is reported as it always was.

Functional changes

| Before | After |
| --- | --- |
| Discovery, the loopback ping at startup fails: ping is dropped from every range until the agent restarts | Ping runs for every range that asks for it |
| Connectivity check on Windows, the first loopback ping fails: every later ping fails with "udp socket cannot be used with this OS" | Pings use a raw socket regardless |
| Discovery range with linux.use_raw_socket: true: ignored, ping stays on the UDP socket | Honoured: ping goes through system-probe's ping module, like the SNMP check |
| Every agent start with discovery enabled, and the first connectivity check: one loopback ping, waiting up to a second | No ping until a probe runs |

Unchanged: a failed ping is still unreachable, the payloads and the PAR result shape are the same, and SNMP is untouched.

Motivation

A loopback ping is a poor proxy for "can this agent ping devices". It fails on hosts that ignore echo requests (icmp_echo_ignore_all) but can ping devices fine, and on Linux it never tried the raw socket path through system-probe. Because it ran once, one transient failure at startup also disabled ping in discovery for the agent's lifetime.

Describe how you validated your changes

Unit tests cover the per-OS socket defaults and the Linux override, in pingprobe and in both components' option parsing. pingprobe and its test build for Windows.

Additional Notes

On a host that can't send pings at all, ping now reads unreachable for every device instead of being skipped. Telling the two apart needs a way to classify a ping the agent couldn't send, which was tried on this branch and dropped: an error-code list missed cases, and classifying by stage misread system-probe HTTP timeouts on long raw-socket pings.

🤖 Generated with Claude Code

Diff: 277 lines (+207 / -70) across 3 files Reviewer: Pierre-L42 Review duration: 922m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 277 lines diff across 3 files
0.40
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.337
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #60790"
general weight: 0.35
Reviewers
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: 39.6% (MEDIUM) · Higher = larger blast radius
39.6%
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.6% · Safe to merge
15.6%