Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions safety/auth/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def call_enrollment_endpoint(
) -> dict:
"""Public wrapper — delegates to platform_client.enroll().

Catches transient network errors (httpx.NetworkError, httpx.TimeoutException)
Catches transient network errors (httpx.ConnectError, httpx.TimeoutException)
that tenacity re-raises after retry exhaustion and wraps them in
EnrollmentTransientFailure (exit code 75) so MDM orchestrators can
distinguish retryable failures from permanent ones.
Expand Down Expand Up @@ -60,7 +60,7 @@ def call_enrollment_endpoint(
# Broader than @retry's types: also wraps ReadError/WriteError/CloseError
# (transient, but not retried) as exit-code 75 for MDM orchestrators.
# Excludes ProtocolError / UnsupportedProtocol (non-transient config bugs).
except (httpx.NetworkError, httpx.TimeoutException) as exc:
except (httpx.ConnectError, httpx.TimeoutException) as exc:
raise EnrollmentTransientFailure(
f"Enrollment failed after retries: {exc}"
) from exc
2 changes: 1 addition & 1 deletion safety/events/handlers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ async def _build_context_data(self, obj: Optional["SafetyCLI"]) -> "EventContext
stop=stop_after_attempt(3),
wait=wait_exponential(multiplier=0.1, min=0.2, max=1.0),
retry=retry_if_exception_type(
(httpx.NetworkError, httpx.TimeoutException, httpx.HTTPStatusError)
(httpx.ConnectError, httpx.TimeoutException, httpx.HTTPStatusError)
),
before_sleep=before_sleep_log(logging.getLogger("api_client"), logging.WARNING),
)
Expand Down