Scope app-server client identity per connection#22548
Draft
owenlin0 wants to merge 2 commits into
Draft
Conversation
49d34f7 to
87f1c39
Compare
9c2a57b to
0d9e848
Compare
0d9e848 to
94a78f4
Compare
e102964 to
8eadd52
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
The app-server can host multiple clients in the same long-lived process, but client identity was still largely process-global. That made attribution fragile: one initialized client could influence outbound
originatorandUser-Agentheaders for later app-server work, while infrastructure clients such ascodex_app_server_daemonandcodex-backendwere excluded from global mutation even when they initiated session work.Model/realtime requests, telemetry, and connector filtering should use the client identity for the connection that owns the request, not whatever process-global identity happens to be set.
What Changed
ClientIdentitypath incodex-loginthat can build originator,User-Agent, default headers, and reqwest clients from an explicit identity while preserving existing process-default behavior outside the scope.initializeto validate and store a concrete identity for every initialized connection, including daemon/backend clients, without mutating process-global originator or user-agent suffix.ModelClientand realtime paths to use the scoped/session identity for HTTP requests, Responses websocket handshakes, realtime call creation, and sideband/default headers.Verification
codex-logincoverage for scoped identity overriding process-default headers.codex-backendinitializes first and a latercodex_iosthread still sends model requests withcodex_iosheaders.CODEX_INTERNAL_ORIGINATOR_OVERRIDE.