Skip to content

Propagate thread id in MCP tool metadata#18093

Merged
rennie-openai merged 3 commits into
mainfrom
codex/propagate-mcp-thread-context
Apr 21, 2026
Merged

Propagate thread id in MCP tool metadata#18093
rennie-openai merged 3 commits into
mainfrom
codex/propagate-mcp-thread-context

Conversation

@rennie-openai

@rennie-openai rennie-openai commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • attach the authoritative Codex thread id to MCP tool request _meta.threadId for model-initiated tool calls
  • attach the same thread id for manual mcpServer/tool/call requests before invoking the MCP server
  • cover both metadata helper behavior and the manual app-server MCP path in tests

needed because the Rust app-server is the last place that still has authoritative knowledge of “this model-generated MCP tool call belongs to conversation/thread X” before the request leaves Codex and reaches Hoopa. It adds threadId to MCP request metadata in the model-generated tool-call path, using sess.conversation_id, and also does the same for the manual mcpServer/tool/call path.

Test plan

  • cargo test -p codex-core mcp_tool_call_thread_id_meta_is_added_to_request_meta --lib
  • cargo test -p codex-app-server mcp_server_tool_call_returns_tool_result

Paired Hoopa consumer PR: https://github.com/openai/openai/pull/833263

@github-actions

github-actions Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@rennie-openai rennie-openai requested a review from a team as a code owner April 21, 2026 05:44
@rennie-openai

Copy link
Copy Markdown
Contributor Author

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

@rennie-openai

Copy link
Copy Markdown
Contributor Author

recheck

github-actions Bot added a commit that referenced this pull request Apr 21, 2026
@rennie-openai rennie-openai merged commit 3a9df58 into main Apr 21, 2026
25 of 28 checks passed
@rennie-openai rennie-openai deleted the codex/propagate-mcp-thread-context branch April 21, 2026 17:09
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 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.

3 participants