From 585e780db20b182cbd254e9845834f5d2ff81818 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:13:01 +0000 Subject: [PATCH] test(responses): cover namespace tools whose member list fails to parse in guardrail merge Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- basedpyright-code-budget.json | 2 +- .../test_openai_responses_guardrail_handler.py | 15 +++++++++++++++ type-discipline-budget.json | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/basedpyright-code-budget.json b/basedpyright-code-budget.json index 9997e5dc0c6..f38eb29be84 100644 --- a/basedpyright-code-budget.json +++ b/basedpyright-code-budget.json @@ -123,7 +123,7 @@ "limit": 5 }, "reportUnnecessaryIsInstance": { - "limit": 823 + "limit": 822 }, "reportUntypedBaseClass": { "limit": 0 diff --git a/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py b/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py index 7e624f39c53..fe54bb8c72a 100644 --- a/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py +++ b/tests/test_litellm/llms/openai/responses/test_openai_responses_guardrail_handler.py @@ -1406,6 +1406,21 @@ class TestOpenAIResponsesHandlerNamespaceTools: assert result["tools"] == tools + @pytest.mark.asyncio + async def test_namespace_with_unparseable_members_is_kept_once_and_unchanged(self): + handler = OpenAIResponsesHandler() + namespace_tool = {"type": "namespace", "name": "mcp__odd", "tools": ["confluence_get_page"]} + data = { + "input": [{"role": "user", "content": "fetch page 1", "type": "message"}], + "tools": [dict(namespace_tool)], + "model": "gpt-5.3-codex", + } + + result = await handler.process_input_messages(data, ToolAppendingGuardrail(guardrail_name="test")) + + assert result["tools"][0] == namespace_tool + assert [t["name"] for t in result["tools"]] == ["mcp__odd", "injected_tool"] + @pytest.mark.asyncio async def test_guardrail_can_still_drop_a_single_namespace_member(self): handler = OpenAIResponsesHandler() diff --git a/type-discipline-budget.json b/type-discipline-budget.json index 07bc874880f..4e7d7490fc8 100644 --- a/type-discipline-budget.json +++ b/type-discipline-budget.json @@ -1,9 +1,9 @@ { "LIT001": { - "limit": 22352 + "limit": 22346 }, "LIT002": { - "limit": 26774 + "limit": 26773 }, "LIT003": { "limit": 269 @@ -27,7 +27,7 @@ "limit": 0 }, "LIT010": { - "limit": 16504 + "limit": 16503 }, "LIT011": { "limit": 5535