The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): keep broad connection phrases out of the provider-error gate
Christopher3a61fa86fac6
diff --git a/gateway/run.py b/gateway/run.pyindex cad1a4d75ab..443af35d0d4 100644--- a/gateway/run.py+++ b/gateway/run.py@@ -727,11 +727,6 @@ _GATEWAY_PROVIDER_ERROR_SHAPE_RE = re.compile(r"|actively\s+refused"r"|winerror\s+10061"r"|errno\s+111"- r"|no\s+route\s+to\s+host"- r"|network\s+is\s+unreachable"- r"|cannot\s+connect"- r"|failed\s+to\s+establish"- r"|could\s+not\s+connect"r"|all\s+connection\s+attempts\s+failed"r")",re.IGNORECASE,diff --git a/tests/gateway/test_local_model_connection_reply.py b/tests/gateway/test_local_model_connection_reply.pyindex b82595c450e..ae52e318a71 100644--- a/tests/gateway/test_local_model_connection_reply.py+++ b/tests/gateway/test_local_model_connection_reply.py@@ -17,8 +17,6 @@ class TestGatewayConnectionErrorReply:"ConnectionError: [WinError 10061] No connection could be made","Errno 111 Connection refused","All connection attempts failed: Connection refused",- "cannot connect to http://127.0.0.1:8033/v1",- "failed to establish a new connection",]for text in samples:assert _looks_like_gateway_provider_error(text), text@@ -26,6 +24,22 @@ class TestGatewayConnectionErrorReply:assert "not responding" in reply.lower(), textassert "not running or is unreachable" in reply, text+ def test_broad_connection_phrases_still_map_once_classified(self):+ """Reply selector keeps the full phrase set; the gate does not."""+ for text in (+ "cannot connect to http://127.0.0.1:8033/v1",+ "failed to establish a new connection",+ ):+ reply = _gateway_provider_error_reply(text)+ assert "not running or is unreachable" in reply, text++ def test_prose_cannot_connect_is_not_a_provider_error(self):+ text = (+ "cannot connect to the office VPN from this cafe, "+ "so I used the backup notes instead"+ )+ assert not _looks_like_gateway_provider_error(text)+def test_other_errors_keep_generic_reply(self):for text in ("RuntimeError: model returned empty content",