mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-23 10:42:00 +00:00
* feat(providers): remove google-gemini-cli + google-antigravity OAuth providers Google now actively bans accounts for third-party tools that piggyback on Gemini CLI / Antigravity / Code Assist OAuth, and because abuse prevention sits at a backend layer the ban can extend to the entire Google account (Gmail/Drive), with a second violation being permanent. Ref: https://github.com/google-gemini/gemini-cli/discussions/20632 Removes both OAuth inference providers entirely (modules, provider profiles, auth/runtime/config/models wiring, the /gquota Code Assist quota command, the antigravity-cli optional skill, desktop + docs surface in en + zh-Hans). The API-key 'gemini' provider (GOOGLE_API_KEY/GEMINI_API_KEY against generativelanguage.googleapis.com) is unaffected and stays fully supported. * fix(skills): keep the antigravity-cli skill — only the OAuth provider is removed The antigravity-cli optional skill orchestrates the external `agy` binary as a coding-agent tool via the terminal tool — it does NOT wrap Hermes inference through the banned google-antigravity OAuth provider, so it carries none of the account-ban risk that motivated removing that provider. Restore the skill, its docs page, the sidebar entry, and the optional-skills catalog row. The google-antigravity / google-gemini-cli inference providers stay fully removed.
78 lines
2.6 KiB
Python
78 lines
2.6 KiB
Python
"""Regression tests for #13636 — CloudCode / Gemini CLI rate-limit fallback.
|
|
|
|
_pool_may_recover_from_rate_limit() is the hinge between credential-pool
|
|
rotation and fallback-provider activation. For CloudCode (Gemini CLI /
|
|
Gemini OAuth) the 429 is an account-wide throttle, so waiting for pool
|
|
rotation is pointless — prefer fallback immediately.
|
|
"""
|
|
import inspect
|
|
from unittest.mock import MagicMock
|
|
|
|
from agent import conversation_loop
|
|
from run_agent import _pool_may_recover_from_rate_limit
|
|
|
|
|
|
def _pool(entries: int = 2):
|
|
p = MagicMock()
|
|
p.has_available.return_value = True
|
|
p.entries.return_value = list(range(entries))
|
|
return p
|
|
|
|
|
|
def test_cloudcode_provider_skips_pool_rotation():
|
|
assert _pool_may_recover_from_rate_limit(
|
|
_pool(entries=3),
|
|
provider="auto",
|
|
base_url="cloudcode-pa://google",
|
|
) is False
|
|
|
|
|
|
def test_cloudcode_base_url_skips_pool_rotation_even_on_alias_provider():
|
|
# Even if the provider label is something else, a cloudcode-pa:// URL
|
|
# signals the account-wide quota regime.
|
|
assert _pool_may_recover_from_rate_limit(
|
|
_pool(entries=3),
|
|
provider="custom-provider",
|
|
base_url="cloudcode-pa://google",
|
|
) is False
|
|
|
|
|
|
def test_non_cloudcode_multi_entry_pool_still_recovers():
|
|
assert _pool_may_recover_from_rate_limit(
|
|
_pool(entries=3),
|
|
provider="openrouter",
|
|
base_url="https://openrouter.ai/api/v1",
|
|
) is True
|
|
|
|
|
|
def test_single_entry_pool_skips_rotation_regardless_of_provider():
|
|
# Pre-existing single-entry-pool exception (#11314) still holds.
|
|
assert _pool_may_recover_from_rate_limit(
|
|
_pool(entries=1),
|
|
provider="openrouter",
|
|
base_url="https://openrouter.ai/api/v1",
|
|
) is False
|
|
|
|
|
|
def test_exhausted_pool_skips_rotation():
|
|
p = MagicMock()
|
|
p.has_available.return_value = False
|
|
assert _pool_may_recover_from_rate_limit(p) is False
|
|
|
|
|
|
def test_no_pool_skips_rotation():
|
|
assert _pool_may_recover_from_rate_limit(None) is False
|
|
|
|
|
|
def test_conversation_loop_resolves_pool_helper_through_run_agent_module():
|
|
"""Extracted conversation loop must honor tests/patches on run_agent.
|
|
|
|
conversation_loop intentionally lazy-loads run_agent via _ra(). If this
|
|
call site uses a bare imported helper, monkeypatching run_agent in tests (and
|
|
production wrappers that patch run_agent) will not propagate into the
|
|
extracted loop; older code also hit NameError in this branch.
|
|
"""
|
|
source = inspect.getsource(conversation_loop.run_conversation)
|
|
|
|
assert "_ra()._pool_may_recover_from_rate_limit(" in source
|
|
assert "pool_may_recover = _pool_may_recover_from_rate_limit(" not in source
|