#11271: Doctor: enhance network connectivity diagnostics
commands
stale
Cluster:
Cross-Platform Fixes
## Summary
This PR enhances the `doctor` command by adding network connectivity checks for configured AI providers (e.g., OpenAI, Anthropic, DeepSeek). This helps diagnose "connection failed" issues directly from the CLI.
## Changes
- Modified `src/commands/doctor.ts` to include network diagnostics.
- Added `src/commands/doctor-network.ts` to implement connectivity checks (HEAD/GET with timeout).
- Uses `chalk` for status indicators (● OK / ✖ Failed).
## Motivation
Users often report connectivity issues (timeout, connection refused). This feature provides immediate feedback on whether the gateway can reach the provider APIs, reducing the support burden for "can't connect" issues.
## Testing
- Verified manually by running `openclaw doctor` with valid and invalid network configurations.
- `pnpm check` passed.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a network connectivity diagnostic to `openclaw doctor`, introducing `noteNetworkConnectivity` which probes a set of configured (and default) model providers via a timed HEAD request with a GET fallback, then prints a summary note of OK/Failed results.
The change is wired into the main `doctorCommand` flow so the connectivity check runs after config load/migration and before subsequent doctor checks.
<h3>Confidence Score: 4/5</h3>
- Mostly safe to merge, but there is a timer cleanup bug that can keep the process alive unnecessarily on failures.
- The feature is self-contained and uses straightforward fetch-based probes, but the per-provider timeout timer is only cleared on the success path; on network failures it can leave pending timers that delay CLI exit (up to the timeout, multiplied by number of providers).
- src/commands/doctor-network.ts
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#10578: feat(doctor): exit with code 1 when critical errors are detected
by 13rac1 · 2026-02-06
77.3%
#13045: feat(doctor): add memory search embeddings provider health check
by asklee-klawd · 2026-02-10
76.6%
#21742: fix(doctor): warn on conflicting exec approval config surfaces
by habakan · 2026-02-20
75.1%
#18546: fix(doctor): replace deprecated `auth add` command reference
by Phineas1500 · 2026-02-16
74.6%
#22327: fix(doctor): use gateway health status for memory search key check
by therk · 2026-02-21
74.5%
#15903: fix(doctor): stricter gateway service detection to prevent false po...
by Shuai-DaiDai · 2026-02-14
74.2%
#11602: fix(config): skip stale legacy config files when openclaw.json exists
by akoscz · 2026-02-08
73.2%
#22112: fix(doctor): warn when gateway is network-exposed without TLS
by pierreeurope · 2026-02-20
73.1%
#21503: feat(doctor): validate fallback model providers are defined (#20909)
by echoVic · 2026-02-20
72.3%
#10030: Guard network interface enumeration
by TheAxumite · 2026-02-06
72.0%