fix(doctor): skip pluggable provider profiles when a dedicated check exists (salvage #22529)#22801
Merged
Conversation
…exists (#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 #22346
Contributor
🔎 Lint report:
|
This was referenced May 9, 2026
23 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvage of #22529 —
hermes doctorno longer runs a duplicateanthropic(oropenrouter/bedrock) check from the pluggable provider profile loop; the dedicated check is the only path used.Root cause
hermes_cli/doctor.py::_build_apikey_providers_listwalked all pluggable provider profiles (Anthropic, OpenRouter, Bedrock) AND emitted them into the apikey-loop, which already had dedicated checks elsewhere. The duplicate apikey-loop entry tried to validate using the wrong auth header (api-key style vs. OAuth token), produced HTTP 404, and surfaced as a confusing failure inhermes doctoreven when the dedicated check passed.Changes (contributor commits)
hermes_cli/doctor.py::_build_apikey_providers_list: skip provider profiles whose canonical name is in{"anthropic", "openrouter", "bedrock"}so they aren't double-checked. Alias-aware vianormalize_providersoclaude/claude-oauthaliases that resolve to the same canonical also skip.anthropiccheck fails with HTTP 404 (wrong auth header in pluggable provider check) #22346.Picked over competing PR #22512 (ly82505129) for: includes Bedrock (which #22512 missed), alias-aware via
normalize_provider(catchesclaude/claude-oauthprofiles a pure display-name match misses), filters at the build phase (cleaner), ships regression tests. ly82505129 credited.Validation
Closes #22346 via salvage.