Plumb MCP turn metadata through _meta#15190
Merged
nicholasclark-openai merged 14 commits intomainfrom Mar 19, 2026
Merged
Conversation
This reverts commit b14689d.
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Base automatically changed from
revert-15011-nicholasclark/tool-call-task-headers
to
main
March 19, 2026 17:38
Co-authored-by: Codex <noreply@openai.com>
|
|
||
| #[allow(clippy::too_many_arguments)] | ||
| fn make_turn_context( | ||
| conversation_id: ThreadId, |
Contributor
Author
There was a problem hiding this comment.
We need to pass along session id as well to get the full picture
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
owenlin0
approved these changes
Mar 19, 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.
Summary
Some background. We're looking to instrument GA turns end to end. Right now a big gap is grouping mcp tool calls with their codex sessions. We send session id and turn id headers to the responses call but not the mcp/wham calls.
Ideally we could pass the args as headers like with responses, but given the setup of the rmcp client, we can't send as headers without either changing the rmcp package upstream to allow per request headers or introducing a mutex which break concurrency. An earlier attempt made the assumption that we had 1 client per thread, which allowed us to set headers at the start of a turn. @pakrym mentioned that this assumption might break in the near future.
So the solution now is to package the turn metadata/session id into the _meta field in the post body and pull out in codex-backend.
tools/call_metainstead of assuming per-thread request headers on shared clients_codex_appsmetadata while addingx-codex-turn-metadatafor all MCP tool calls