From d8c00a8f4ebadec265582fb777081067a35f79d3 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 12 Oct 2026 15:00:00 -0400 Subject: [PATCH] fix(proxy): log all Caido SDK errors as warnings --- strix/tools/proxy/tools.py | 7 ++++--- tests/test_proxy_client.py | 9 +++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/strix/tools/proxy/tools.py b/strix/tools/proxy/tools.py index 0cf3f11f..d6b09e7e 100644 --- a/strix/tools/proxy/tools.py +++ b/strix/tools/proxy/tools.py @@ -13,6 +13,7 @@ from datetime import datetime from typing import TYPE_CHECKING, Any, Literal from agents import RunContextWrapper, function_tool +from caido_sdk_client import BaseError from strix.runtime.caido_handle import CaidoBootstrapHandle from strix.tools.nullish import clean_optional @@ -124,9 +125,9 @@ def _no_client() -> str: def _err(name: str, exc: Exception) -> str: - # The Caido SDK wraps its GraphQL timeout in an error with an empty message. - if isinstance(exc.__cause__, TimeoutError): - logger.warning("%s timed out", name) + # Caido-side failures (timeouts, bad filters, ...) are returned to the model, not our bugs. + if isinstance(exc, BaseError): + logger.warning("%s failed", name, exc_info=True) else: logger.exception("%s failed", name) return json.dumps( diff --git a/tests/test_proxy_client.py b/tests/test_proxy_client.py index a9c9660f..fba20787 100644 --- a/tests/test_proxy_client.py +++ b/tests/test_proxy_client.py @@ -13,6 +13,7 @@ from types import SimpleNamespace from typing import TYPE_CHECKING, Any, cast import pytest +from caido_sdk_client.errors import OperationUserError from strix.runtime.caido_handle import CaidoBootstrapHandle from strix.tools.proxy import caido_api, tools @@ -254,13 +255,9 @@ async def test_existing_request_ids_queries_current_project( assert looked_up == ["1042", "1088"] -def test_err_logs_caido_timeout_as_warning(caplog: pytest.LogCaptureFixture) -> None: - exc = RuntimeError() - exc.__cause__ = TimeoutError() - +def test_err_logs_caido_errors_as_warnings(caplog: pytest.LogCaptureFixture) -> None: with caplog.at_level("WARNING", logger="strix.tools.proxy.tools"): - tools._err("list_requests", exc) + tools._err("list_requests", OperationUserError("")) [record] = caplog.records assert record.levelname == "WARNING" - assert record.exc_info is None