fix(doctor): honor a provider profile's models_url when base_url is empty - #76582
Open
HumphreySun98 wants to merge 1 commit into
Open
fix(doctor): honor a provider profile's models_url when base_url is empty#76582HumphreySun98 wants to merge 1 commit into
HumphreySun98 wants to merge 1 commit into
Conversation
…mpty
`_build_apikey_providers_list` computed the models-endpoint as:
_models_url = (
(_pp.models_url or (_pp.base_url.rstrip("/") + "/models"))
if _pp.base_url else None
)
The `if _pp.base_url else None` guard wraps the WHOLE expression, so a
ProviderProfile that sets an explicit `models_url` but no `base_url` gets
`default_url=None`. `ProviderProfile.models_url` is documented as the explicit
endpoint with `base_url` only providing the `{base_url}/models` fallback
(providers/base.py), so this drops a valid endpoint: doctor then probes `None`
and always shows a spurious yellow "couldn't verify" for that provider, even
with a valid key.
Honor `models_url` independently; the `if base_url` guard now wraps only the
fallback. Adds regression tests for the models_url-only and base_url-only cases.
Contributor
|
Thanks for the focused fix and regression coverage. Current This is an automated hermes-sweeper review. |
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.
What does this PR do?
_build_apikey_providers_listcomputed the models-endpoint URL as:The
if _pp.base_url else Noneguard wraps the whole expression, so aProviderProfilethat sets an explicitmodels_urlbut nobase_urlends upwith
default_url=None. ButProviderProfile.models_urlis documented as theexplicit models endpoint, with
base_urlonly supplying the{base_url}/modelsfallback (providers/base.py:55). So a valid endpoint issilently dropped:
_probe_apikey_providerthen callshttpx.get(None, ...)and doctor always shows a spurious yellow "⚠ … couldn't verify" for that
provider, even with a valid key and a perfectly good models endpoint.
Fix
Honor
models_urlindependently; theif base_urlguard now wraps only thefallback:
Orthogonal to the open #9823 (which fixes double-appending
/modelsin theprobe-time
_build_models_url) — different function, different bug.Related Issue
No existing issue — found via a code audit.
Type of Change
Changes Made
hermes_cli/doctor.py— honormodels_urlwhenbase_urlis empty.tests/hermes_cli/test_doctor_apikey_models_url.py— regression tests for themodels_url-only and base_url-only cases.
How to Test
scripts/run_tests.sh tests/hermes_cli/test_doctor_apikey_models_url.py -q→ all pass.models_urlset andbase_url=""now yields thatmodels_urlas the doctor probe URL instead ofNone.Checklist
fix(doctor):)main