fix(tests): accept select(model=) in sibling pool stubs; mirror per-model 429 docs to zh-Hans

_resolve_from_pool now calls pool.select(model=...) so the per-model
Anthropic cooldown can be honoured at resolve time. Two untouched sibling
test files stubbed the pool with `select=lambda: entry`, which rejects the
keyword and turned CI red (4 failures: TypeError unexpected keyword
argument 'model'). Widen both stubs to `lambda **_kw: entry`, the same
shape test_credential_pool_provider_boundary.py already uses.

Also carry the per-model 429 paragraph and the sibling-module bullet into
the zh-Hans credential-pools mirror, which the review flagged as stale.
This commit is contained in:
teknium1
2026-09-16 12:55:34 -07:00
committed by Teknium
parent 6de6e6da99
commit 3977a2ad1b
3 changed files with 5 additions and 3 deletions

View File

@@ -144,7 +144,7 @@ class TestPoolRuntimeResolution:
def _pool(self, entry):
return SimpleNamespace(
has_credentials=lambda: True,
select=lambda: entry,
select=lambda **_kw: entry,
)
@pytest.fixture

View File

@@ -82,7 +82,7 @@ def test_resolver_routes_copilot_by_target_model_for_every_credential_path(
)
pool = SimpleNamespace(
has_credentials=lambda: True,
select=lambda: entry,
select=lambda **_kw: entry,
)
monkeypatch.setattr(rp, "load_pool", lambda _provider: pool)
elif credential_source == "explicit":

View File

@@ -139,6 +139,8 @@ credential_pool_strategies:
`has_retried_429` 标志在每次成功的 API 调用后重置,因此单次瞬时 429 不会触发轮换。
**Anthropic 的 429 按模型计算。** Anthropic 按模型执行速率限制,因此某个 Claude 模型的通用 429 只会让该凭证对*该模型*冷却——同一密钥仍可继续服务其他 Claude 模型;计费(`402`、用量上限)和认证(`401`)失败仍会冷却整个凭证。
## 自定义端点池
自定义 OpenAI 兼容端点(Together.ai、RunPod、本地服务器)拥有各自的池,以 `config.yaml` 中 `custom_providers` 的端点名称作为键。
@@ -202,7 +204,7 @@ Hermes 在启动时自动从多个来源发现凭证并初始化池:
凭证池集成于提供商解析层:
1. **`agent/credential_pool.py`** — 池管理器:存储、选择、轮换、冷却时间
1. **`agent/credential_pool.py`** — 池管理器:存储、选择、轮换、冷却时间;**`agent/credential_pool_model_cooldowns.py`** 负责 Anthropic 按模型的 429 冷却
2. **`hermes_cli/auth_commands.py`** — CLI 命令和交互式向导
3. **`hermes_cli/runtime_provider.py`** — 感知池的凭证解析
4. **`run_agent.py`** — 错误恢复:429/402/401 → 池轮换 → 备用