diff --git a/codex-rs/protocol/src/protocol.rs b/codex-rs/protocol/src/protocol.rs index 34e5a4794527..6d868bab39a6 100644 --- a/codex-rs/protocol/src/protocol.rs +++ b/codex-rs/protocol/src/protocol.rs @@ -4018,6 +4018,28 @@ mod tests { ); } + #[test] + fn inter_agent_communication_response_input_item_preserves_commentary_phase() { + let communication = InterAgentCommunication { + author: AgentPath::root(), + recipient: AgentPath::root().join("reviewer").expect("recipient path"), + other_recipients: vec![AgentPath::root().join("worker").expect("recipient path")], + content: "review the diff".to_string(), + trigger_turn: true, + }; + + assert_eq!( + communication.to_response_input_item(), + ResponseInputItem::Message { + role: "assistant".to_string(), + content: vec![ContentItem::OutputText { + text: serde_json::to_string(&communication).expect("serialize communication"), + }], + phase: Some(MessagePhase::Commentary), + } + ); + } + #[test] fn session_source_from_startup_arg_normalizes_custom_values() { assert_eq!(