[Feature] /doctor: verify the API, credentials and configured model instead of only opening a TCP port
Description
/doctor reports a provider as reachable based on a bare TCP connect to the host and port (probeLocalProvider in source/commands/doctor.tsx), and only for providers that isLocalURL classifies as local. Hosted providers are never probed at all (reachability: 'not-local'). It does not check that the server answers the API, that the credentials are accepted, or that the configured model exists. Nothing is reported about the other tools nanocoder depends on, such as ripgrep or git.
The most common setup failures are therefore invisible in the one command meant to diagnose them:
- A wrong or expired API key. Port 443 is open, so nothing looks wrong until the first prompt fails.
- A model name that is not served (typo, model not pulled in Ollama, model removed from the provider).
- A base URL missing the
/v1suffix, which connects fine and then returns 404 on every request. - A server that is listening but still loading a model.
Use Case
A new user finishes the setup wizard, or a teammate copies a config file, and the first real prompt fails with a provider error. Running /doctor is the obvious next step, and today it says the provider is fine (local) or says nothing useful (hosted). The same report is what maintainers ask people to paste into bug reports.
Proposed Solution
Add an opt-in deeper check, for example /doctor --probe (and keep the current fast path as the default so the command stays instant and offline friendly):
- Call the provider's models listing endpoint with the configured credentials and report: reachable, authenticated (401/403 clearly labelled), and whether each configured model id is present in the response.
- Report the HTTP status class and a one-line hint for common cases (404 on the base URL, 401 key rejected, 429 rate limited).
- Add a small "tools" section: ripgrep found or falling back, git present, and the Node version against the supported range.
- Never print the key, and strip credentials from any URL shown in the output.
Alternatives Considered
- Rely on the first prompt failing. The error shows up in the middle of a task and the provider-specific cause is often buried in the error text.
- Probe on every startup. That adds latency and traffic for users who did not ask for it, so it should stay explicit.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] This feature aligns with the project's goals (local-first AI assistance)
Related existing issues are about what /doctor prints (#1661) and which directory it runs from (#1306), not about what it verifies. The provider wizard's testProviderConnection in source/wizards/validation.ts already contains a connection test and source/wizards/utils/fetch-models.ts already knows how to list models, so most of the probing logic exists.
Implementation Notes (optional)
Probe in parallel with a short per-provider timeout and the existing dependency-injection seam in DoctorDependencies, so the check stays testable without network access.
I am taking this issue. I plan to keep /doctor fast and offline by default, add the deeper provider/model check only behind an explicit --probe argument, reuse the existing model-listing logic, report only sanitized status and model-match results, and add the requested local-tool checks. I will cover the network and credential paths with injected/mocked tests; no API key or raw credential-bearing URL should appear in the report.
Hi @ducanhnguyen223, thanks for your interest in the issue! Before opening a PR, please comment on the issue first and wait to be assigned. This helps us avoid duplicate work. PRs opened without an assignment may be closed. Thanks!