mirror of
https://github.com/openai/codex.git
synced 2026-10-21 12:10:06 +00:00
Drop descendant channel posts from retained remote compaction v2 history (#47249)
## Why Remote compaction v2 excluded descendant progress messages from retained history but kept `CHANNEL_POST` messages from those same agents. ## What changed Treat descendant `CHANNEL_POST` messages like `MESSAGE` progress updates when selecting history to retain after remote compaction v2. ## Testing Extend the remote compaction test to verify that a child channel post is included in the compaction input and omitted from the follow-up request. GitOrigin-RevId: 204bf44b8cddf1e6dc1e48234f51d4ac2aaf2e9f
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user