The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): provider alias spellings and an explicit auto pick keep the route
Tekniumd1cd3421871c
diff --git a/gateway/session_policy.py b/gateway/session_policy.pyindex ed94a7aa711..04bdacd06eb 100644--- a/gateway/session_policy.py+++ b/gateway/session_policy.py@@ -355,6 +355,9 @@ def _apply_launch_overrides(params, config):from hermes_cli.config import resolve_turn_limitfrom hermes_constants import parse_reasoning_effortfrom gateway.session_route_identity import resolved_route+ if isinstance(params.get('provider'), str) and params['provider'].strip().lower() == 'auto':+ # `auto` is the thin client's "no pick" sentinel: the profile's route stands as configured.+ params = {k: v for k, v in params.items() if k != 'provider'}held_cfg = dict(config.get('model') or {}) if isinstance(config.get('model'), dict) else {}if str(held_cfg.get('provider') or '').strip().lower() in ('', 'auto') and str(held_cfg.get('base_url') or '').strip():# A block with an endpoint and no provider (or `auto`) already routes to `custom` there.diff --git a/tests/gateway/test_session_policy.py b/tests/gateway/test_session_policy.pyindex 377f3b10dae..0fa3df4a31e 100644--- a/tests/gateway/test_session_policy.py+++ b/tests/gateway/test_session_policy.py@@ -223,6 +223,31 @@ def test_custom_pick_over_unrecorded_or_auto_profile_keeps_its_endpoint(tmp_path('custom', 'http://localhost:1234/v1', 'sk-local'), held+def test_provider_alias_spelling_and_auto_pick_keep_the_profiles_route(tmp_path, monkeypatch):+ """`deepinfra` and `deep-infra` are one provider, and an explicit `auto` pick (the thin-client+ sentinel) means "the profile's route": neither drops the configured proxy and wire mode."""+ from gateway.session_policy import build_policy+ from hermes_cli.runtime_provider import frozen_runtime_config, resolve_runtime_provider+ for var in ('CUSTOM_BASE_URL', 'OPENAI_BASE_URL'):+ monkeypatch.delenv(var, raising=False)+ monkeypatch.setenv('DEEPINFRA_API_KEY', 'sk-deepinfra')+ for held, picked in (('deepinfra', 'deep-infra'), ('deep-infra', 'deepinfra')):+ cfg = {'model': {'default': 'm', 'provider': held, 'base_url': 'http://localhost:4321/v1',+ 'api_mode': 'chat_completions'}}+ model = build_policy(dict(cwd=str(tmp_path), model='m', provider=picked), cfg).config()['model']+ assert (model['base_url'], model['api_mode']) == ('http://localhost:4321/v1', 'chat_completions'), picked+ monkeypatch.setenv('LOCAL_KEY', 'sk-local')+ cfg = {'model': {'default': 'qwen', 'provider': 'custom', 'base_url': 'http://localhost:1234/v1',+ 'key_env': 'LOCAL_KEY'}}+ monkeypatch.delenv('DEEPINFRA_API_KEY')+ policy = build_policy(dict(cwd=str(tmp_path), model='qwen', provider='auto'), cfg)+ assert policy.config()['model']['provider'] == 'custom'+ with frozen_runtime_config(policy.config()):+ runtime = resolve_runtime_provider(target_model='qwen')+ assert (runtime['provider'], runtime['base_url'], runtime['api_key']) == \+ ('custom', 'http://localhost:1234/v1', 'sk-local')++def test_unlimited_max_turns_spellings_create_an_uncapped_session(tmp_path):"""`--max-turns 0` / -1 / none / unlimited meant "no cap" before the gateway cutover: session.createfreezes them as the unlimited budget, and `hermes chat` sends 0 instead of dropping it as falsy."""