Skip to content

fix(handoffs): preserve HandoffInputData.input_items in remove_all_tools#3253

Merged
seratch merged 2 commits intoopenai:mainfrom
adityasingh2400:fix/handoff-preserve-input-items
May 9, 2026
Merged

fix(handoffs): preserve HandoffInputData.input_items in remove_all_tools#3253
seratch merged 2 commits intoopenai:mainfrom
adityasingh2400:fix/handoff-preserve-input-items

Conversation

@adityasingh2400
Copy link
Copy Markdown
Contributor

Summary

remove_all_tools rebuilds HandoffInputData via its constructor and silently drops the input_items field. The model-input pipeline (turn_resolution.py:484, :500) reads input_items when set — for example after nest_handoff_history populates it — so chained filters previously caused tool calls to leak into the next agent's input.

This switches to handoff_input_data.clone(...) (which preserves all fields) and also strips tool RunItems from input_items so the field remains consistent with the rest of the filtered data.

Repro

from agents.extensions.handoff_filters import nest_handoff_history, remove_all_tools

nested = nest_handoff_history(data)        # populates nested.input_items
filtered = remove_all_tools(nested)
assert filtered.input_items is not None    # fails on main, passes with fix

Test plan

  • New unit test test_remove_all_tools_preserves_and_filters_input_items fails on main (AssertionError: assert None is not None) and passes with the fix.
  • All 37 existing tests in tests/test_extension_filters.py continue to pass.
  • tests/test_handoff_prompt.py continues to pass.

The previous implementation rebuilt HandoffInputData via the constructor and
silently dropped input_items. The model-input pipeline reads input_items when
set (e.g. after nest_handoff_history), so chained filters caused tool calls to
leak through. Use clone() and also strip tools from input_items.
@github-actions github-actions Bot added bug Something isn't working feature:extensions labels May 8, 2026
@seratch seratch marked this pull request as draft May 8, 2026 17:46
@seratch seratch marked this pull request as ready for review May 9, 2026 03:41
@seratch seratch added this to the 0.17.x milestone May 9, 2026
@seratch seratch merged commit 29b2acf into openai:main May 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants