Skip to content

fix(credential_pool): resolve key mix-up when custom providers share base_url (salvage #19094)#21219

Merged
teknium1 merged 1 commit into
mainfrom
salvage/pr-19094
May 7, 2026
Merged

fix(credential_pool): resolve key mix-up when custom providers share base_url (salvage #19094)#21219
teknium1 merged 1 commit into
mainfrom
salvage/pr-19094

Conversation

@teknium1

@teknium1 teknium1 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Closes #19094 via salvage. Fixes #19083.

Summary

When two custom_providers share a base_url with different API keys, get_custom_provider_pool_key(base_url) returns the first match in iteration order — so the second provider gets the first's credentials (401).

Add optional provider_name kwarg; prefer exact name match, fall back to base_url match for backward compat. Thread it through _try_resolve_from_custom_pool in runtime_provider at the two named-custom + openrouter-"custom" call sites.

Validation

scripts/run_tests.sh tests/agent/test_credential_pool.py → 42 passed.

Original author: @shellybotmoyer.

…base_url

When multiple custom_providers share the same base_url but have different API keys,

get_custom_provider_pool_key() always returned the first match, causing wrong-key

unauthorized errors. Add provider_name parameter to prefer exact name matches

over base_url-only matching, with fallback for backward compatibility.

Fixes #19083
@teknium1 teknium1 merged commit e38ea38 into main May 7, 2026
10 of 11 checks passed
@teknium1 teknium1 deleted the salvage/pr-19094 branch May 7, 2026 12:27
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: salvage/pr-19094 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: 7498 on HEAD, 7498 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 3938 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 comp/agent Core agent loop, run_agent.py, prompt builder area/auth Authentication, OAuth, credential pools P2 Medium — degraded but workaround exists labels May 7, 2026
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/agent Core agent loop, run_agent.py, prompt builder 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.

Credential pool key mix-up when multiple custom providers share the same base_url

2 participants