Lightweight coding agent that runs in your terminal
Rust
Drop descendant channel posts from retained remote compaction v2 history (#47249)
jifc117207a6f1f
diff --git a/codex-rs/core/src/compact_remote_v2.rs b/codex-rs/core/src/compact_remote_v2.rsindex a6436d15f7..722b24cf8e 100644--- a/codex-rs/core/src/compact_remote_v2.rs+++ b/codex-rs/core/src/compact_remote_v2.rs@@ -572,6 +572,7 @@ fn is_retained_for_remote_compaction_v2(content.first(),Some(AgentMessageInputContent::InputText { text })if text.starts_with("Message Type: MESSAGE\n")+ || text.starts_with("Message Type: CHANNEL_POST\n"));let is_completion = matches!(content.first(),diff --git a/codex-rs/core/tests/suite/compact_remote.rs b/codex-rs/core/tests/suite/compact_remote.rsindex f7dc16e13d..f8a82bd394 100644--- a/codex-rs/core/tests/suite/compact_remote.rs+++ b/codex-rs/core/tests/suite/compact_remote.rs@@ -912,6 +912,19 @@ async fn remote_compact_v2_reuses_compaction_trigger_for_followups() -> Result<(start_options: Default::default(),}).await?;+ let channel_progress = "Message Type: CHANNEL_POST\nSender: /root/child\nChannel: progress\nMessage ID: aaaabbbbcccc\nThread ID: aaaabbbbcccc\nPayload:\nchild channel progress";+ codex+ .submit(Op::InterAgentCommunication {+ communication: InterAgentCommunication::new(+ AgentPath::root().join("child").expect("valid child path"),+ AgentPath::root(),+ Vec::new(),+ channel_progress.to_string(),+ /*trigger_turn*/ false,+ ),+ start_options: Default::default(),+ })+ .await?;codex.submit(Op::InterAgentCommunication {communication: InterAgentCommunication::new(@@ -1012,6 +1025,12 @@ async fn remote_compact_v2_reuses_compaction_trigger_for_followups() -> Result<(.any(|item| item.to_string().contains("child progress")),"expected v2 compaction input to include the child progress update");+ assert!(+ compact_request+ .inputs_of_type("agent_message")+ .iter()+ .any(|item| item["content"][0]["text"].as_str() == Some(channel_progress))+ );assert!(compact_request.inputs_of_type("agent_message")@@ -1106,6 +1125,12 @@ async fn remote_compact_v2_reuses_compaction_trigger_for_followups() -> Result<(.all(|item| !item.to_string().contains("child progress")),"expected v2 follow-up request to omit the child progress update");+ assert!(+ follow_up_request+ .inputs_of_type("agent_message")+ .iter()+ .all(|item| item["content"][0]["text"].as_str() != Some(channel_progress))+ );assert!(follow_up_request.inputs_of_type("agent_message")