Skip to content

fix: use credential_pool for custom endpoint model listing probes (salvage #22810)#22842

Merged
teknium1 merged 2 commits into
mainfrom
salvage/pr-22810
May 10, 2026
Merged

fix: use credential_pool for custom endpoint model listing probes (salvage #22810)#22842
teknium1 merged 2 commits into
mainfrom
salvage/pr-22810

Conversation

@teknium1

@teknium1 teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Salvage of #22810 — same-provider /model switches 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.local placeholder 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 the if 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 by resolve_runtime_provider reading model_cfg.base_url.

Validation

  • The bare-custom + explicit_base_url path bypassed the credential pool entirely; listing probes hit OPENAI/OPENROUTER env fallbacks even when a custom pool was configured.
  • The same-provider guard pinned stale credentials, so a rotated pool key was never picked up on /model switches.

Refs #18681 (the gateway-side current_api_key = model_cfg.get("api_key", "") fix is separate and still needed), #16254, #12919.

@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/pr-22810 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 7954 on HEAD, 7954 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4201 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/auth Authentication, OAuth, credential pools labels May 9, 2026
v1b3coder and others added 2 commits May 9, 2026 17:54
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools 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.

3 participants