fix(agent): heal credential-pool last_status after a successful served request - #95351
Closed
SayHell0W0rld wants to merge 1 commit into
Closed
SayHell0W0rld wants to merge 1 commit into
SayHell0W0rld wants to merge 1 commit into
Conversation
…d request A credential marked exhausted by a transient rate-limit/billing wall stays exhausted even after the wall lifts and kernel-mediated requests succeed again (issue NousResearch#95166, gap 2). Add _mark_healthy() (symmetric to _mark_exhausted) and call it from _relay_final_response — the unified success exit for chat-completions mode — so pool readers don't see a stale exhausted verdict. 3 regression tests; 62/62 file pass; ruff + Windows footgun lint clean.
SayHell0W0rld
force-pushed
the
fix/pool-last-status-heal
branch
from
August 26, 2026 07:40
3e163a2 to
ff5c0a5
Compare
Contributor
Plugs a real gap: nothing else in
No blocking issues found; the streaming-vs-non-streaming coverage gap (second bullet) is the one to resolve before merge. |
Author
|
Merged into #90417 (both fixes live in |
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
Fixes gap 2 of #95166: a credential-pool entry marked
STATUS_EXHAUSTEDby a transient wall stays exhausted after the wall lifts, making every subsequent pool reader see a false wall.Approach
_mark_healthy()(agent/credential_pool.py) — symmetric to_mark_exhausted(): resetslast_statustoSTATUS_OKand clears error fields. No-op when the entry already haslast_status=None._relay_final_response()(agent/chat_completion_helpers.py) — the unified success exit for chat-completions mode: after a successful served request, heals the active credential-pool entry if it still carries a stale exhausted/dead verdict.Test Plan
test_credential_pool.py:TestMarkHealthy— clears exhausted status, skips already-healthy entry, clears dead status.ruff checkclean. Windows footgun lint clean.Risk / Exclusions
_mark_healthyis provider-agnostic and only touches the shared credential pool._relay_final_responseonly runs for chat-completions mode; other API modes (responses, streaming-only) are unaffected.References #95166