The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(gateway): a legacy custom_providers entry is named by its display name
unsupportedpastels492309463b08
diff --git a/gateway/session_policy.py b/gateway/session_policy.pyindex 47f36307666..bdd170b5403 100644--- a/gateway/session_policy.py+++ b/gateway/session_policy.py@@ -433,8 +433,8 @@ def _with_entry_pick(params, config):A configured entry keyed like a canonical built-in (`providers: deepseek`) is shadowed by thebuilt-in in raw provider resolution, so the bare spelling would route, and be frozen, as adifferent provider than the entry the profile runs (#140107). Only the held entry's bare key- is that entry (Desktop's guard); its display name may be a real built-in, and a pick of that- built-in keeps the built-in. Every other pick stays as it came.+ is that entry (Desktop's guard). A keyed entry's display name is not; a keyless legacy+ ``custom_providers:`` entry's is (``configured_entry_key``). Other picks stay as they came."""from gateway.session_route_identity import configured_entry_key, profile_route_identitypicked = params.get('provider')diff --git a/gateway/session_route_identity.py b/gateway/session_route_identity.pyindex aa99536a515..70441165ace 100644--- a/gateway/session_route_identity.py+++ b/gateway/session_route_identity.py@@ -39,8 +39,11 @@ def configured_entry_key(identity: str, config: dict) -> str:Raw provider resolution defers a bare name that is a canonical built-in to the built-in, so a``providers:`` entry keyed ``deepseek`` is reachable only through its ``custom:`` spelling. Only- that key names the entry: its display name may be a real built-in's slug (``name: OpenRouter``- on ``providers.work``), and a pick of that built-in is not this endpoint (#140107).+ that key names a keyed entry: its display name may be a real built-in's slug (``name: OpenRouter``+ on ``providers.work``), and a pick of that built-in is not this endpoint (#140107). A legacy+ ``custom_providers:`` entry has no key, so its normalized display name is its identity and its+ key here (``custom_provider_slug``): ``name: OpenRouter`` there answers ``openrouter``, as+ Desktop's ``customDefaultSupersedesPick`` does."""identity = str(identity or '').strip().lower()if not identity.startswith('custom:') or not _named_entry(identity, config):diff --git a/tests/gateway/test_session_route_identity.py b/tests/gateway/test_session_route_identity.pyindex 7cd5e5b4c8a..686949c8b74 100644--- a/tests/gateway/test_session_route_identity.py+++ b/tests/gateway/test_session_route_identity.py@@ -32,6 +32,23 @@ def test_resolved_route_identity_and_url():assert resolved_route({'provider': ''}, CONFIG) == ('auto', '')+def test_configured_entry_key_is_the_key_or_a_legacy_entrys_display_name():+ """A keyed ``providers:`` entry is named by its key, never its display name. A legacy+ ``custom_providers:`` entry has no key, so its normalized display name is its identity, the+ same rule as Desktop's ``customDefaultSupersedesPick``."""+ from gateway.session_route_identity import configured_entry_key, profile_route_identity++ def held_key(entries, provider):+ config = {**entries, 'model': {'provider': provider}}+ return configured_entry_key(profile_route_identity(config), config)+ keyed = {'providers': {'work': {'name': 'OpenRouter', 'base_url': A}}}+ legacy = {'custom_providers': [{'name': 'OpenRouter', 'base_url': A}]}+ assert held_key(keyed, 'custom:work') == 'work'+ assert held_key(keyed, 'custom:openrouter') == 'work'+ assert held_key(legacy, 'custom:openrouter') == 'openrouter'+ assert held_key({}, 'openrouter') == ''++def test_route_bound_keys_cover_route_wire_window_and_credentials():assert isinstance(ROUTE_BOUND_KEYS, tuple)for key in ('provider', 'base_url', 'api_mode', 'context_length',