mirror of
https://github.com/openai/codex.git
synced 2026-11-25 15:24:26 +00:00
Add root turn IDs to turn and tool analytics (#40486)
## Why Analytics need to associate subagent activity with the top-level turn that caused it, while avoiding a stale association when steering makes that origin ambiguous. ## What changed - Add `root_turn_id` to turn and tool-item analytics events. - Read the root from live turn metadata when each event is built, reporting `null` when the root is unknown or ambiguous. - Propagate the metadata through control-tool and code-mode completion facts so correlated and background tool events retain the correct root. ## Testing - Cover root IDs for top-level turns, subagent turns, correlated code-mode calls, and tool events emitted after turn completion. - Verify that queued and subsequent events report `null` after the live root is invalidated. GitOrigin-RevId: 42fd76541c3c716cec74787d47b50adb2d22e6d2
This commit is contained in:
1 parent
0280d73c1e
commit
49880081fe
13 files changed
+439
-30
No files matched your search
@@ -629,6 +629,7 @@ pub(crate) struct CodexToolItemEventBase {
|
||||
pub(crate) thread_id: String,
|
||||
pub(crate) session_id: String,
|
||||
pub(crate) turn_id: String,
|
||||
pub(crate) root_turn_id: Option<String>,
|
||||
/// App-server ThreadItem.id. For tool-originated items this generally
|
||||
/// corresponds to the originating core call_id.
|
||||
pub(crate) item_id: String,
|
||||
@@ -1004,6 +1005,7 @@ pub(crate) struct CodexTurnEventParams {
|
||||
pub(crate) thread_id: String,
|
||||
pub(crate) session_id: String,
|
||||
pub(crate) turn_id: String,
|
||||
pub(crate) root_turn_id: Option<String>,
|
||||
// TODO(rhan-oai): Populate once queued/default submission type is plumbed from
|
||||
// the turn/start callsites instead of always being reported as None.
|
||||
pub(crate) submission_type: Option<TurnSubmissionType>,
|
||||
|
||||
Reference in new issue
Block a user