The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): one wildcard-host predicate for the HTTP listeners
kshitijk4pooraaaca43c8427
diff --git a/gateway/platforms/shared_ingress.py b/gateway/platforms/shared_ingress.pyindex ae3db657e68..8018ce1290f 100644--- a/gateway/platforms/shared_ingress.py+++ b/gateway/platforms/shared_ingress.py@@ -24,6 +24,11 @@ logger = logging.getLogger(__name__)_WILDCARD_HOSTS = frozenset({"", "0.0.0.0", "::", "*"})+def is_wildcard_host(host: Any) -> bool:+ """True for the dual-stack default (None/"") and the per-family wildcards."""+ return host is None or str(host).strip() in _WILDCARD_HOSTS++def shared_ingress_profile(adapter: Any) -> Optional[str]:"""Profile name when *adapter* was constructed in shared-listener mode, else None."""return getattr(adapter, "_shared_listener_profile", None) or None@@ -31,7 +36,7 @@ def shared_ingress_profile(adapter: Any) -> Optional[str]:def listener_base_url(host: Any, port: Any) -> str:"""``http://host:port`` clients use to reach a listener bound on ``host`` (wildcards → loopback)."""- host = "127.0.0.1" if host is None or str(host).strip() in _WILDCARD_HOSTS else str(host)+ host = "127.0.0.1" if is_wildcard_host(host) else str(host)if ":" in host and not host.startswith("["):host = f"[{host}]"return f"http://{host}:{port or 0}"diff --git a/gateway/platforms/tcp_site.py b/gateway/platforms/tcp_site.pyindex 6160075a5a4..6be1aa63b20 100644--- a/gateway/platforms/tcp_site.py+++ b/gateway/platforms/tcp_site.py@@ -10,15 +10,9 @@ from typing import Optionalfrom aiohttp import web-logger = logging.getLogger(__name__)--_WILDCARD_HOSTS = frozenset({"0.0.0.0", "::"})---def is_wildcard_host(host: Optional[str]) -> bool:- """True for the dual-stack default (None/"") and the per-family wildcards."""- return not host or host.strip() in _WILDCARD_HOSTS+from gateway.platforms.shared_ingress import is_wildcard_host+logger = logging.getLogger(__name__)def has_live_listener(host: str, port: int) -> bool:"""Blocking probe: True when something accepts connections on ``host:port``. Refused = nobody listens;