From f6ca127cb10a8f9cfac9dcd4397e5dcbbf54d418 Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Sun, 3 May 2026 00:23:41 +0500 Subject: [PATCH] fix: filter custom_tool_call types in remove_all_tools handoff filter remove_all_tools strips hosted tool types from raw input history before a handoff so the next agent does not see the previous agent's tool plumbing. The list omitted custom_tool_call and custom_tool_call_output, so custom tool calls (used by CustomTool / ResponseCustomToolCall) leaked through after a handoff. Add the two types to the filter list and extend test_removes_hosted_tool_types_from_input_history to cover them. --- src/agents/extensions/handoff_filters.py | 2 ++ tests/test_extension_filters.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/agents/extensions/handoff_filters.py b/src/agents/extensions/handoff_filters.py index de44f1566a..14fd303f47 100644 --- a/src/agents/extensions/handoff_filters.py +++ b/src/agents/extensions/handoff_filters.py @@ -96,6 +96,8 @@ def _remove_tool_types_from_input( "shell_call_output", "apply_patch_call", "apply_patch_call_output", + "custom_tool_call", + "custom_tool_call_output", ] filtered_items: list[TResponseInputItem] = [] diff --git a/tests/test_extension_filters.py b/tests/test_extension_filters.py index 97924d2852..257f3fed5e 100644 --- a/tests/test_extension_filters.py +++ b/tests/test_extension_filters.py @@ -1041,6 +1041,8 @@ def test_removes_hosted_tool_types_from_input_history() -> None: "shell_call_output", "apply_patch_call", "apply_patch_call_output", + "custom_tool_call", + "custom_tool_call_output", ] input_items: list[TResponseInputItem] = [_get_message_input_item("Hello")] for t in hosted_types: