[codex-analytics] add grouped session id to runtime events (#24655)

## Why
- Runtime analytics events report `thread_id`, which identifies the
individual thread emitting an event
- They don't report `session_id`, which identifies the shared session
for a root thread and its subagent threads
- Emitting both identifiers allows analytics to group related activity

## What Changed
- Adds `session_id` to relevant analytics events (thread_initalized,
turn, turn_steer, compaction, guardian_review)
- Tracks each thread's session ID in the analytics reducer so subsequent
thread scoped events emit the same value
- Carries the shared session ID through subagent initialization

## Verification
- `just test -p codex-analytics` validates event payloads and subagent
session grouping.
- Focused `codex-app-server` tests validate session IDs for thread,
turn, and steer events.
- Focused `codex-core` tests validate root and subagent session ID
propagation.
This commit is contained in:
marksteinbrick-oai
2026-05-26 16:38:46 -07:00
committed by GitHub
Unverified
parent dc4e54d061
commit 487521733b
13 changed files with 87 additions and 5 deletions
+1
View File
@@ -109,6 +109,7 @@ pub(crate) async fn run_codex_thread_interactive(
emit_subagent_session_started(
&parent_session.services.analytics_events_client,
client_metadata,
codex.session.session_id(),
codex.session.conversation_id,
Some(parent_session.conversation_id),
thread_config,