From b2b65441b69cd36d5e2a1086b10009ee14996fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E6=9B=9C?= Date: Wed, 17 Jun 2026 17:26:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(openapi):=20=E4=BF=AE=E6=AD=A3=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E8=AF=B7=E6=B1=82=E5=A4=B4=E8=B0=83=E8=AF=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户要求:处理 PR #119 中关于固定请求头日志和 async 测试 mock 的 review 意见。 实现思路: - debug 日志改为打印实际发送的 request_arguments - 避免过滤前 arguments 中的 header-like 参数进入日志 - 新增 fixed header async 测试的 __aexit__ 显式返回 False,避免吞异常 Signed-off-by: 黑曜 --- agentrun/tool/api/openapi.py | 5 +++-- tests/unittests/tool/test_openapi.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/agentrun/tool/api/openapi.py b/agentrun/tool/api/openapi.py index 3874fbb..1bca8f7 100644 --- a/agentrun/tool/api/openapi.py +++ b/agentrun/tool/api/openapi.py @@ -446,7 +446,8 @@ def call_tool( url, auth = self._build_ram_auth(url) logger.debug( - f"Calling FunctionCall tool: {method} {url} with args={arguments}" + "Calling FunctionCall tool:" + f" {method} {url} with args={request_arguments}" ) with httpx.Client( @@ -510,7 +511,7 @@ async def call_tool_async( logger.debug( f"Calling FunctionCall tool async: {method} {url} with" - f" args={arguments}" + f" args={request_arguments}" ) async with httpx.AsyncClient( diff --git a/tests/unittests/tool/test_openapi.py b/tests/unittests/tool/test_openapi.py index 1ce4041..0c99a48 100644 --- a/tests/unittests/tool/test_openapi.py +++ b/tests/unittests/tool/test_openapi.py @@ -966,7 +966,7 @@ async def test_call_tool_async_uses_fixed_headers_and_filters_arguments( mock_client_instance.__aenter__ = AsyncMock( return_value=mock_client_instance ) - mock_client_instance.__aexit__ = AsyncMock() + mock_client_instance.__aexit__ = AsyncMock(return_value=False) mock_async_client_class.return_value = mock_client_instance spec = json.dumps({