Skip to content

Conversation

@DanieleMorotti
Copy link
Contributor

Hi,

this PR should fix the bug in #2171 , the proposed script now runs correctly.

I added an additional test to better cover this case.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +94 to +98
for run_item in handoff_input_data.new_items:
plain_input = _run_item_to_plain_input(run_item)
new_items_as_inputs.append(plain_input)
if _should_forward_new_item(plain_input):
filtered_new_items.append(run_item)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve handoff tool items when nesting history

The new filtering of new_items drops any run item whose input type is in _SUMMARY_ONLY_INPUT_TYPES (e.g., function_call and function_call_output). With nest_handoff_history=True—the default when a handoff occurs—this loop removes both the HandoffCallItem and HandoffOutputItem produced during the handoff. Those filtered new_items are assigned to SingleStepResult.new_step_items, which AgentRunner then writes to the session/stream as the only records of the turn on the handoff path (see run.py lines 740‑748). After this change, the handoff tool call/output silently vanish from persisted session history and streamed events even though they actually happened, reducing observability of handoffs. The duplication fix should avoid forwarding these to the next agent without removing them from the turn’s recorded items.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, we need to handle this. Any suggestions?

@seratch seratch added bug Something isn't working feature:core labels Dec 12, 2025
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:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants