Skip to content

[core] Drop parent MCP lifecycle events from forked agent history - #30977

Closed
chess-oai wants to merge 1 commit into
mainfrom
chess/strip-inherited-mcp-events
Closed

chess-oai wants to merge 1 commit into
mainfrom
chess/strip-inherited-mcp-events

Conversation

@chess-oai

Copy link
Copy Markdown
Contributor

summary

  • exclude inherited McpToolCallBegin and McpToolCallEnd events when constructing forked agent history
  • preserve the complete MCP history in the parent rollout while keeping parent tool execution state out of the child
  • drop both lifecycle halves so legacy histories cannot create an orphaned in-progress tool call

why

#16709 stripped parent tool and reasoning items from forked history, but retained every EventMsg

MCP results are also persisted in McpToolCallEnd events and may contain large text, structured output, or embedded resources. Forks that retain those parent events serialize the same result payloads into each child rollout, multiplying disk writes, rollout size, and later read and parse work as agent fan-out grows

These events describe calls already executed by the parent and do not contribute to the child model context, so filtering them completes the existing fork sanitizer boundary without changing active MCP execution or parent history

testing

  • just test -p codex-core forked_rollout_item_filter_drops_mcp_tool_call_lifecycle
  • just test -p codex-core spawn_agent_can_fork_parent_thread_history_with_sanitized_items
  • just fmt

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@chess-oai
chess-oai force-pushed the chess/strip-inherited-mcp-events branch from 7d76026 to 25fe424 Compare July 3, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant