fix(providers): resolve ProviderProfile identity consistently - #52549
WolframRavenwolf wants to merge 1 commit into
Conversation
47a2348 to
066465e
Compare
066465e to
73713bc
Compare
73713bc to
ecbf2e1
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the generic CLI identity gap; current resolve_provider_full() still reaches get_provider() without a ProviderProfile fallback (hermes_cli/providers.py:742-745, :477).
Problems
hermes_cli/runtime_provider.py:2001-2032makesprofile_api_modewin over URL detection. Current main intentionally honors a selected provider'smodel.base_url(:2028-2032) and then detects the endpoint protocol (:2057-2062). With this PR, an auto-registered profile declaring (for example)anthropic_messagescannot switch to a configured OpenAI/xAI endpoint, because:2029skips detection.
Suggested changes
- Make
profile_api_modea fallback only after explicit configured mode and_detect_api_mode_for_url(base_url), and add a regression covering a non-default profile mode plus a same-provider base-URL override requiring a different detected mode. - The new switch test manually inserts
ProviderConfig.extra; add coverage that exercises the auth auto-registration path inhermes_cli/auth.py:461-473as well.
Automated hermes-sweeper review.
| @@ -1998,7 +1998,8 @@ def resolve_runtime_provider( | |||
| if cfg_provider == provider: | |||
| cfg_base_url = (model_cfg.get("base_url") or "").strip().rstrip("/") | |||
| base_url = cfg_base_url or creds.get("base_url", "").rstrip("/") | |||
| api_mode = "chat_completions" | |||
| profile_api_mode = str((pconfig.extra or {}).get("api_mode") or "").strip() | |||
| api_mode = profile_api_mode or "chat_completions" | |||
There was a problem hiding this comment.
Please keep _detect_api_mode_for_url(base_url) ahead of this profile fallback. model.base_url is intentionally honored for the configured provider, so an overridden endpoint may require a different protocol than the profile's default; the new if not profile_api_mode guard at line 2029 prevents that detection entirely.
ecbf2e1 to
60149e1
Compare
|
Addressed the review points and coordinated the overlapping provider work in the rebased branch:
Canonical provider test runner: 208 passed. |
c42e289 to
7ca5d99
Compare
|
Fresh head-matched Devin review found one actionable integration mismatch: CLI identity accepted profiles that the auth bridge intentionally does not register. Addressed in the latest head by applying the same Verification:
|
1623daf to
9f367e6
Compare
9f367e6 to
44107c3
Compare
|
A delayed independent review found one additional provider-family edge case after the previous update: a persisted Fixed test-first in the latest head:
Verification:
|
44107c3 to
54dd21f
Compare
Keep canonical plugin profile identity through CLI aliases, separate URL variables from credentials, and honor matching persisted configuration across registered aliases. Retain native custom and built-in routing. Retain real discovery/runtime test provenance from the contributor while omitting the already absorbed bridge and separately owned transport fix. Co-authored-by: david-bowiegxw <834563048@qq.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
54dd21f to
7d29404
Compare
|
Salvaged into #116853 (main |
A provider declared through
ProviderProfilecan be available at startup yet fail the shared CLI/gateway identity lookup. Resolve profile names and aliases throughresolve_provider_full()while keeping built-in lookup free of plugin discovery. Preserve explicit configuration, built-in provider IDs, bare custom endpoints and display metadata.This PR covers identity and configuration. Runtime transport-mode propagation remains separate work in #53055; this branch does not take over that implementation. Its discovery-fixture coverage is credited to david-bowiegxw, with the contributor mapping and Co-authored-by trailer retained. #34368 identified the model-switch lookup gap and is credited to Kyzcreig. #65956 overlaps the separate runtime-mode work.
The new test module is
tests/hermes_cli/test_provider_profile_identity.py, avoiding the filename collision with #53055. Compatibility with that unmerged transport change is not asserted here.Validation: 246 tests passed across model-switch custom providers, runtime provider resolution, profile identity, runtime transport precedence and CommandCode profile suites; scoped Ruff and
git diff --checkpassed.