Skip to content

test(codex): coverage for MCP tool calls (SIG-198)#171

Merged
GuyMoses merged 2 commits into
mainfrom
sig-198-verify-add-golden-coverage-for-codex-mcp-tool-calls
Jul 15, 2026
Merged

test(codex): coverage for MCP tool calls (SIG-198)#171
GuyMoses merged 2 commits into
mainfrom
sig-198-verify-add-golden-coverage-for-codex-mcp-tool-calls

Conversation

@GuyMoses

@GuyMoses GuyMoses commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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):

  • Tool hooks DO fire for MCP. A real mcp__everything__echo call produced both PreToolUse and PostToolUse hook events.
  • The hook payload tool_name is canonicalmcp__everything__echo, with the __ separator, identical to Claude Code. (Codex's internal trace name flattens this to mcp__everythingecho, but the hook the plugin consumes is canonical.)
  • The pipeline's existing ExtractMCPServer / NormalizeMCPToolName handle it with zero Codex-specific code.

Changes

  • Added the captured PreToolUse/PostToolUse pair to captured_events.jsonl (injected into the simplest existing session).
  • Regenerated golden_spans.json. The MCP call becomes span execute_tool echo with gen_ai.tool.name=echo and dash0.gen_ai.tool.mcp_server=everything.
  • Added an explicit invariant in TestGoldenSpanTree so a regression fails even if the golden is blindly re-blessed.

Notes for reviewers

  • The large golden_spans.json diff is mostly span/trace token renumbering + durationMs shifts from inserting one event mid-session; the only new span is the MCP one.
  • MCP tools are gated behind Codex's ToolSearchAlwaysDeferMcpTools feature (tool_search), and stdio MCP servers must finish their handshake within the startup timeout to be indexed — both orthogonal to plugin capture.

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>
@GuyMoses GuyMoses requested a review from a team as a code owner July 15, 2026 08:21
@GuyMoses GuyMoses changed the title test(codex): golden coverage for MCP tool calls (SIG-198) test(codex): coverage for MCP tool calls (SIG-198) Jul 15, 2026
@GuyMoses GuyMoses merged commit a54a1d9 into main Jul 15, 2026
7 checks passed
@GuyMoses GuyMoses deleted the sig-198-verify-add-golden-coverage-for-codex-mcp-tool-calls branch July 15, 2026 09:56
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants