← Back to PRs

#11271: Doctor: enhance network connectivity diagnostics

by MackDing open 2026-02-07 16:55 View on GitHub →
commands stale
## 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