analytics: add parent turn id to thread init events

This commit is contained in:
Mark Steinbrick
2026-05-16 12:27:59 -07:00
parent 98129fb9c5
commit 321cee9c87
42 changed files with 426 additions and 55 deletions
+33
View File
@@ -2573,6 +2573,8 @@ pub enum SubAgentSource {
Compact,
ThreadSpawn {
parent_thread_id: ThreadId,
#[serde(default)]
parent_turn_id: Option<String>,
depth: i32,
#[serde(default)]
agent_path: Option<AgentPath>,
@@ -3980,6 +3982,37 @@ mod tests {
);
}
#[test]
fn thread_spawn_session_source_deserializes_without_parent_turn_id() {
let parent_thread_id =
ThreadId::from_string("11111111-1111-1111-1111-111111111111").expect("valid thread id");
let source: SessionSource = serde_json::from_value(serde_json::json!({
"subagent": {
"thread_spawn": {
"parent_thread_id": parent_thread_id.to_string(),
"depth": 1,
"agent_path": null,
"agent_nickname": null,
"agent_role": null
}
}
}))
.expect("thread spawn source should deserialize without parent_turn_id");
assert_eq!(
source,
SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id,
parent_turn_id: None,
depth: 1,
agent_path: None,
agent_nickname: None,
agent_role: None,
})
);
}
#[test]
fn inter_agent_communication_response_input_item_preserves_commentary_phase() {
let communication = InterAgentCommunication {