[codex] Attribute app-server analytics by thread originator#29935
[codex] Attribute app-server analytics by thread originator#29935alexsong-oai wants to merge 1 commit into
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| } | ||
|
|
||
| pub fn set_thread_originator(&self, thread_id: String, originator: String) { | ||
| self.record_fact(AnalyticsFact::SetThreadOriginator { |
There was a problem hiding this comment.
This cannot be a best-effort fact. If this drops but a later thread response gets through, we silently use the connection product ID for the rest of the thread. Can we carry the originator with the lifecycle fact or otherwise publish this state losslessly?
| event, | ||
| &thread.id, | ||
| &thread.session_id, | ||
| "codex", |
There was a problem hiding this comment.
This does not exercise the override: the persisted originator and connection product ID are both "codex", so it passes if SetThreadOriginator is never sent
Why
Desktop Work threads and regular Codex threads can share the same app-server connection. App-server analytics currently copy
product_client_idfrom connection metadata for every thread-scoped event, so Work thread activity is attributed to the Desktop connection instead of the thread's resolved originator. This prevents analytics from distinguishing the two products on a shared connection.What changed
app_server_client.product_client_idfor thread, turn, tool, review, goal, guardian, and compaction events while preserving the connection's client name, version, and transport metadata.Validation
just test -p codex-analytics thread_originator_overrides_shared_connection_across_thread_events subagent_events_keep_thread_originator_with_explicit_turn_connectionjust test -p codex-app-server turn_start_tracks_thread_originator_in_analytics thread_start_tracks_thread_initialized_analytics thread_fork_tracks_thread_initialized_analytics thread_resume_tracks_thread_initialized_analyticsjust test -p codex-core thread_manager