Conversation
DanielLSM
force-pushed
the
fix/credential-pool-endpoint-sync
branch
from
May 7, 2026 17:04
ffa869c to
6b0d850
Compare
When a provider has multiple API surfaces, a pool entry can stay exhausted on a stale base_url after runtime endpoint detection finds a different working endpoint. Z.AI regular vs coding-plan endpoints expose this: auth state can contain the detected working endpoint while the pool entry remains stranded on the old URL. Changes: - sync exhausted pool entries from provider_state.<provider>.detected_endpoint before skipping them - re-probe configured endpoint detectors when an exhausted entry's cooldown expires - keep the entry exhausted if no endpoint currently works, preserving the original error context The mechanism is provider-agnostic; Z.AI is the first opted-in detector. Related: NousResearch#5668, NousResearch#19083 Test: pytest tests/agent/test_credential_pool.py -q (46 passed)
DanielLSM
force-pushed
the
fix/credential-pool-endpoint-sync
branch
from
May 9, 2026 20:48
6b0d850 to
1b0740f
Compare
This was referenced May 9, 2026
Contributor
Author
|
Closing in favor of consolidated PR #22827. |
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.
Symptom
A credential pool entry can remain
exhaustedon a stalebase_urleven after runtime provider resolution has detected a different working endpoint.The concrete case is Z.AI regular vs coding-plan API surfaces: endpoint detection can cache the working coding-plan endpoint in
provider_state.zai.detected_endpoint, while the pool entry remains stuck on the regular endpoint and is skipped before that newer auth state is used.Root cause
CredentialPool._available_entries()checks exhaustion before syncing endpoint state fromauth.json. For providers with multiple API surfaces, that leaves the pool entry stranded on an endpoint that no longer reflects the provider's detected working URL.Fix
_sync_endpoint_from_provider_state()to adoptprovider_state.<provider>.detected_endpointwhen it differs from the pool entry's cachedbase_url.The sync/re-probe mechanism is provider-agnostic; Z.AI is the first opted-in detector via
_PROVIDER_ENDPOINT_DETECTORS.Related context
Test plan
Result:
46 passed.