[codex] Emit MCP tool calls as turn items#20677
Merged
Merged
Conversation
owenlin0
approved these changes
May 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
McpToolCallwas still an app-server item synthesized from deprecated legacy begin/end events. Recent item migrations moved this ownership into coreTurnItems, so MCP tool calls now follow the same canonical lifecycle and leave legacy events as compatibility fanout.Keeping the core item close to the v2
ThreadItem::McpToolCallshape also avoids spreading MCP result semantics across app-server conversion code. Core now owns whether a completed call iscompletedorfailed, and whether the payload is a tool result or an error.What changed
TurnItem::McpToolCallwith flattenedserver,tool,arguments,status,result, anderrorfields.ItemStarted/ItemCompletedaround directly constructed core MCP items.ThreadItem::McpToolCallwithout deriving status or splittingResultlocally.Verification
cargo test -p codex-protocolcargo test -p codex-app-server-protocolcargo test -p codex-core --lib mcp_tool_callcargo check -p codex-app-servercargo test -p codex-app-server mcp_tool_call_completion_notification_contains_truncated_large_result