Skip to content

Expand kbot doctor to test all configured providers #19

@isaacsight

Description

@isaacsight

What

Expand `kbot doctor` so it tests connectivity to all providers the user has ever configured, not just the currently active one. Display a summary showing which providers are reachable and which are not.

Why

Users who switch between providers (e.g., Anthropic for heavy work, Groq for fast queries, Ollama for offline) currently only see the health of their active provider when running `kbot doctor`. If a secondary provider's key has expired or a local runtime has gone down, they won't find out until they switch to it mid-task. Testing all providers upfront saves debugging time.

Suggested approach

  1. In `doctor.ts`, the existing `checkProviderReachable()` function (line ~174) only tests the single active provider. Refactor it (or add a new `checkAllProviders()` function) that:
    • Reads the config from `~/.kbot/config.json` to find all providers with stored keys.
    • Also checks known local runtime endpoints (Ollama, LM Studio, Jan, kbot-local) — this part already exists in `checkLocalRuntimes()`.
    • For each cloud provider with a stored key, does a lightweight reachability check (HEAD request to the API base URL).
  2. Display results as individual check lines:
    ✓ Anthropic (Claude)     reachable
    ✓ Groq                   reachable
    ✗ OpenAI                 unreachable — check your network or API key
    ✓ Ollama                 running (3 models)
    
  3. Run all provider checks in parallel with `Promise.allSettled()` for speed.
  4. Keep the existing single-provider check as a fallback if the config only has one provider.

Files to look at

  • `packages/kbot/src/doctor.ts` — `checkProviderReachable()` (~line 174) and `checkLocalRuntimes()` (~line 225)
  • `packages/kbot/src/auth.ts` — `loadConfig()`, `PROVIDERS` record (all 20 provider definitions with API URLs)
  • `packages/kbot/src/cli.ts` — Where `runDoctor()` is called (~line 896)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions