fix: fallback chain nous normalization + same-provider rate-limit dedup - #19
Merged
OmarB97 merged 1 commit intoMay 28, 2026
Merged
Conversation
Two systemic bugs in the fallback provider chain: 1. nous provider was misclassified as _AGGREGATOR_PROVIDERS, causing _prepend_vendor() to keep the nousresearch/ prefix when falling back to the Nous direct API (inference-api.nousresearch.com). The direct API expects bare model names like hermes-4-70b, not nousresearch/hermes-4-70b, resulting in HTTP 400 'Bad Request'. Fix: Move nous from _AGGREGATOR_PROVIDERS to _MATCHING_PREFIX_STRIP_PROVIDERS and add 'nousresearch' as a provider alias for 'nous' so _strip_matching_provider_prefix() correctly strips the nousresearch/ prefix. 2. _try_activate_fallback() only deduped entries matching the exact (provider, model) pair. When the primary provider (e.g. opencode-zen) was rate-limited, all fallback entries on the same provider would also hit the same 429, burning the retry budget pointlessly. Fix: When the trigger is a rate-limit (429) or billing error and an active cooldown is set, skip fallback entries on the same provider. Different providers are still tried normally. Files changed: - hermes_cli/model_normalize.py: Move nous from aggregator to matching-prefix-strip - hermes_cli/models.py: Add nousresearch → nous alias - agent/chat_completion_helpers.py: Add same-provider rate-limit dedup - tests/hermes_cli/test_model_normalize.py: Update nous normalization tests - tests/run_agent/test_provider_fallback.py: Add same-provider cooldown test Refs: fallback-chain-nous-normalization-same-provider-rate
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
1 |
First entries
tests/run_agent/test_provider_fallback.py:315: [unresolved-import] unresolved-import: Cannot resolve imported module `hermes_cli.failover`
✅ Fixed issues: none
Unchanged: 5029 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
OmarB97
deleted the
fix/fallback-chain-nous-normalization-same-provider-dedup
branch
May 28, 2026 17:11
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
Two systemic bugs in the fallback provider chain:
Bug 1: nous provider misclassified as aggregator → HTTP 400
The
nousprovider was in_AGGREGATOR_PROVIDERS, causing_prepend_vendor()to keep thenousresearch/prefix when falling back to the Nous direct API (inference-api.nousresearch.com). The direct API expects bare model names likehermes-4-70b, notnousresearch/hermes-4-70b, resulting in HTTP 400 "Bad Request".Fix: Move
nousfrom_AGGREGATOR_PROVIDERSto_MATCHING_PREFIX_STRIP_PROVIDERSand addnousresearchas a provider alias fornousso_strip_matching_provider_prefix()correctly strips thenousresearch/prefix.Bug 2: same-provider rate-limit loop → all fallbacks hit same 429
_try_activate_fallback()only deduped entries matching the exact(provider, model)pair. When the primary provider (e.g. opencode-zen) was rate-limited, all fallback entries on the same provider would also hit the same 429, burning the retry budget pointlessly.Fix: When the trigger is a rate-limit (429) or billing error and an active cooldown is set, skip fallback entries on the same provider. Different providers are still tried normally.
Files Changed
hermes_cli/model_normalize.py: Move nous from aggregator to matching-prefix-striphermes_cli/models.py: Addnousresearch→nousaliasagent/chat_completion_helpers.py: Add same-provider rate-limit deduptests/hermes_cli/test_model_normalize.py: Update nous normalization teststests/run_agent/test_provider_fallback.py: Add same-provider cooldown testTesting
test_provider_fallback.pyare unrelated (test setup issue)