Skip to content

fix(health): add Anthropic-specific health probes for doctor checks#293

Open
sjp611 wants to merge 1 commit into
aiming-lab:mainfrom
sjp611:fix/health-anthropic
Open

fix(health): add Anthropic-specific health probes for doctor checks#293
sjp611 wants to merge 1 commit into
aiming-lab:mainfrom
sjp611:fix/health-anthropic

Conversation

@sjp611

@sjp611 sjp611 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #292.

PROVIDER_PRESETS["anthropic"] sets base_url to https://api.anthropic.com (no /v1 suffix, since AnthropicAdapter appends /v1/messages itself). The existing OpenAI-style health probes in researchclaw doctor build {base_url}/models which 404s on Anthropic, so the LLM-related checks fail despite a valid ANTHROPIC_API_KEY.

This PR adds provider auto-detection (_is_anthropic) and routes the affected health checks to a minimal POST /v1/messages probe with x-api-key + anthropic-version headers. Non-Anthropic providers are unaffected.

Changes

  • researchclaw/health.py: new helpers _is_anthropic, _anthropic_messages_url, _anthropic_probe, _check_anthropic_*. Branch added to check_llm_connectivity, check_api_key_valid, and _check_models_against_endpoint.
  • tests/test_rc_health.py: new tests covering URL detection, /v1 normalization, and 200/401/404 paths.

Testing

  • pytest tests/test_rc_health.py -v passes.

PROVIDER_PRESETS["anthropic"] sets base_url to https://api.anthropic.com
(no /v1 suffix, since AnthropicAdapter appends /v1/messages itself), so the
existing OpenAI-style probes in researchclaw doctor build {base_url}/models
which 404s on Anthropic.

Adds provider auto-detection (_is_anthropic) and routes the three
LLM-touching health checks (check_llm_connectivity, check_api_key_valid,
_check_models_against_endpoint) to a minimal POST /v1/messages probe with
x-api-key + anthropic-version headers when the URL points at Anthropic.
Non-Anthropic providers are unaffected.

Fixes aiming-lab#292
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor: llm_connectivity returns HTTP 404 for Anthropic provider

1 participant