From cdb55de8743aa41e53ad6b207ef3f7fa23bbab2b Mon Sep 17 00:00:00 2001 From: Illia Oleksiuk Date: Tue, 12 May 2026 17:11:55 -0700 Subject: [PATCH] fix: filter hosted_tool_call types in remove_all_tools handoff filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend the fix in #3095 to cover one more raw input item type that the handoff filter was missing. `hosted_tool_call` is a real tool-call type recognized elsewhere in the SDK — see `src/agents/run_state.py:2024` (raw item normalization) and `src/agents/run_internal/tool_execution.py:2368` (hosted MCP approval request detection, which checks for `type == "hosted_tool_call"` plus `provider_data.type == "mcp_approval_request"`). However, the `_remove_tool_types_from_input` filter in `src/agents/extensions/handoff_filters.py` did not include it, so raw `hosted_tool_call` items survived `remove_all_tools` handoff filtering. Add `hosted_tool_call` to the filter list and to the parametrized list in the existing `test_removes_hosted_tool_types_from_input_history` regression test. --- src/agents/extensions/handoff_filters.py | 1 + tests/test_extension_filters.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/agents/extensions/handoff_filters.py b/src/agents/extensions/handoff_filters.py index f24dd1658c..2986685d5a 100644 --- a/src/agents/extensions/handoff_filters.py +++ b/src/agents/extensions/handoff_filters.py @@ -104,6 +104,7 @@ def _remove_tool_types_from_input( "apply_patch_call_output", "custom_tool_call", "custom_tool_call_output", + "hosted_tool_call", ] filtered_items: list[TResponseInputItem] = [] diff --git a/tests/test_extension_filters.py b/tests/test_extension_filters.py index a4b95f792a..113340c1f4 100644 --- a/tests/test_extension_filters.py +++ b/tests/test_extension_filters.py @@ -1130,6 +1130,7 @@ def test_removes_hosted_tool_types_from_input_history() -> None: "apply_patch_call_output", "custom_tool_call", "custom_tool_call_output", + "hosted_tool_call", ] input_items: list[TResponseInputItem] = [_get_message_input_item("Hello")] for t in hosted_types: