mirror of
https://github.com/usestrix/strix.git
synced 2026-11-09 05:19:39 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98707a785a | ||
|
|
b58d3ac3c6 |
No files matched your search
@@ -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,7 +125,11 @@ def _no_client() -> str:
|
||||
|
||||
|
||||
def _err(name: str, exc: Exception) -> str:
|
||||
logger.exception("%s failed", 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(
|
||||
{"success": False, "error": f"{name} failed: {exc}"},
|
||||
ensure_ascii=False,
|
||||
|
||||
@@ -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
|
||||
@@ -252,3 +253,11 @@ async def test_existing_request_ids_queries_current_project(
|
||||
|
||||
assert existing == {"1042"}
|
||||
assert looked_up == ["1042", "1088"]
|
||||
|
||||
|
||||
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", OperationUserError(""))
|
||||
|
||||
[record] = caplog.records
|
||||
assert record.levelname == "WARNING"
|
||||
Reference in new issue
Block a user