Repository navigation
fix(app-server): set originator header from initialize JSON-RPC request - #8873
Merged
Merged
Conversation
owenlin0
force-pushed
the
owen/set_originator_via_client_info
branch
from
January 8, 2026 00:47
7613105 to
c2a6605
Compare
owenlin0
force-pushed
the
owen/set_originator_via_client_info
branch
from
January 8, 2026 01:43
47b424b to
818699b
Compare
owenlin0
marked this pull request as ready for review
January 8, 2026 17:21
Contributor
Author
|
@codex review |
Contributor
|
Note To use Codex here, create a Codex account and connect to github. |
Contributor
Author
|
@codex review |
Contributor
|
Note To use Codex here, create a Codex account and connect to github. |
bolinfest
approved these changes
Jan 9, 2026
bolinfest
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the detailed explanation!
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.
Motivation
The
originatorheader is important for codex-backend’s Responses API proxy because it identifies the real end client (codex cli, codex vscode extension, codex exec, future IDEs) and is used to categorize requests by client for our enterprise compliance API.Today the
originatorheader is set by either:CODEX_INTERNAL_ORIGINATOR_OVERRIDEenv var (our VSCode extension does this)set_default_originator()which sets a global immutable singleton (codex execdoes this)For
codex app-server, we want theinitializeJSON-RPC request to set that header because it is a natural place to do so. Example:{ "method": "initialize", "id": 0, "params": { "clientInfo": { "name": "codex_vscode", "title": "Codex VS Code Extension", "version": "0.1.0" } } }and when app-server receives that request, it can call
set_default_originator(). This is a much more natural interface than asking third party developers to set an env var.One hiccup is that
originator()reads the global singleton and locks in the value, preventing a laterset_default_originator()call from setting it. This would be fine but is brittle, since any codepath that callsoriginator()before app-server can process aninitializeJSON-RPC call would prevent app-server from setting it. This was actually the case with OTEL initialization which runs on boot, but I also saw this behavior in certain tests.Instead, what we now do is:
CODEX_INTERNAL_ORIGINATOR_OVERRIDEenv var is set,originator()would return that value andset_default_originator()with some other value does NOT override it.originator()would return the default value which iscodex_cli_rsUNTILset_default_originator()is called once, in which case it is set to the new value and becomes immutable. Later calls toset_default_originator()returnsSetOriginatorError::AlreadyInitialized.Other notes
codex_core::otel_init::build_providerto accepts a service name override, and app-server sends a hardcodedcodex_app_serverservice name to distinguish it fromcodex_cli_rsused by default (e.g. TUI).Next steps
clientInfo.nameoninitializeand drop theCODEX_INTERNAL_ORIGINATOR_OVERRIDEenv var.CODEX_INTERNAL_ORIGINATOR_OVERRIDEin codex-rs.