Skip to content

fix(doctor): skip pluggable provider profiles when a dedicated check exists (#22346)#22529

Closed
wesleysimplicio wants to merge 2 commits into
NousResearch:mainfrom
wesleysimplicio:fix/agente-c-doctor-anthropic-dup
Closed

fix(doctor): skip pluggable provider profiles when a dedicated check exists (#22346)#22529
wesleysimplicio wants to merge 2 commits into
NousResearch:mainfrom
wesleysimplicio:fix/agente-c-doctor-anthropic-dup

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Contributor

Problem

hermes doctor runs two health checks for Anthropic: a dedicated one with the correct x-api-key + anthropic-version headers, and a generic Authorization: Bearer ... one driven by the pluggable ProviderProfile for "anthropic". The generic check hits https://api.anthropic.com/v1/models with the wrong auth and Anthropic returns HTTP 404, producing a noisy duplicate warning even when the dedicated check passed.

Root cause

hermes_cli/doctor.py:_build_apikey_providers_list deduplicates profiles against _known_canonical, but that set only covers the static list (Z.AI/GLM, Kimi, DeepSeek, …). Providers that already have a dedicated check above the generic loop (Anthropic, OpenRouter, Bedrock) were not in it, so their profiles were appended and ran a second, broken check.

Fix

Add {"anthropic", "openrouter", "bedrock"} to the skip set, and also skip profiles whose aliases match any of those names (so claude/claude-oauth → anthropic).

Tests

tests/hermes_cli/test_doctor_dedicated_provider_skip.py:

  • test_build_apikey_providers_list_skips_dedicated_check_providers — asserts assembled list excludes anthropic, openrouter, bedrock.
  • test_build_apikey_providers_list_includes_non_dedicated_providers — sanity that DeepSeek and Z.AI/GLM survive.

Both confirmed via stash-verify (fail pre-fix with anthropic/openrouter leaking, pass post-fix).

Fixes #22346

…exists (NousResearch#22346)

Problem
-------
`hermes doctor` ran two health checks for Anthropic: a dedicated one
with the correct `x-api-key` + `anthropic-version` headers, and a
generic Bearer-auth one driven by the pluggable `ProviderProfile` for
"anthropic". The generic check called `https://api.anthropic.com/v1/models`
with `Authorization: Bearer ...`, which Anthropic answers with HTTP 404,
producing a noisy duplicate warning even when the dedicated check passed.

Root cause
----------
`hermes_cli/doctor.py:_build_apikey_providers_list` deduplicated profiles
against a `_known_canonical` set built from the static list (Z.AI/GLM,
Kimi, DeepSeek, …). Providers with their own dedicated check above the
generic loop (Anthropic, OpenRouter, Bedrock) were not in that set, so
their profiles were appended and ran a second, broken check.

Fix
---
Add `{"anthropic", "openrouter", "bedrock"}` to the skip set, and
also skip profiles whose aliases match any of those names (e.g.
`claude`, `claude-oauth` → anthropic).

Tests
-----
tests/hermes_cli/test_doctor_dedicated_provider_skip.py:
  - test_build_apikey_providers_list_skips_dedicated_check_providers:
    asserts the assembled list does not contain anthropic, openrouter,
    or bedrock entries.
  - test_build_apikey_providers_list_includes_non_dedicated_providers:
    sanity guard that legitimate providers (DeepSeek, Z.AI/GLM) survive.
Both confirmed via stash-verify (fail pre-fix with anthropic/openrouter
leaking, pass post-fix).

Fixes NousResearch#22346
Copilot AI review requested due to automatic review settings May 9, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces noise in hermes doctor by preventing the generic “API-key providers” Bearer-auth health-check loop from running for providers that already have dedicated checks with custom auth/header requirements (notably Anthropic, plus OpenRouter and Bedrock).

Changes:

  • Extend _build_apikey_providers_list() to treat {"anthropic", "openrouter", "bedrock"} as “known” so their pluggable ProviderProfiles are not appended to the generic API-key provider list.
  • Add an additional skip condition intended to skip profiles based on their aliases.
  • Add regression tests asserting that dedicated-check providers don’t appear in the generic provider list and that non-dedicated providers remain.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
hermes_cli/doctor.py Skips pluggable provider profiles for providers that already have dedicated doctor checks.
tests/hermes_cli/test_doctor_dedicated_provider_skip.py Adds regression tests around _build_apikey_providers_list() contents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hermes_cli/doctor.py
Comment on lines 260 to +264
_label = _pp.display_name or _pp.name
if _label in _known_names or _pp.name in _known_canonical:
continue
if any(_alias in _dedicated_canonical for _alias in (_pp.aliases or ())):
continue
Comment on lines +35 to +37
assert not any("bedrock" in name for name in names), (
f"Bedrock uses AWS SDK creds, not Bearer auth; generic loop must skip. "
f"Got: {sorted(names)}"
@teknium1

teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Merged via salvage PR #22801. salvage cherry-picked your commits; authorship preserved. Thanks for the contribution!

@teknium1 teknium1 closed this May 9, 2026
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes doctor: duplicate anthropic check fails with HTTP 404 (wrong auth header in pluggable provider check)

4 participants