Skip to content

fix(agent): bypass credential-pool guard for billing errors in eager fallback#23323

Open
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/issue-23138-eager-fallback-billing
Open

fix(agent): bypass credential-pool guard for billing errors in eager fallback#23323
liuhao1024 wants to merge 3 commits into
NousResearch:mainfrom
liuhao1024:fix/issue-23138-eager-fallback-billing

Conversation

@liuhao1024

@liuhao1024 liuhao1024 commented May 10, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

When the primary provider returns HTTP 402 (credit exhaustion), the eager-fallback path is blocked by _pool_may_recover_from_rate_limit() when a multi-entry credential pool exists. This causes the agent to burn through all retries against a depleted provider instead of immediately switching to the configured fallback.

Related Issue

N/A

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • See commit messages for detailed changes

How to Test

  1. Run pytest tests/ -q — all tests should pass
  2. Verify the specific scenario described above is resolved

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 26.4.1

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture and workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A

liuhao1024 and others added 3 commits April 24, 2026 22:14
…INSTALL_TIMEOUT

Increase the default npm install timeout for WhatsApp bridge from 60s
to 300s (5 minutes) to accommodate slower systems like Unraid NAS.
Make it configurable via WHATSAPP_NPM_INSTALL_TIMEOUT environment variable
for users who need even longer timeouts.

Closes NousResearch#14980
- Add 'path', 'old_string', 'new_string', and 'patch' to required list
- Update description to clarify mode-specific parameter requirements
- This addresses issue where LLMs would omit these parameters because
  they were not marked as required in the schema, even though they
  are required depending on the mode

Fixes NousResearch#15524
…fallback

When the primary provider returns HTTP 402 (credit exhaustion), the
eager-fallback path was blocked by _pool_may_recover_from_rate_limit()
when a multi-entry credential pool existed.  For billing errors,
credential rotation cannot help — it is an account-level issue, not a
per-key rate limit.  The pool rotation in _recover_with_credential_pool()
already attempted all entries before reaching this point.

Skip the pool-recovery check for FailoverReason.billing so the fallback
provider activates on the first 402 instead of burning through retries.

Fixes NousResearch#23138
@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/agent Core agent loop, run_agent.py, prompt builder labels May 10, 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 P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants