Make collab spawn metadata accurate on completion

This commit is contained in:
Ahmed Ibrahim
2026-03-11 20:20:31 -07:00
parent 5bc82c5b93
commit cfb3b3e56c
6 changed files with 143 additions and 47 deletions
@@ -862,8 +862,8 @@ pub(crate) async fn apply_bespoke_event_handling(
sender_thread_id: begin_event.sender_thread_id.to_string(),
receiver_thread_ids: Vec::new(),
prompt: Some(begin_event.prompt),
model: Some(begin_event.model),
reasoning_effort: Some(begin_event.reasoning_effort),
model: None,
reasoning_effort: None,
agents_states: HashMap::new(),
};
let notification = ItemStartedNotification {
@@ -1078,8 +1078,8 @@ pub(crate) async fn apply_bespoke_event_handling(
sender_thread_id: end_event.sender_thread_id.to_string(),
receiver_thread_ids: vec![receiver_id],
prompt: None,
model: None,
reasoning_effort: None,
model: end_event.model,
reasoning_effort: end_event.reasoning_effort,
agents_states,
};
let notification = ItemCompletedNotification {
@@ -2557,8 +2557,8 @@ fn collab_resume_end_item(end_event: codex_protocol::protocol::CollabResumeEndEv
sender_thread_id: end_event.sender_thread_id.to_string(),
receiver_thread_ids: vec![receiver_id],
prompt: None,
model: None,
reasoning_effort: None,
model: end_event.model,
reasoning_effort: end_event.reasoning_effort,
agents_states,
}
}
@@ -2946,6 +2946,8 @@ mod tests {
receiver_thread_id: ThreadId::new(),
receiver_agent_nickname: None,
receiver_agent_role: None,
model: Some("gpt-5.4-mini".to_string()),
reasoning_effort: Some(codex_protocol::openai_models::ReasoningEffort::High),
status: codex_protocol::protocol::AgentStatus::NotFound,
};
@@ -2958,8 +2960,8 @@ mod tests {
sender_thread_id: event.sender_thread_id.to_string(),
receiver_thread_ids: vec![receiver_id.clone()],
prompt: None,
model: None,
reasoning_effort: None,
model: Some("gpt-5.4-mini".to_string()),
reasoning_effort: Some(codex_protocol::openai_models::ReasoningEffort::High),
agents_states: [(
receiver_id,
V2CollabAgentStatus::from(codex_protocol::protocol::AgentStatus::NotFound),
@@ -1664,7 +1664,7 @@ async fn turn_start_file_change_approval_v2() -> Result<()> {
}
#[tokio::test]
async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<()> {
async fn turn_start_omits_spawn_agent_model_metadata_until_completion_v2() -> Result<()> {
skip_if_no_network!(Ok(()));
const CHILD_PROMPT: &str = "child: do work";
@@ -1777,8 +1777,8 @@ async fn turn_start_emits_spawn_agent_item_with_model_metadata_v2() -> Result<()
sender_thread_id: thread.id.clone(),
receiver_thread_ids: Vec::new(),
prompt: Some(CHILD_PROMPT.to_string()),
model: Some(REQUESTED_MODEL.to_string()),
reasoning_effort: Some(REQUESTED_REASONING_EFFORT),
model: None,
reasoning_effort: None,
agents_states: HashMap::new(),
}
);