mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
Preserve trigger intent in typed agent messages
This commit is contained in:
@@ -55,6 +55,28 @@ fn inter_agent_assistant_message(text: &str) -> ResponseItem {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typed_inter_agent_message_preserves_trigger_turn() {
|
||||
for trigger_turn in [false, true] {
|
||||
let communication = InterAgentCommunication::new(
|
||||
AgentPath::root(),
|
||||
AgentPath::root().join("worker").expect("worker path"),
|
||||
Vec::new(),
|
||||
"hello".to_string(),
|
||||
trigger_turn,
|
||||
);
|
||||
|
||||
let ResponseItem::AgentMessage {
|
||||
trigger_turn: serialized_trigger_turn,
|
||||
..
|
||||
} = communication.to_model_input_item()
|
||||
else {
|
||||
panic!("expected typed agent message");
|
||||
};
|
||||
assert_eq!(serialized_trigger_turn, Some(trigger_turn));
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_initial_history_reconstructs_typed_inter_agent_message() {
|
||||
let (session, _turn_context) = make_session_and_context().await;
|
||||
|
||||
@@ -922,6 +922,9 @@ pub enum ResponseItem {
|
||||
content: Vec<AgentMessageInputContent>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
trigger_turn: Option<bool>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
metadata: Option<ResponseItemMetadata>,
|
||||
},
|
||||
Reasoning {
|
||||
|
||||
@@ -750,6 +750,7 @@ impl InterAgentCommunication {
|
||||
author: self.author.to_string(),
|
||||
recipient: self.recipient.to_string(),
|
||||
content: vec![content],
|
||||
trigger_turn: Some(self.trigger_turn),
|
||||
metadata: self.metadata.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user