fix: use credential_pool for custom endpoint model listing probes (salvage #22810)#22842
Merged
Conversation
Contributor
🔎 Lint report:
|
Same-provider /model switches on a 'custom' endpoint kept stale credentials because (a) _resolve_named_custom_runtime's bare-custom + explicit_base_url path went straight to OPENAI_API_KEY/OPENROUTER_API_KEY env fallbacks without consulting the credential pool, and (b) switch_model() guarded against custom-provider re-resolution to preserve base_url, locking in the prior api_key. Now the bare-custom path queries the credential pool first (mirroring the named-custom-provider branch behavior), and the same-provider switch guard is removed since resolve_runtime_provider has since grown a robust custom-resolution path that preserves base_url from model_cfg. Refs #18681 (the gateway-side api_key wiring is still separate), #16254, #12919.
9c10b31 to
f4fa2a0
Compare
This was referenced May 16, 2026
Closed
5 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 #22810 — same-provider
/modelswitches on a custom endpoint now consult the credential pool for listing probes and adopt freshly-resolved credentials instead of pinning the stale ones.Changes (contributor commit, re-authored from
agent@hermes.localplaceholder to v1b3coder's noreply)hermes_cli/runtime_provider.py::_resolve_named_custom_runtime: bare-custom + explicit_base_url path now calls_try_resolve_from_custom_pool(base_url, "custom", None)before falling back to env-var candidates. Mirrors the named-custom-provider branch already in place.hermes_cli/model_switch.py::switch_model: drops theif runtime.get("provider") != "custom":guard so same-provider switches DO adopt the freshly-resolved api_key/base_url/api_mode. The original guard (fix(model): preserve custom endpoint credentials during /model switch #15088) was added to preserve base_url across switches; that's now handled byresolve_runtime_providerreadingmodel_cfg.base_url.Validation
/modelswitches.Refs #18681 (the gateway-side
current_api_key = model_cfg.get("api_key", "")fix is separate and still needed), #16254, #12919.