Skip to content

Automate browser based workflows with AI

Treat an unreachable SOCKS proxy as proxy-sensitive, not a retriable navigation error (SKY-14862) (#8278)

Andrew Neilsonb549b6716b58
diff --git a/skyvern/constants.py b/skyvern/constants.py
index e9ab26849..d3fd8ef9a 100644
--- a/skyvern/constants.py
+++ b/skyvern/constants.py
@@ -34,6 +34,8 @@ PROXY_SENSITIVE_NAV_ERRORS = (
"net::ERR_NAME_NOT_RESOLVED",
"net::ERR_NAME_RESOLUTION_FAILED",
"net::ERR_TUNNEL_CONNECTION_FAILED",
+ "net::ERR_SOCKS_CONNECTION_FAILED",
+ "net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE",
"net::ERR_CERT_",
"net::ERR_SSL_",
)
diff --git a/tests/unit/test_copilot_non_retriable_nav.py b/tests/unit/test_copilot_non_retriable_nav.py
index 729582469..7a94dedff 100644
--- a/tests/unit/test_copilot_non_retriable_nav.py
+++ b/tests/unit/test_copilot_non_retriable_nav.py
@@ -34,6 +34,9 @@ _CERT_FAILURE_REASON = "Failed to navigate to url https://expired.example. Error
_TUNNEL_FAILURE_REASON = (
"Failed to navigate to url https://proxy.example. Error message: net::ERR_TUNNEL_CONNECTION_FAILED"
)
+_SOCKS_FAILURE_REASON = (
+ "Failed to navigate to url https://www.example.test/. Error message: net::ERR_SOCKS_CONNECTION_FAILED"
+)
_GENERIC_FAILURE_REASON = "Timeout waiting for element #submit"
@@ -64,6 +67,11 @@ def _fresh_context() -> CopilotContext:
pytest.param("net::ERR_NAME_RESOLUTION_FAILED happened mid-flight", id="name_resolution_mid_string"),
pytest.param("SSL error: net::ERR_SSL_PROTOCOL_ERROR", id="ssl_prefixed"),
pytest.param(_TUNNEL_FAILURE_REASON, id="tunnel_connection_failed"),
+ pytest.param(_SOCKS_FAILURE_REASON, id="socks_connection_failed"),
+ pytest.param(
+ "Failed to navigate to url https://x.test. Error message: net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE",
+ id="socks_host_unreachable",
+ ),
],
)
def test_detect_matches_error_in_block_failure_reason(reason: str) -> None:
@@ -309,17 +317,24 @@ def test_exception_carries_url_and_error_message() -> None:
# ---------------------------------------------------------------------------
-def test_full_flow_record_then_check_then_raise() -> None:
+ "reason",
+ [
+ pytest.param(_DNS_FAILURE_REASON, id="dns"),
+ pytest.param(_SOCKS_FAILURE_REASON, id="socks_connection_failed"),
+ ],
+)
+def test_full_flow_record_then_check_then_raise(reason: str) -> None:
ctx = _fresh_context()
ctx.test_after_update_done = True
- # Simulate a failed run with a DNS error.
_record_run_blocks_result(
ctx,
{
"ok": False,
- "data": {"blocks": [{"failure_reason": _DNS_FAILURE_REASON}]},
+ "data": {"blocks": [{"failure_reason": reason}]},
},
)
+ assert ctx.last_test_non_retriable_nav_error == reason
# The exit-path guard raises because last_test_ok is still False.
with pytest.raises(CopilotNonRetriableNavError):
_maybe_raise_non_retriable_nav(ctx)
diff --git a/tests/unit_tests/webeye/test_navigation_retry.py b/tests/unit_tests/webeye/test_navigation_retry.py
index 415c9c189..1d9b8bf92 100644
--- a/tests/unit_tests/webeye/test_navigation_retry.py
+++ b/tests/unit_tests/webeye/test_navigation_retry.py
@@ -81,6 +81,8 @@ def _redirect_response(*urls: str) -> _FakeResponse:
pytest.param("net::ERR_CERT_AUTHORITY_INVALID", id="cert-authority-invalid"),
pytest.param("net::ERR_CERT_DATE_INVALID", id="cert-date-invalid"),
pytest.param("net::ERR_SSL_PROTOCOL_ERROR", id="ssl-protocol-error"),
+ pytest.param("net::ERR_SOCKS_CONNECTION_FAILED", id="socks-connection-failed"),
+ pytest.param("net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE", id="socks-host-unreachable"),
],
)
@pytest.mark.asyncio