test(codex): coverage for MCP tool calls (SIG-198)#171
Merged
GuyMoses merged 2 commits intoJul 15, 2026
Conversation
Verified on Codex 0.142.5 that MCP tool calls fire PreToolUse/PostToolUse hooks and that the hook payload's tool_name uses the canonical mcp__<server>__<tool> form (e.g. mcp__everything__echo) — identical to Claude Code. Codex's internal trace name flattens this to "mcp__everythingecho", but the hook the plugin consumes is canonical, so the pipeline's generic ExtractMCPServer / NormalizeMCPToolName handle it with zero Codex-specific code. Captured a real mcp__everything__echo call and added the PreToolUse/ PostToolUse pair to the golden fixture. The resulting span is "execute_tool echo" with gen_ai.tool.name=echo and dash0.gen_ai.tool.mcp_server=everything. Added an explicit invariant so a regression fails even if the golden is re-blessed. Note: MCP tools are gated behind Codex's ToolSearchAlwaysDeferMcpTools feature (tool_search), and stdio MCP servers must complete their handshake within the startup timeout to be indexed — orthogonal to plugin capture. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bertschneider
approved these changes
Jul 15, 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.
Closes SIG-198.
What this verifies
MCP tool calls on the Codex path were likely-works-but-unverified — the pipeline handles
mcp__<server>__<tool>generically, but there was no proof for Codex and an open risk that older Codex might not fire tool hooks for MCP at all.Verified live on Codex 0.142.5 (the pinned version):
mcp__everything__echocall produced bothPreToolUseandPostToolUsehook events.tool_nameis canonical —mcp__everything__echo, with the__separator, identical to Claude Code. (Codex's internal trace name flattens this tomcp__everythingecho, but the hook the plugin consumes is canonical.)ExtractMCPServer/NormalizeMCPToolNamehandle it with zero Codex-specific code.Changes
PreToolUse/PostToolUsepair tocaptured_events.jsonl(injected into the simplest existing session).golden_spans.json. The MCP call becomes spanexecute_tool echowithgen_ai.tool.name=echoanddash0.gen_ai.tool.mcp_server=everything.TestGoldenSpanTreeso a regression fails even if the golden is blindly re-blessed.Notes for reviewers
golden_spans.jsondiff is mostly span/trace token renumbering +durationMsshifts from inserting one event mid-session; the only new span is the MCP one.ToolSearchAlwaysDeferMcpToolsfeature (tool_search), and stdio MCP servers must finish their handshake within the startup timeout to be indexed — both orthogonal to plugin capture.