Skip to content

fix: emit status notification on credential pool rotation#10718

Open
nightq wants to merge 1 commit into
NousResearch:mainfrom
nightq:fix/issue-10476-credential-pool-notification
Open

fix: emit status notification on credential pool rotation#10718
nightq wants to merge 1 commit into
NousResearch:mainfrom
nightq:fix/issue-10476-credential-pool-notification

Conversation

@nightq

@nightq nightq commented Apr 16, 2026

Copy link
Copy Markdown

Summary

Fixes inconsistent notification behavior when credential pool rotation causes a provider switch.

Root Cause

When fallback_model triggers a provider switch, Hermes correctly notifies the user via _emit_status(). However, when credential pool exhaustion causes the same provider switch, no notification was sent. The user had no idea they were talking to a different AI.

Fix

Add _emit_status() calls in _recover_with_credential_pool() when credentials are rotated:

  • Billing exhaustion (402): "🔄 Credential exhausted (402) — rotated to: {entry_id}"
  • Rate limit (429): "🔄 Rate limited (429) — rotated to: {entry_id}"
  • Auth failure (401): "🔄 Auth failed (401) — rotated to: {entry_id}"

Also fixed _emit_status() to use getattr() for status_callback to handle edge cases where the attribute doesn't exist (e.g., in test agents).

Test Plan

  • All credential pool routing tests pass
  • Manual verification of status emission

Closes #10476

Fixes NousResearch#10476

Root cause: When credential pool exhaustion caused a provider switch,
no notification was sent to the user. This was inconsistent with the
fallback_model behavior which correctly notifies via _emit_status().

Fix: Add _emit_status() calls in _recover_with_credential_pool() when:
- Billing exhaustion (402) causes rotation
- Rate limit (429) causes rotation after retry
- Auth failure (401) causes rotation after refresh fails

Also fixed _emit_status() to use getattr() for status_callback to handle
test agents that don't have this attribute set.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

[Bug]: Credential pool provider fallback is silent — inconsistent with fallback_model notification behavior

2 participants