Skip to content

[codex-analytics] add session source to client metadata#17374

Merged
marksteinbrick-oai merged 4 commits intomainfrom
mark.steinbrick/responses-session-source-metadata
Apr 14, 2026
Merged

[codex-analytics] add session source to client metadata#17374
marksteinbrick-oai merged 4 commits intomainfrom
mark.steinbrick/responses-session-source-metadata

Conversation

@marksteinbrick-oai
Copy link
Copy Markdown
Contributor

@marksteinbrick-oai marksteinbrick-oai commented Apr 10, 2026

Summary

Adds thread_source field to the existing Codex turn metadata sent to Responses API

  • Sends thread_source: "user" for user-initiated sessions: CLI, VS Code, and Exec
  • Sends thread_source: "subagent" for subagent sessions
  • Omits thread_source for MCP, custom, and unknown session sources
  • Uses the existing turn metadata transport:
    • HTTP requests send through the x-codex-turn-metadata header
    • WebSocket response.create requests send through client_metadata["x-codex-turn-metadata"]

Testing

  • cargo test -p codex-protocol session_source_thread_source_name_classifies_user_and_subagent_sources
  • cargo test -p codex-core turn_metadata_state
  • cargo test -p codex-core --test responses_headers responses_stream_includes_turn_metadata_header_for_git_workspace_e2e -- --nocapture

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

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

@marksteinbrick-oai marksteinbrick-oai force-pushed the mark.steinbrick/responses-session-source-metadata branch 2 times, most recently from fa0bee6 to 511dc1f Compare April 10, 2026 22:10
@marksteinbrick-oai marksteinbrick-oai changed the title Add session source to Responses metadata [codex-analytics] add session source to client metadata Apr 10, 2026
@marksteinbrick-oai
Copy link
Copy Markdown
Contributor Author

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

github-actions bot added a commit that referenced this pull request Apr 10, 2026
@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Apr 11, 2026
@marksteinbrick-oai marksteinbrick-oai force-pushed the mark.steinbrick/responses-session-source-metadata branch 2 times, most recently from 26d9ffc to 5f4c1bd Compare April 13, 2026 17:01
@marksteinbrick-oai marksteinbrick-oai marked this pull request as ready for review April 13, 2026 19:03
Comment thread codex-rs/core/src/codex.rs Outdated
@marksteinbrick-oai marksteinbrick-oai force-pushed the mark.steinbrick/responses-session-source-metadata branch from da95670 to 4dd6fce Compare April 13, 2026 22:13
@marksteinbrick-oai marksteinbrick-oai force-pushed the mark.steinbrick/responses-session-source-metadata branch from 81eb1ef to 33b3fd5 Compare April 14, 2026 15:26
@marksteinbrick-oai marksteinbrick-oai merged commit 61fe231 into main Apr 14, 2026
21 of 22 checks passed
@marksteinbrick-oai marksteinbrick-oai deleted the mark.steinbrick/responses-session-source-metadata branch April 14, 2026 15:55
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants