fix(auxiliary): fallback to OPENROUTER_API_KEY env var when credential pool is exhausted#24720
Open
ambition0802 wants to merge 1 commit into
Conversation
…l pool is exhausted When the OpenRouter credential pool has entries but all are exhausted/rate-limited, previously the function returned (None, None) immediately without checking the OPENROUTER_API_KEY environment variable. This caused auxiliary tasks (compression, title generation, etc.) to fail with 'No LLM provider configured' even when a valid env var was present. Fixes NousResearch#23452
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.
Problem
When the OpenRouter credential pool has entries but all of them are exhausted/rate-limited (e.g. HTTP 429),
_try_openrouter()returns(None, None)without falling back to theOPENROUTER_API_KEYenvironment variable, even when that env var is valid and usable.This causes auxiliary tasks (title_generation, compression, session_search, vision, etc.) to fail with:
Meanwhile the main agent continues to work fine because it uses a different code path.
Root Cause
In
agent/auxiliary_client.py,_try_openrouter():_select_pool_entry("openrouter")returns(True, None)when the pool exists but all entries are in cooldownpool_present=True, the function bailed out immediately withreturn None, Nonewithout ever checkingos.getenv("OPENROUTER_API_KEY")Fix
When
pool_present=Truebut no usable entry is found, fall through to the env var check instead of returning early. Added an info log line to make this fallback visible in logs.Testing
Fixes #23452