fix(gateway): keep broad connection phrases out of the provider-error gate

Fixes #86570
This commit is contained in:
Christopher
2026-08-15 21:28:40 +02:00
committed by Teknium
parent 5cfa2b2f0f
commit 3a61fa86fa
2 changed files with 16 additions and 7 deletions
-5
View File
@@ -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,
@@ -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(), text
assert "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",